Jump to content

Add to cart button on list page with quantities / Ajouter au panier avec quantités


Recommended Posts

[english version below]

 

Bonjour,

 

Sur ma page de liste de produits, le boutton 'ajouter au panier' n'apparait que lorsque ma quantité minimale pour le produit est 1. Lorsque la quantité minimale est 6, le bouton 'ajouter au panier' n'apparait pas. Vous pouvez voir une exemple ici : http://www.levindefrance.com/41-achat-vin

 

Auriez-vous une indication sur la façon de modifier cela ? 

Merci beaucoup d'avance,

 

Gabriel

 

 

Hi,

 

On the product list page, the ‘add to cart’ button only appears when the quantity for the product is 1. When I have a minimum quantity of 6, the ‘add to cart’ button doesn’t appear. You can see an exemple here : http://www.levindefrance.com/41-achat-vin

 

Would you have any indication on how I can change that ?

 

Thanks a lot in advance,

 

Gabriel

post-767365-0-96848000-1393780227_thumb.png

Link to comment
Share on other sites

Hi.

 

You need to modify the if statement in product_list.tpl and remove '&& $product.minimal_quantity <= 1'

 

Then you need to find a way to pass the minimal quantity to the script that processes the cart addition. So you can create e.g. a hidden input field to store this value.

 

Finally you will need to override ajax-cart.js and make the proper changes to the function that executes the ajax query, the 'add' function.

 

Regards.

Robin.

The CartExpert Team

Link to comment
Share on other sites

Hi,

Thanks a lot for you answer :-)

 

Actually, I had found this '$product.minimal_quantity <= 1' and tried to remove it (actually I changed it to 18) and it didn't work because then the add to cart button said "you need a minimum of 6". 

 

So if this is the only solution, my question becomes : how to make it add 6 products by default when it's not one ? Can I use the variable $product.minimal_quantity ? Where ?

Thanks a lot in advance, 

 

Regards,

 

Gabriel

Link to comment
Share on other sites

The easiest approach would be to add a hidden input and set its id to 'quantity_wanted_[PRODUCT_ID]' and set its value to $product.minimal_quantity.

 

Then change the ajax-cart.js script and where the click is handled for every '.ajax_add_to_cart_button' change the parameters of the 'add' function to:

 

ajaxCart.add(idProduct, null, false, this, $('#quantity_wanted_'+idProduct).val());

 

This should work.

 

Regards.

Robin.

The CartExpert Team

Link to comment
Share on other sites

  • 2 weeks later...
  • 6 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...