OroCommerce: Forms with extended oro entities

I need to implement some additional things to the ordering process - for every ordered item crm user should select one of customer "options" and that selection should be saved in order. So I've created new entity that has ManyToOne relation with Customer, implemented CRUD for it and all works ok, succesfully created number of items with different Customer.

Than I extended Oro ShoppingList LineItem - created migration with addManyToOneRelation to my enitity and new dropdown magically appeared allowing to select entity using autocomplete box. All works ok except I need to see there only items that related to the customer instead of all created entities. Its pretty easy to get customer (LineItem->customerUser->customer) but how to spesify it for the query used for dropdown? For the moment everything was created by oro (which is really cool), I've only made a migration adding relation, I didnt written any code where can specify customer parameter.

Also it would be perfect to implement some logic verifing that the option selected for product in LineItem is related to the customer and throw exception if for some reason its wrong. But where I can implement that?

Here is pic with form. Also wonder why new fields are misaligned?



Read more here: https://stackoverflow.com/questions/66323606/orocommerce-forms-with-extended-oro-entities

Content Attribution

This content was originally published by Vladimir at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: