Copied to clipboard

Flag this post as spam?

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


  • Tim 43 posts 197 karma points
    Jun 23, 2020 @ 10:53
    Tim
    0

    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?

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Jun 23, 2020 @ 10:58
    Matt Brailsford
    100

    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

  • Tim 43 posts 197 karma points
    Jun 23, 2020 @ 11:11
    Tim
    0

    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?

  • Tim 43 posts 197 karma points
    Jun 23, 2020 @ 14:02
    Tim
    1

    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! :)

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Jun 23, 2020 @ 14:10
    Matt Brailsford
    0

    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

Please Sign in or register to post replies

Write your reply to:

Draft