Module: TbCommerce::CartsHelper

Defined in:
app/helpers/tb_commerce/carts_helper.rb

Instance Method Summary collapse

Instance Method Details

Return a link to the user’s shopping cart, with the number of items in the text

  • link_text: The text of the link. Defaults: “My Cart”



7
8
9
10
11
12
13
14
# File 'app/helpers/tb_commerce/carts_helper.rb', line 7

def tb_commerce_cart_link(link_text:'My Cart')
  if tb_commerce_current_cart.present?
    count = tb_commerce_current_cart.cart_items.count
  else
    count = 0
  end
  link_to "#{link_text} (#{count})", tb_commerce_cart_path, :class => 'tb-checkout-cart-link'
end

#tb_commerce_credit_card_typesObject

Return a list of credit card types for use with a form select



18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/helpers/tb_commerce/carts_helper.rb', line 18

def tb_commerce_credit_card_types()
  types = [
    ['Visa', 'visa'],
    ['MasterCard', 'master'],
    ['Discover', 'discover'],
    ['American Express', 'american_express']
  ]
  types.select!{ |a, b|
    TbCommerce.config.card_types.include?(b.to_sym)
  }
  return types
end

#tb_commerce_options_for_cart_item(cart_item) ⇒ Object



31
32
33
# File 'app/helpers/tb_commerce/carts_helper.rb', line 31

def tb_commerce_options_for_cart_item(cart_item)

end