Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
So started setting up my products and a bit not sure how prices are passed into AddOrUpdateOrderLine, so my current setup i am trying to use is as follows:
On the product page i set this via the Compositions to provide the basic price details for all products (some will have variants some wont)
On a normal product with no vairants, i add the product to cart the product gets added, but the price is 0.00
So guess my questions are:
1) how does my product price gets pulled into the orderline, following the example on using add order line you there is no where i can see the price passed in, so am guessing it gets it from the product page.
2) Any idea why i can save variants on the product page and getting that string error, cant work out the cause from the stack trace.
I think the bit your missing is that your price property alias needs to be named explicitly to whatever your currency has it's Property Alias field set to.
For example, if you have USD currency configured for your store, and on that currency, you have it's Property Alias set to priceUSD then on your product / variant, your price property needs to have the alias priceUSD rather than productPrice which you currently have,
I think I'd also look to name your productCode field sku as this is a special field TC knows about and knows to be the unique code of your product.
On your Product tab for the store (assuming you use sku instead of productCode) the only field you should need to fill in is the Product variant property alias. The Product property aliases isn't quite used correctly in your screenshot as this isn't saying "this doc type is a product", instead this field means "any property aliases I enter into here, automatically copy them to the order line that gets created". This is mean as a convenience thing so you can pass data along to the order line saving a lookup later on. The Product uniqueness property aliases field is a series of property aliases that TC should use to determine if the product is a unique product and so should create a separate order line (for example, you might have a T-Shirt product available in different colours, so you might have a colour property alias you want to use to make the order lines unique so you end up with an order line for a blue t-shirt and one for a green t-shirt, rather than just 1 orderline for t-shirt and a quantity of 2)
Product variant property alias
Product property aliases
Product uniqueness property aliases
Regarding the later exception, I believe this was a bug in Umbraco not having the correct DB column size. Checkout this forum post which contains info on how to resolve it https://our.umbraco.com/packages/website-utilities/tea-commerce/tea-commerce-support/98790-error-on-saving-product-variant
Hope this info helps, but give these a try and see how you get on.
Thanks @Matt i will give that a go over the weekend and let you know how i get on.
Managed to fix that DB size error and now i can save the variants but cant seem to pull these back in code, see my variants setup below:
No when i try and retrieve these in code using this line below i cant seem to be able to get them, always have 0 in the list:
List<VariantPublishedContent> variants = TC.GetVariants(storeId, currentPageContent, true).ToList();
Other than that sorted the default price, its now showing, set my price alias to priceAUD, both on the property and on the currency and changed the product code to sku.
Just to confirm, is your variants property editor on your product node called productVariant as per the value set in the store settings for Product variant property alias?
Hi @Matt I had before, even updated it to just "variant" to match the doc type in the demo store and still same result see images below.
What i was planning to use them for, some of the clients products are bulk sold in tonnes. so e.g. 1 unit will be 0.5 tonne, 2 = 1 tonne up to 10 tonnes not sure if variants are going to be best or can i use a predefined drop-down list with values for quantity e.g. 05, 1, 1.5 , 2 etc and extend the price calculator logic to work the price, what would you recommend.
The thing that needs to match the stores Product Variant Property Alias is the alias of the property on your product node that is using the TC variants property editor. My guess is this still isn't matching.
Product Variant Property Alias
You could use the variants property editor for this for sure. If you only ever have one variant combination though (ie, just tonnes, and not multi variants like size + colour + fit type stuff) you could use child nodes for the variants instead. So you could have:
- Product 1
- 0.5 Tonne
- 1 Tonne
- 10 Tonne
In this scenario, the child nodes are the products, but you can pull shared info from the parent product node.
I think if you check your property alias on the product node that should be the issue you are having.
And then the penny drops :), that was exactly the missing piece, i updated the store to have the property alias of the variant on my product page and that worked.
Will let you know how i get on setting the sizes, they are all just going to be tonnes and nothing multi dimensional .
Glad we were able to get you there.
Look forward to seeing how this works out.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted