Sha256: f4bf3e98317495d206df09f30c66f16c38369dc02f21eabc28f08616eee2f195

Contents?: true

Size: 874 Bytes

Versions: 18

Compression:

Stored size: 874 Bytes

Contents

module PiggybakHelper
  def cart_form(object, options = {})
    render "piggybak/cart/form", :object => object, :locals => { :options => options }
  end
  def cart_link
    cart = Piggybak::Cart.new(request.cookies["cart"])
    nitems = cart.sellables.inject(0) { |nitems, item| nitems + item[:quantity] }
    if nitems > 0 && !["piggybak/orders", "piggybak/cart"].include?(params[:controller])
      link_to "#{pluralize(nitems, 'item')}: #{number_to_currency(cart.total)}", piggybak.cart_url
    end
  end
  def orders_link(text)
    if current_user
      link_to text, piggybak.orders_list_url
    end
  end
  def piggybak_track_order(store_name)
    if params[:controller] == "piggybak/orders" && params[:action] == "receipt" && session.has_key?(:last_order)
      render "piggybak/orders/google_analytics", :order => @order, :store_name => store_name
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
piggybak-0.7.7 app/helpers/piggybak_helper.rb
piggybak-0.7.6 app/helpers/piggybak_helper.rb
piggybak-0.7.5 app/helpers/piggybak_helper.rb
piggybak-0.6.34 app/helpers/piggybak_helper.rb
piggybak-0.7.4 app/helpers/piggybak_helper.rb
piggybak-0.7.3 app/helpers/piggybak_helper.rb
piggybak-0.7.2 app/helpers/piggybak_helper.rb
piggybak-0.7.1 app/helpers/piggybak_helper.rb
piggybak-0.7.0 app/helpers/piggybak_helper.rb
piggybak-0.6.33 app/helpers/piggybak_helper.rb
piggybak-0.6.32 app/helpers/piggybak_helper.rb
piggybak-0.6.31 app/helpers/piggybak_helper.rb
piggybak-0.6.30 app/helpers/piggybak_helper.rb
piggybak-0.6.29 app/helpers/piggybak_helper.rb
piggybak-0.6.28 app/helpers/piggybak_helper.rb
piggybak-0.6.27 app/helpers/piggybak_helper.rb
piggybak-0.6.26 app/helpers/piggybak_helper.rb
piggybak-0.6.25 app/helpers/piggybak_helper.rb