Developer forum

Forum » Development » cartcmd addmulti with special OrderLine field

cartcmd addmulti with special OrderLine field

Dmitrij Jazel
Reply

Hi Guys,

I have build this cartdmd="addmulti" form:

<form action="/Default.aspx" method="get">
<input type="hidden" name="cartcmd" value="addMulti" />
<input type="hidden" name="ID" value="@pageID" />

<input type="hidden" name="ProductLoopCounter1" id="ProductLoopCounter1" value="1">
<input type="hidden" name="ProductID1" id="ProductID1" value="PROD4">
<input type="hidden" name="VariantID1" id="VariantID1" value="">
<input type="hidden" name="UnitID1" id="UnitID1" value="">
<input type="hidden" name="wishListID1" id="wishListID1" value="0">
<input type="text" name=Quantity1" id="Quantity1" value="10">

<input type="hidden" name="ProductLoopCounter2" id="ProductLoopCounter2" value="2">
<input type="hidden" name="ProductID2" id="ProductID2" value="PROD78">
<input type="hidden" name="VariantID2" id="VariantID2" value="">
<input type="hidden" name="UnitID2" id="UnitID2" value="">
<input type="hidden" name="wishListID2" id="wishListID2" value="0">
<input type="text" name=Quantity2" id="Quantity2" value="15">

<input type="hidden" name="ProductLoopCounter3" id="ProductLoopCounter3" value="3">
<input type="hidden" name="ProductID3" id="ProductID3" value="PROD107">
<input type="hidden" name="VariantID3" id="VariantID3" value="">
<input type="hidden" name="UnitID3" id="UnitID3" value="">
<input type="hidden" name="wishListID3" id="wishListID3" value="0">
<input type="text" name=Quantity3" id="Quantity3" value="10">

<input type="submit" id="btn-addToCart" value="Add to cart" />

<form>

When adding to the cart, I need to be able to provide OrderLine field value for each of the products I am adding here.

In other words - How do I add a product via cartcmd="addmulti" with a OrderLine field value.

 

Any suggestions?

/Dmitrij


Replies

 
Dmitriy Benyuk
Reply
This post has been marked as an answer

Hi Dmitrij,

try to add the order line field value in the following format: EcomOrderLineFieldInput_OrderLineFieldSystemName1, where OrderLineFieldSystemName - is an order field system name, 1 - is prefix.For example:
EcomOrderLineFieldInput_CustomField1, EcomOrderLineFieldInput_CustomField2
Regards, Dmitrij

Votes for this answer: 1
 
Dmitrij Jazel
Reply

Hi Dmitriy,

Thanks for information, I will try that.

/Dmitrij

 
Dmitrij Jazel
Reply

Hi Dmitriy,

Ok, here is what I have:

http://sitename.me/Default.aspx?cartcmd=addmulti&ProductLoopCounter1=1&ProductID1=249514915&Quantity1=2&EcomOrderLineFieldInput_Binding1=A&Redirect=false

This url Should teoretically add product to the cart, but for some reason it doesn't.

Here you can see the OrderLineFieldSystemName system-name that you mentioned is "Binding".

 

Analogical single product add to cart URL looks like this

And it works:

http://sitename.me/Default.aspx?ProductID=249514915&cartcmd=add&Quantity=2&EcomOrderLineFieldInput_Binding=A&Redirect=false

 

Any ideas, suggestions, why "addmulti" (url example in the top) might not work?

/Dmitrij

 
Dmitriy Benyuk
Reply
This post has been marked as an answer

Hi Dmitrij,
this maybe because of when "addmulti" is used the "prefix" which is 1 and "ProductLoopCounter1" are taken from the HttpContext.Current.Request.Form but not from the query string, try to make the same params and put them to form and try to submit it.
Regards, Dmitrij

Votes for this answer: 1
 
Dmitrij Jazel
Reply

Well, this make sense, but I will have to get it to work in Ajax eventually. For now we are using "Get" request.

Should I try using post?

 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Hi

I am having this exact same problem. I am trying to do something like this http://mypage.dynamicweb-cms.com?cartcmd=addmulti&ProductLoopCounter1=1&productid1=ProdImport58&Quantity1=2&ProductLoopCounter2=2&productid2=ProdImport58&Quantity2=3&Redirect=false

 

But canĀ“t get it to work. Nothing is being added to cart. How did you solve this?

 

/Hans

 

You must be logged in to post in the forum