Sha256: c79fc1be3dd4233ba1b6c61e69126870b9f423df58e9d77d1fbfa9fdb395a68c

Contents?: true

Size: 901 Bytes

Versions: 3

Compression:

Stored size: 901 Bytes

Contents

module TbCommerce::CartsHelper

  # 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"
  #
  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

  # Return a list of credit card types for use with a form select
  #
  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

  def tb_commerce_options_for_cart_item(cart_item)

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tb_commerce-0.0.4 app/helpers/tb_commerce/carts_helper.rb
tb_commerce-0.0.3 app/helpers/tb_commerce/carts_helper.rb
tb_commerce-0.0.2 app/helpers/tb_commerce/carts_helper.rb