Module: CartHelper

Defined in:
app/helpers/cart_helper.rb

Instance Method Summary collapse

Instance Method Details

#display_voucherObject

Display the voucher form



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/helpers/cart_helper.rb', line 10

def display_voucher
  content = "<span> Bénéficiez-vous d'un code avantage ?</span>"
  content += "<div class='voucherbox'> <label> Code avantage </label>"
  content += text_field_tag(:voucher_code, "", :id => 'voucher_code') + ""
  content +=
    button_to_function(
      'Valider le code',
      remote_function(
        :url => {:controller => 'cart', :action => 'add_voucher'},
        :with => "'voucher_code='+$('#voucher_code').val()"
      ),
      :class => 'no-custom'
    )
  content += "</div>"
end

Display a link to remove a cart product from the current cart



5
6
7
# File 'app/helpers/cart_helper.rb', line 5

def remove_cart_product_link(cart_product_id)
  link_to_function 'supprimer', remote_function(:url => { :controller => 'cart', :action => 'delete_product', :id => cart_product_id} , :confirm =>  'Voulez-vous vraiment supprimer ce produit de votre panier ?'), :class => 'delete_product'
end