Developer forum

Forum » Development » How to add multiple items to the shoppingcart

How to add multiple items to the shoppingcart


Reply

Hola..

 

I've made a shop based on standard DW eCom functionality. Our customer requested that we add give the users of the shop the option of defining how many of a specific shopitem they want to add to the shoppingcart - just with a simple text-field.

 

Our partner consultant referred to the documentation (http://documentation.dynamicweb.dk/Adding-multiple-products-to-the-shopping-cart-27899.aspx). I've implemented the code as described, and my ProductList template now looks like this:

 

<form name="multiForm" id="multiForm" method="post">
 
<input type="hidden" name="CartCmd" id="CartCmd" value="addMulti" />
 
<
!--@LoopStart(Products)-->

<!--@Ecom:Product.Form.Multi.HiddenFields-->
 
<
!--@Ecom:Product.Number--> - <!--@Ecom:Product.Name-->
<
!--@Ecom:Product.Price.Price--><br />

<input type="text" name="Quantity!--@Ecom:Product.LoopCounter-->" value="0" />

<!--@LoopEnd(Products)-->
 
</form>

 

When i press the 'Submit' button i place outside the loop, the page just reloads and no items are added to the cart. Anyone got any bright ideas?

 

Also, this snippet is to be used on the ProductList template. I also need to implement it on the Product template. So at this point i'll also need some pointers :)

 

Hope anyone can help..

 

Best regards, Peter

 

 

 


Replies

 
Reply

Could you post the HTML that is generated by your template?

 
Reply
Sorensen wrote:

Could you post the HTML that is generated by your template?


 

 

Sure, here you go:

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

  
       <input type="hidden" name="ProductLoopCounter1" id="ProductLoopCounter1" value="1" /><input type="hidden" name="ProductID1" id="ProductID1" value="PROD42" /><input type="hidden" name="VariantID1" id="VariantID1" value="" /><input type="hidden" name="UnitID1" id="UnitID1" value="" />
       1105 - 1105 Blå Spanvall<br/>
       1.665,00<br />
       <input type="text" name="Quantity!--@Ecom:Product.LoopCounter-->" value="0" /><br/>
  
       <input type="hidden" name="ProductLoopCounter2" id="ProductLoopCounter2" value="2" /><input type="hidden" name="ProductID2" id="ProductID2" value="PROD44" /><input type="hidden" name="VariantID2" id="VariantID2" value="" /><input type="hidden" name="UnitID2" id="UnitID2" value="" />
       1135 - 1135 Gul Spanvall<br/>
       1.845,00<br />
       <input type="text" name="Quantity!--@Ecom:Product.LoopCounter-->" value="0" /><br/>
  

</form>

<a href="javascript:document.multiForm.submit();">Tilf&oslash;j alle</a>

 

 

And now that you mentioned it, I can see that a "<" i missing in front of the "Quantity" name.. Thanks for clearing that out for me ;)

 

As for my other question, i just remove the ProductLoop, and here we go..

 

Thanks for the help :D

 

/ Peter

 

You must be logged in to post in the forum