Developer forum

Forum » Templates » adding many of the same product to cart?

adding many of the same product to cart?

Antonio Amézquita Ganoza
Reply
Hi

I need to add one or many of the same product into the cart at once (http://screencast.com/t/RvayWMegFDv9)

I have tried this solution below, the problem with it is that if the default value for the input tag is set to "1",
then all the products in the loop get added to the cart.

Does anybody know how to get around this, while keeping the default value for the input tag as 1?

http://screencast.com/t/RvayWMegFDv9


<form name="multiForm" id="multiForm" method="post">
<input type="hidden" name="CartCmd" id="CartCmd" value="addMulti" />

    <!--@LoopStart(Products)-->
    
    <!--@Ecom:Product.Form.Multi.HiddenFields-->
    
        <input type="text" name="Quantity<!--@Ecom:Product.LoopCounter-->" value="1" />
       
    <!--@LoopEnd(Products)-->
    
    <a href="javascript:document.multiForm.submit();"><img src="files/system/shop_addtocart.jpg" alt="Add to cart" border="0" /></a>

</form> 





Replies

 
Yury Zhukovskiy
Reply
This post has been marked as an answer
I think only JS will help you. For example, JS function will clear all inputs, if they contain "1". Call this function before form submit.
Votes for this answer: 0
 
Nicolai Høeg Pedersen
Reply
Or set the quantity value to 0...
 
Antonio Amézquita Ganoza
Reply
Thank you both for the answers, I'll try Yury´s suggestion, cause the designer don´t want to give in!


 

You must be logged in to post in the forum