Developer forum

Forum » Templates » Adding more then on product at a time to the cart - problem

Adding more then on product at a time to the cart - problem


Reply

Hello

 

Iam having a really hard time cracking this problem.

 

My productlist works fine then I press the "Køb" botton.

 

http://kontinuum.net.dynamicweb.dk/default.aspx?id=79&GroupID=GROUP9

 

But when I try to use the exact same code on the product site the function failes  :(

 

http://kontinuum.net.dynamicweb.dk/Default.aspx?ID=79&ProductID=PROD5

 

Many thanks

 

Rasmus Samsig


Replies

 
Reply

No, it doesn't fail. It does exactly what you instruct it to. You submit the form using get, and when you use get, the browser ignores whatever query string parameters that may have been defined in the action attribute. There's no action attribute in your form, so it submits to the current page, still without QS parameters, which is Default.aspx...

 

Add a hidden field named ID with the current page id to your form, and you get the result you expect.

 
Reply
Sorensen wrote:

No, it doesn't fail. It does exactly what you instruct it to. You submit the form using get, and when you use get, the browser ignores whatever query string parameters that may have been defined in the action attribute. There's no action attribute in your form, so it submits to the current page, still without QS parameters, which is Default.aspx...

 

Add a hidden field named ID with the current page id to your form, and you get the result you expect.

Thx alot i'll try that. Have you been on the solution? everything is all mest up now...

 
Reply

Yes, I opened your link and looked at the source of the document.

 
Reply
Sorensen wrote:

Yes, I opened your link and looked at the source of the document.


 


 

Sry, I thought you had been in the template and made som changes.

 

I have just tryed doing what you told me but without succes :(

 

<input type="hidden" name=ID" value="79" />

 

I still dont understand the logic when i works on on one site and not the other.

 

Care to help me further on? :)

 

 
Reply

No, I just opened the page in frontend.

 

Your template is quite a mess. You have two opening form tags - a nested form, and only one closing tag. Clean that up, and I guarantee you it will work.

 
Reply
Sorensen wrote:

No, I just opened the page in frontend.

 

Your template is quite a mess. You have two opening form tags - a nested form, and only one closing tag. Clean that up, and I guarantee you it will work.


Well I still can't get it to work.

 

Iam now trying to use a standart product template and the problem is the same.

 

You still belive that it has something to do with the form tags?

http://kontinuum.net.dynamicweb.dk/Default.aspx?ID=79&ProductID=PROD5

 

 

 

 
Reply

No, this time it's the ID field that's causing you problems... Or, should I say the missing ID field, as theres no ID field present in the template. There is, however, a field name ID" (I-D-QUOTE). I assume you forgot to enter a qoute sign on the left of the name attribute value. But browsers aren't that forgiving, and they will send this information as ID".

 
Reply
Sorensen wrote:

No, this time it's the ID field that's causing you problems... Or, should I say the missing ID field, as theres no ID field present in the template. There is, however, a field name ID" (I-D-QUOTE). I assume you forgot to enter a qoute sign on the left of the name attribute value. But browsers aren't that forgiving, and they will send this information as ID".


Hi Lars

 

Iam sorry. I have no idea what you just said. :o

 

"qoute sign" ?

 

What am I missing?

 
Reply
rs@condurra.dk wrote:
Sorensen wrote:

No, this time it's the ID field that's causing you problems... Or, should I say the missing ID field, as theres no ID field present in the template. There is, however, a field name ID" (I-D-QUOTE). I assume you forgot to enter a qoute sign on the left of the name attribute value. But browsers aren't that forgiving, and they will send this information as ID".


Hi Lars

 

Iam sorry. I have no idea what you just said. :o

 

"qoute sign" ?

 

What am I missing?


Quote signs are the embrasing sings you used when you wrote "quote sign". Have you had a look at your source code? I copied and pasted your ID field from the HTML source to here:

 

<input type="hidden" name=ID" value="79" />

 

That's all the help you're gonna get for this one;)

 
Reply
Sorensen wrote:
rs@condurra.dk wrote:
Sorensen wrote:

No, this time it's the ID field that's causing you problems... Or, should I say the missing ID field, as theres no ID field present in the template. There is, however, a field name ID" (I-D-QUOTE). I assume you forgot to enter a qoute sign on the left of the name attribute value. But browsers aren't that forgiving, and they will send this information as ID".


Hi Lars

 

Iam sorry. I have no idea what you just said. :o

 

"qoute sign" ?

 

What am I missing?


Quote signs are the embrasing sings you used when you wrote "quote sign". Have you had a look at your source code? I copied and pasted your ID field from the HTML source to here:

 

<input type="hidden" name=ID" value="79" />

 

That's all the help you're gonna get for this one;)

Hmm
 

It was you who told me to make a hidden id box with the same value as the productpage id.

 

Well iam missing a " on the name=ID" :) And that made a difference, but iam not quit there.

 

Can I get one more tips :(-)

 

 

 
Reply

Sure, go ahead.

 
Reply
Sorensen wrote:

Sure, go ahead.


I asked you if I could get one more tip from you, so that I can get this thing working :)

 

So please, go ahead.

 

 

 
Reply
rs@condurra.dk wrote:
Sorensen wrote:

Sure, go ahead.


I asked you if I could get one more tip from you, so that I can get this thing working :)

 

So please, go ahead.

 

 


I dont know why but adding "1" in front of cartcmd name solved the problem.

 

<input type="hidden" name="1cartcmd" value="add" />

 

Can someone tell me why?

 

 
Reply

Because, before that you had two cartcmd in your form...

 
Reply
Sorensen wrote:

Because, before that you had two cartcmd in your form...


Hmm. Not on the same page. -

 

 

 
Reply

Yir, it was present two times in the querystring, when the form was submitted. This mean that the value would be interpreted as cartcmd=add,add, when it reaches the server.

 
Reply
Sorensen wrote:

Yir, it was present two times in the querystring, when the form was submitted. This mean that the value would be interpreted as cartcmd=add,add, when it reaches the server.


Okay. That makes okay sense :)

 

But now what happens when I have change the name to "cartcmd1"

 

It seems that the quantity of the product works when I press "Køb" but the price isnt tagging along.

 

 

http://kontinuum.net.dynamicweb.dk/Default.aspx?ID=79&ProductID=PROD10

 
Reply

Well, the you only have one cartcmd, which is what ecom looks for. Please note that this is not ecom or dw specific information. This is how browsers and servers interact.

 
Reply
Sorensen wrote:

Well, the you only have one cartcmd, which is what ecom looks for. Please note that this is not ecom or dw specific information. This is how browsers and servers interact.


So you are telling me that what Iam trying to do isnt possible?

 

Iam clearly out of my league here when it comes down to this.

 

It sounds like you know the exact thing to do here. -

 

So is there any chance that you could be more specific in what I need to do to get this thing going.?

 

You must be logged in to post in the forum