I have a store where we have one product, which is a paint sample (which is free). The available colours come from a custom database table (managed using Fluidity).
Looking at the docs, it looks like you can add custom fields, on this page: https://docs.teacommerce.net/3.4.0/api/order-line/#addorupdateorderline in the second example there is an engraving field. I've added a hidden field called "colour-ref" to my AddOrUpdateOrderLine form that contains the value of the colour paint to order, so presumably that would add my paint colour to the order line?
However, if I add multiple colours to the cart, they all show up as one product, rather than as separate lines, one for each colour reference. Am I doing something wrong? Also, when the order is placed, it shows 4 of the product, with no breakdown of the extra order line information that was added.......
How do I achieve what I'm trying to do? Am I going about this the wrong way?
Adding your colour-ref to this config should force each distinct value to become it's own order line.
To display these details in your order summary, you'll have to update it to the read and render the value stored in the order lines properties collection, which is where these values gets stored.
Awesome, that's exactly what I'm looking for, it worked perfectly, thank you! Is there any way to get the custom fields to be displayed in the back office order details page next to the product name? It looks like the page is powered by a webforms page?
I think you should be able to duplicate it and rename it then configure the view in the store settings. This should just endure it shouldn't get overwritten on upgrade.
Custom Order Line Properties
Hi,
I have a store where we have one product, which is a paint sample (which is free). The available colours come from a custom database table (managed using Fluidity).
Looking at the docs, it looks like you can add custom fields, on this page: https://docs.teacommerce.net/3.4.0/api/order-line/#addorupdateorderline in the second example there is an engraving field. I've added a hidden field called "colour-ref" to my AddOrUpdateOrderLine form that contains the value of the colour paint to order, so presumably that would add my paint colour to the order line?
However, if I add multiple colours to the cart, they all show up as one product, rather than as separate lines, one for each colour reference. Am I doing something wrong? Also, when the order is placed, it shows 4 of the product, with no breakdown of the extra order line information that was added.......
How do I achieve what I'm trying to do? Am I going about this the wrong way?
Hey Tim,
You'll need to take a look at the Product Uniquness Properties feature as this is what tells TC to treat order lines as "distinct" https://docs.teacommerce.net/3.4.0/api/order-line/#product-uniqueness-properties
Adding your
colour-ref
to this config should force each distinct value to become it's own order line.To display these details in your order summary, you'll have to update it to the read and render the value stored in the order lines properties collection, which is where these values gets stored.
Hope this helps
/Matt
Awesome, that's exactly what I'm looking for, it worked perfectly, thank you! Is there any way to get the custom fields to be displayed in the back office order details page next to the product name? It looks like the page is powered by a webforms page?
Found it! There's a cshtml macro in the MacroScripts folder that I can edit to make it include any custom properties in the order items list! :)
That's it!
I think you should be able to duplicate it and rename it then configure the view in the store settings. This should just endure it shouldn't get overwritten on upgrade.
/Matt
is working on a reply...