Copied to clipboard

Flag this post as spam?

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


  • Tomasz Kowalski 135 posts 445 karma points
    Mar 09, 2022 @ 12:25
    Tomasz Kowalski
    0

    Product price alias

    Hi,

    I'm currently working on our second Vendr solution. And also this time it isn't a standard webshop :)

    Products has 3 prices (per day, week and month) and I will calculate the order line price from rent periode - that's not a problem (yet).

    But I can see, that when none of the price properties in the document type definition is called "price" I can't add a product to the cart. I get an exception with a message "ValidationException: Can't add a Product to an Order where there is no price for the Order currency."

    I can do that, if I change property name of one of the prices to "price".

    I think I have seen a setting to the price property alias, but I can't find it.

    Or I need to use "price" as price alias?

    Umbraco 9, Vendr 2.1

    Kind regards

    Tomasz

    PS. Maybe I'm getting this exception now, because I haven't coded the OrderLineCalculator yet...

    EDIT: OK. I found it in documentation. It has to be "price":

    https://vendr.net/docs/core/1.6.0/key-concepts/umbraco-properties/

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Mar 09, 2022 @ 14:02
    Matt Brailsford
    0

    Hey Tomasz

    I can't quite recall all the places the "price" property is accessed, but you could try removing that specific validation rule and just see what happens.

    You can remove that validation rule in your composer / startup code (making sure this runs after our startup code)

    builder.WithValidationEvent<ValidateOrderProductAdd>()
        .RemoveHandler<ValidateProductAddHasPrice>();
    

    This should prevent that validator from running and thus the validation exception.

    We'll just have to see if there are any additional errors after this one 😁

  • Tomasz Kowalski 135 posts 445 karma points
    Mar 09, 2022 @ 14:43
    Tomasz Kowalski
    1

    Hi Matt,

    That did the trick.

    Thanx :)

Please Sign in or register to post replies

Write your reply to:

Draft