Module: RoutesHelper

Defined in:
app/helpers/routes_helper.rb

Instance Method Summary collapse

Instance Method Details

#extract_product_category_options(args) ⇒ Object



47
48
49
50
51
52
53
54
55
# File 'app/helpers/routes_helper.rb', line 47

def extract_product_category_options(args)
  options = args.dup.extract_options!
  object = args.first
  if object.kind_of?(ProductCategory)
    return options.merge(:id => nil, :category_name => object.name)
  else
    return args
  end
end

#extract_product_options(args) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'app/helpers/routes_helper.rb', line 28

def extract_product_options(args)
  options = args.dup.extract_options!
  object = args.first
  if object.kind_of?(Product)
    product_type_url = (object.product_type.nil?) ? 'articles' : object.product_type.url
    return options.merge( :url => object.url, :product_type => product_type_url )
  else
    return args
  end
end

#extract_product_type_options(args) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'app/helpers/routes_helper.rb', line 10

def extract_product_type_options(args)
  options = args.dup.extract_options!
  object = args.first
  if object.kind_of?(ProductType)
    return options.merge(:product_type_url => object.url )
  else
    return args
  end
end

#product_category_path(*args) ⇒ Object



39
40
41
# File 'app/helpers/routes_helper.rb', line 39

def product_category_path(*args)
  forgeos_commerce.product_category_path(extract_product_category_options(args))
end

#product_category_url(*args) ⇒ Object



43
44
45
# File 'app/helpers/routes_helper.rb', line 43

def product_category_url(*args)
  forgeos_commerce.product_category_url(extract_product_category_options(args))
end

#seo_product_path(*args) ⇒ Object



20
21
22
# File 'app/helpers/routes_helper.rb', line 20

def seo_product_path(*args)
  super(extract_product_options(args)) rescue '/'
end

#seo_product_type_path(*args) ⇒ Object



2
3
4
# File 'app/helpers/routes_helper.rb', line 2

def seo_product_type_path(*args)
  forgeos_commerce.product_type_path(extract_product_type_options(args)) rescue '/'
end

#seo_product_type_product_category_path(product_type, product_category) ⇒ Object



57
58
59
# File 'app/helpers/routes_helper.rb', line 57

def seo_product_type_product_category_path(product_type,product_category)
  product_type_product_category_path(:product_type_url=>product_type.url,:category_url=>product_category.url)
end

#seo_product_type_url(*args) ⇒ Object



6
7
8
# File 'app/helpers/routes_helper.rb', line 6

def seo_product_type_url(*args)
  forgeos_commerce.product_type_url(extract_product_type_options(args)) rescue '/'
end

#seo_product_url(*args) ⇒ Object



24
25
26
# File 'app/helpers/routes_helper.rb', line 24

def seo_product_url(*args)
  super(extract_product_options(args))
end