I'm currently having some problems adding different variants of the same product to the cart. After adding one variant to the cart all subsequent variants of the same product added to the cart only increases the quantity of the existing order line, even if it is a different variant from the first one. So for each product I'm only able to have one variant in the cart at the same time. I have confirmed that the correct product identifier is posted to the FormPost.aspx each time, and the first variant added is correctly handled. The system does not however create new order lines when different variants are added later on. Regardless of whether I'm using the javascript API or a simple form to post the values, I get the same results.
Any suggestions on why this is happening? I'm using TeaCommerce 2.0
Note that in the Tea Commerce starter kit all variants have their own nodes. If that is not the case for you, your scenario is different, and you need a different approach.
Well, as I mentioned before I have checked that the correct productIdentifier is present in each post to the server, and as far as I can see the correct value is posted for each variant. I have also tried to debug using the javascript API in the console, supplying different product identifiers to the addOrUpdateOrderLine method. But the problem still remains, I'm not able to add different variants of the same product.
I'm using the same setup as in the Starter Kit, all variants have their own nodes. The only difference from the Starter Kit is that I added an extra level in the node tree to accomodate for both colors and sizes. But that shouldn't really matter as each color/size combination has their own node and productId.
I think I know what is going on now (After looking at your page!)
The problem is the SKU of the products. In Tea Commerce 2 we have startet taking the SKU very seriously. This means that two different nodes can be the exact same product by having the same SKU. In your case the variants does NOT have unique SKU's. You have two options:
1. Set a unique SKU on every variant 2. Don't set the SKU at all. Tea Commerce will then default to the node id, using that as the products SKU.
Adding different variants of the same product
I'm currently having some problems adding different variants of the same product to the cart. After adding one variant to the cart all subsequent variants of the same product added to the cart only increases the quantity of the existing order line, even if it is a different variant from the first one. So for each product I'm only able to have one variant in the cart at the same time. I have confirmed that the correct product identifier is posted to the FormPost.aspx each time, and the first variant added is correctly handled. The system does not however create new order lines when different variants are added later on. Regardless of whether I'm using the javascript API or a simple form to post the values, I get the same results.
Any suggestions on why this is happening? I'm using TeaCommerce 2.0
Hi Øystein,
My guess is that you are sending the same productIdentifier to the server every time. In our starter kit we use the select box to make the user chose one of the variant, and thereby also the productIdentifier of the variant.
http://starterkit.teacommerce.net/shop/champagne/verrier-et-fils-brut-ros%C3%A9/
Note that in the Tea Commerce starter kit all variants have their own nodes. If that is not the case for you, your scenario is different, and you need a different approach.
/Rune
Hi Rune, thanks for the quick reply.
Well, as I mentioned before I have checked that the correct productIdentifier is present in each post to the server, and as far as I can see the correct value is posted for each variant. I have also tried to debug using the javascript API in the console, supplying different product identifiers to the addOrUpdateOrderLine method. But the problem still remains, I'm not able to add different variants of the same product.
I'm using the same setup as in the Starter Kit, all variants have their own nodes. The only difference from the Starter Kit is that I added an extra level in the node tree to accomodate for both colors and sizes. But that shouldn't really matter as each color/size combination has their own node and productId.
Yes you did write that. But it doesn't add up with the problem :)
When I do two add to cart with two variants my posts looks like this:
First call:
productIdentifier : productIdentifier , quantity : quantity
true
1264
1
1
Second call
productIdentifier : productIdentifier , quantity : quantity
true
1265
1
1
Now show me yours :)
/Rune
I know it doesn't make sense :P
First call(color:red, size:small):
Actually that should work perfectly.
The second call is aparently not made by the javascript and therefore does not have the isJavaScript parameter.
Do you have a link where I can see the problem?
If it's secret you can mail it to me on rg [at] teasolutions.dk
/Rune
I think I know what is going on now (After looking at your page!)
The problem is the SKU of the products. In Tea Commerce 2 we have startet taking the SKU very seriously. This means that two different nodes can be the exact same product by having the same SKU. In your case the variants does NOT have unique SKU's. You have two options:
1. Set a unique SKU on every variant
2. Don't set the SKU at all. Tea Commerce will then default to the node id, using that as the products SKU.
/Rune
Well, that explains a lot :) Works like a charm now.
Greatly appreciate your help, you just saved from a lot of hours debugging
Cool. Looks great your site by the way. Looking forward to seeing it live!
/Rune
is working on a reply...