Module: Spree::BaseHelperDecorator

Defined in:
app/helpers/spree/base_helper_decorator.rb

Instance Method Summary collapse

Instance Method Details

#custom_product_line_item_url(line_item) ⇒ Object



23
24
25
# File 'app/helpers/spree/base_helper_decorator.rb', line 23

def custom_product_line_item_url(line_item)
  main_app.url_for("/a/#{line_item.qr_data}")
end

#custom_product_storefront_resource_url(resource, options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/helpers/spree/base_helper_decorator.rb', line 3

def custom_product_storefront_resource_url(resource, options = {})
  if defined?(locale_param) && locale_param.present?
    options.merge!(locale: locale_param)
  end

  localize = if options[:locale].present?
               "/#{options[:locale]}"
             else
               ''
             end

  if resource.product_type == 'accommodation'
    "#{current_store.formatted_url + localize}/rooms/#{resource.slug}"
  elsif resource.product_type == 'ecommerce'
    "#{current_store.formatted_url + localize}/tickets/#{resource.slug}"
  else
    spree_storefront_resource_url(resource)
  end
end