OroCommerce Forums

Covering OroCommerce topics, including community updates and company announcements.

Forums Forums OroCommerce Add validation to shopping list/order line item quantity field, on frontend

This topic contains 0 replies, has 1 voice, and was last updated by  nevoeiro 6 years, 2 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #32790

    nevoeiro
    Participant

    Hi there,

    I’m trying to implement a validator for the quantity field on these entities:
    – Oro\Bundle\OrderBundle\Entity\OrderLineItem
    – Oro\Bundle\ShoppingListBundle\Entity\LineItem
    – Oro\Bundle\CheckoutBundle\Entity\CheckoutLineItem

    I added a new Contraint and Validator to check the quantity value considering some custom logic. The validator is working fine when I’m on backend side.

    For example, on backend, when I’m creating a new order, if I try to add a product with an invalid quantity I got my validator running and displaying the message I defined. Very nice!

    But, I was expecting to have this working on frontend side too. My goal is to apply this validation when I add a new product to a shopping list (or update), but it’s not working.

    Are there some config I need to add to have these available on frontend, or are these validators only working for backend?

    Can you explain how can I add a validator that can cover all contexts? I mean, backend and frontend side.

    my validation.yml:

    Thanks for helping ;)

The forum ‘OroCommerce’ is closed to new topics and replies.

Back to top