Copied to clipboard

Flag this post as spam?

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


  • Denford 132 posts 323 karma points
    Aug 28, 2020 @ 07:45
    Denford
    0

    OrderLine Prices added as 0.00

    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:

    1. I have a document type with my "variant" properties, productPrice, productCode and productImages

    enter image description here

    1. I added the variant doctype to the store.

    enter image description here

    1. 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)

    2. On a normal product with no vairants, i add the product to cart the product gets added, but the price is 0.00

      enter image description here

      1. When i do try and save a variant on a page i get an exception, see image below not sure what is causing it as well.

    enter image description here

    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.

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Aug 28, 2020 @ 08:27
    Matt Brailsford
    0

    Hey Denford,

    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)

    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.

    Matt

  • Denford 132 posts 323 karma points
    Aug 28, 2020 @ 12:33
    Denford
    0

    Thanks @Matt i will give that a go over the weekend and let you know how i get on.

  • Denford 132 posts 323 karma points
    Aug 29, 2020 @ 13:49
    Denford
    0

    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:

    enter image description here

    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.

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Aug 31, 2020 @ 08:49
    Matt Brailsford
    0

    Hi Denford,

    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?

    Matt

  • Denford 132 posts 323 karma points
    Sep 01, 2020 @ 08:46
    Denford
    0

    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.

    enter image description here

    enter image description here

    enter image description here

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Sep 01, 2020 @ 09:20
    Matt Brailsford
    100

    Hey Denford,

    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.

    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:

    - Store
        - Products
           - 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.

    Matt

  • Denford 132 posts 323 karma points
    Sep 01, 2020 @ 12:47
    Denford
    0

    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 .

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Sep 01, 2020 @ 12:56
    Matt Brailsford
    0

    Awesome!

    Glad we were able to get you there.

    Look forward to seeing how this works out.

    Matt

Please Sign in or register to post replies

Write your reply to:

Draft