Developer forum

Forum » Templates » Problem adding multiple products to cart

Problem adding multiple products to cart

Per Ljung
Reply
Hi!

I have problems with adding multiple products to the shopping cart, here is my form (output from xslt):

<form method="post" name="addMulti" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:js="urn:custom-javascript"><input type="hidden" name="CartCmd" value="addMulti"><table cellspacing="6">
<table>
   

 <tr>
      <td><input type="hidden" name="&#xA;                  ProductID1" value="5343@@SHOP1"></td>
    </tr>
    <tr>
      <td>Black</td>
      <td>7.00 kr
 
            </td>
      <td><input type="text" name="&#xA;                  Quantity1" style="&#xA;                  height:15px;width:30px;&#xA;                " value="0"> st
            </td>
    </tr>
    <tr>
      <td><input type="hidden" name="&#xA;                  ProductID2" value="75485@@SHOP1"></td>
    </tr>
    <tr>
      <td>12,0 Neutral</td>
      <td>0.00 kr
 
            </td>
      <td><input type="text" name="&#xA;                  Quantity2" style="&#xA;                  height:15px;width:30px;&#xA;                " value="0"> st
            </td>
    </tr>
</table>
</form>

Nothing is added.

I know that you can use Ecom.Product.Multi.HiddenFields, but it does not work with that either.
 


Regards,
P


 


Replies

 
Yury Zhukovskiy
Reply

Hi Per,

Product list template should look like this. Important sections are marked.

 

<h2><!--@Ecom:Group.Name--></h2>

 

<form id="multiForm" method="post" name="multiForm"> 

<input id="CartCmd" type="hidden" name="CartCmd" value="addMulti" />

 

<ul id="productlist" class="horizontal">

    <!--@LoopStart(Products)-->  

    <li class="listitem<!--@Products.LoopMod2-->">

        <!--@Ecom:Product.Form.Multi.HiddenFields-->

        <h3><a href="<!--@Ecom:Product.LinkGroup.Clean-->"><!--@Ecom:Product.Name--></a></h3>

        <a href="<!--@Ecom:Product.Link.Clean-->"><!--@Ecom:Product.ImageSmall.Default--></a>

        <span class="price">

            <!--@Ecom:Product.Price-->

        </span>

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

    </li> 

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

</ul>

<input type="submit" name="submit" value="submit" />

</form>

 

HTML will be next. Important sections are marked:

 

<form id="Form1" method="post" name="multiForm"> 

<input id="Hidden1" type="hidden" name="CartCmd" value="addMulti" />

 

<ul id="Ul1" class="horizontal">        

    <li class="listitem1">

        <input type="hidden" name="ProductLoopCounter1" id="ProductLoopCounter1" value="1" />

        <input type="hidden" name="ProductID1" id="ProductID1" value="27333@@SHOP1" />

        <input type="hidden" name="VariantID1" id="VariantID1" value="" />

        <input type="hidden" name="UnitID1" id="UnitID1" value="VO5" />

 

        <h3><a href="/en-US/Ecom/Products-1/1-cm-lydhoved-Intelect/Advanced.aspx">1 cm lydhoved Intelect/Advanced</a></h3>

        <a href="/en-US/Ecom/Products-1/1-cm-lydhoved-Intelect/Advanced.aspx"></a>

        <span class="price">

            kr. 3,468.75

        </span>

              <input name="Quantity1" value="0" type="text" />             

    </li>

    <li class="listitem0">

        <input type="hidden" name="ProductLoopCounter2" id="ProductLoopCounter2" value="2" />

        <input type="hidden" name="ProductID2" id="ProductID2" value="27336@@SHOP1" />

        <input type="hidden" name="VariantID2" id="VariantID2" value="" />

        <input type="hidden" name="UnitID2" id="UnitID2" value="" />

 

        <h3><a href="/en-US/Ecom/Products-1/10-cm2-lydhoved-Intelect/Advanced.aspx">10 cm2 lydhoved Intelect/Advanced</a></h3>

 

        <a href="/en-US/Ecom/Products-1/10-cm2-lydhoved-Intelect/Advanced.aspx"></a>

        <span class="price">

            kr. 3,468.75

        </span>

              <input name="Quantity2" value="0" type="text" />             

    </li>

 

Look please at name attribute of hidden inputs. Your inputs:
 

    <input type="hidden" name="&#xA;                  ProductID2" value="75485@@SHOP1">

    <input type="text" name="&#xA;                  Quantity1" style="&#xA;                  height:15px;width:30px;&#xA;                " value="0">

 

 

I think there is the problem. Make valid html output.

 

 

Kind Regards

Zhukovskiy Yury

 

You must be logged in to post in the forum