Copied to clipboard

Flag this post as spam?

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


  • Bjarne Fyrstenborg 1281 posts 3992 karma points MVP 8x c-trib
    Jan 06, 2012 @ 15:56
    Bjarne Fyrstenborg
    0

    Reuse variant group

    Hi..

    I had tried to see if I could keep variant group under one node.. og the pick the variants with a multi-node tree picker..

    I created a doc type for a variant group and a doc type for variants.

    I was also able to prevent the data im a dropdown on product page, but I'm not sure what to send to the cart as I think it's the variant node that is send to cart in the standard shop.

    If I use the picked nodes id, it's S, M and L nodes which is sent to cart and doesn't have the all the properties for the product.

    And I don't think I can use the product node id as there wouldn't be difference in products in the cart.

    or perhaps it's possible to use a package as Embedded Content datatype to add the properties for the variants: variant name, perhaps diffent price, image and description.. 

    Bjarne

  • Anders Burla 2560 posts 8256 karma points
    Jan 06, 2012 @ 16:20
    Anders Burla
    0

    Hi Bjarne

    You a right that if you have the sizes in the dropdown in the starterkit the starter kit javascript will add the size node to the cart - so you would have to change that. You would then need to use the addUniqueOrderLine method to be able to have both a "Shoe" size S and L as this is the same product but you need it to display as unique orderlines.

    Maybe the embedded content datatype can help you get to your goal - but i havent used that before so dont have any experience with it and its possibilities.

    Kind regards
    Anders

  • Bjarne Fyrstenborg 1281 posts 3992 karma points MVP 8x c-trib
    Jan 06, 2012 @ 17:26
    Bjarne Fyrstenborg
    0

    Hi Anders

    So I would have to change this:

    /*
        Add orderline is called using the Tea Commerce javascript API
        We subscribe to the return events to be able to update the
        css class of the button.
        */
        TeaCommerce.addOrderLine(productidquantity,
        {
          asynctrue,
          successfnfunction (data{
            //A timeout is set to show the user that the product has been added
            removeAddButtonUpdate(jQElelocalSubmitTimer);
          },
          errorfnfunction (data{
            //Something went wrong. We should handle it here
            removeAddButtonUpdate(jQElelocalSubmitTimer);
          }
        });

    to something like this:

    TeaCommerce.addUniqueOrderLine(nodeId, orderLineId, quantity, settings);

    where I perhaps can use productId as nodeId.. and the orderLineId would be the variant nodeId?

    I think the Embedded Content datatype works pretty much like the MultiType datatype where it's possibly the add items with properties instead on using nodes..
    I can't add the variant properties the S, M, L nodes if they would be shared between the products.. so there I think these datatype could be used.

    Bjarne

  • Rune Grønkjær 1372 posts 3103 karma points
    Jan 07, 2012 @ 10:00
    Rune Grønkjær
    0

    Hi Bjarne,

    The addUniqueOrderLine is explained here:
    http://rune.gronkjaer.dk/en-US/2010/11/16/tea-commerce-javascript-api/#addUniqueOrderLine 

    It does not work like you are talking about. If you want to add variant information to your orderline you add it as an order line property. Something like this:

    TeaCommerce.addOrderLine([product id], 1, {properties:{variantId: [id of variant]}});

    Now your product is added to the cart with information about the chosen variant.

    /Rune

Please Sign in or register to post replies

Write your reply to:

Draft