Module: NimbleshopSimply::SimplyHelper

Defined in:
app/helpers/nimbleshop_simply/simply_helper.rb

Instance Method Summary collapse

Instance Method Details

#items_count_in_cartObject



11
12
13
# File 'app/helpers/nimbleshop_simply/simply_helper.rb', line 11

def items_count_in_cart
  current_order.blank? ? 0 : current_order.item_count
end

#options_for_countries(country_codes) ⇒ Object



19
20
21
# File 'app/helpers/nimbleshop_simply/simply_helper.rb', line 19

def options_for_countries(country_codes)
  country_codes.map {|t| [ Carmen::Country.coded(t).name, t ] }
end

#options_for_country(country_code) ⇒ Object



15
16
17
# File 'app/helpers/nimbleshop_simply/simply_helper.rb', line 15

def options_for_country(country_code)
  grouped_options_for_country_state_codes[country_code]
end

#product_main_picture(product, version = :medium_plus) ⇒ Object

returns nil if the product does not have a main picture



5
6
7
8
9
# File 'app/helpers/nimbleshop_simply/simply_helper.rb', line 5

def product_main_picture(product, version = :medium_plus)
  if pic = product.picture
    image_tag(pic.picture_url(version), alt: product.name)
  end
end