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..
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.
/* 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(productid, quantity, { async: true, successfn: function (data) { //A timeout is set to show the user that the product has been added removeAddButtonUpdate(jQEle, localSubmitTimer); }, errorfn: function (data) { //Something went wrong. We should handle it here removeAddButtonUpdate(jQEle, localSubmitTimer); } });
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.
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.
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
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
Hi Anders
So I would have to change this:
to something like this:
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
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
is working on a reply...