Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Øystein Heimark 5 posts 35 karma points
    Apr 30, 2013 @ 13:24
    Øystein Heimark
    0

    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

  • Rune Grønkjær 1372 posts 3103 karma points
    Apr 30, 2013 @ 13:33
    Rune Grønkjær
    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

  • Øystein Heimark 5 posts 35 karma points
    Apr 30, 2013 @ 13:59
    Øystein Heimark
    0

    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.

  • Rune Grønkjær 1372 posts 3103 karma points
    Apr 30, 2013 @ 14:09
    Rune Grønkjær
    0

    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:

    AddOrUpdateOrderLine productIdentifier : productIdentifier , quantity : quantity
    isJavaScript true
    productIdentifier 1264
    quantity 1
    storeId 1

     

    Second call

    AddOrUpdateOrderLine productIdentifier : productIdentifier , quantity : quantity
    isJavaScript true
    productIdentifier 1265
    quantity 1
    storeId 1

     

    Now show me yours :)

    /Rune

     

  • Øystein Heimark 5 posts 35 karma points
    Apr 30, 2013 @ 14:23
    Øystein Heimark
    0

    I know it doesn't make sense :P

    First call(color:red, size:small): 

     

    1. storeId:
      1
    2. AddOrUpdateOrderLine:
      productIdentifier : productIdentifier, quantity : quantity
    3. productIdentifier:
      1188
    4. quantity:
      1
    5. isJavaScript:
      true
    Second call(color:red, size:medium):
    1. storeId:
      1
    2. AddOrUpdateOrderLine:
      productIdentifier : productIdentifier, quantity : quantity
    3. productIdentifier:
      1189
    4. quantity:
      1
    This will result in 2 copies of(color:red, size:small) added to the cart
    I notice that the isJavaScript is missing from the second one(I don't know why). Could this cause some problems?

     

  • Rune Grønkjær 1372 posts 3103 karma points
    Apr 30, 2013 @ 14:27
    Rune Grønkjær
    0

    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

  • Rune Grønkjær 1372 posts 3103 karma points
    Apr 30, 2013 @ 14:44
    Rune Grønkjær
    100

    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

  • Øystein Heimark 5 posts 35 karma points
    Apr 30, 2013 @ 14:57
    Øystein Heimark
    0

    Well, that explains a lot :) Works like a charm now.

    Greatly appreciate your help, you just saved from a lot of hours debugging

     

  • Rune Grønkjær 1372 posts 3103 karma points
    Apr 30, 2013 @ 15:13
    Rune Grønkjær
    0

    Cool. Looks great your site by the way. Looking forward to seeing it live!

    /Rune

Please Sign in or register to post replies

Write your reply to:

Draft