It seems like you already found a solution. What is your question? is something not working as expected?
Hello, Ishwari
Maybe you forget that to create an association of those entities you have to store data temp. then it necessary for association
I attached the following more information doc so see helpful you
https://docs.mendix.com/refguide/associations#:~:text=You%20can%20create%20an%20association,the%20target%20of%20the%20association.
Hi Ishwari,
Seeing your comment on Andreas, it seems you are struggling how to store the order after the customer purchased the item and the cart is empty again. I recommend you to create an entity called ‘Orderline’ with an association to Order. I recommend this object contains at least the following attributes: Quantity, ProductCode, Price. Additionally, but not necessarily, ‘ProductName’ and/or ‘DiscountApplied’.
You really want to separate the products you have for sale and orders that have been made. This would basically mean that you’ll have two entities of ‘Product’, one for those you are selling and those that are associated to orders. The reason for this is history. If you’d change the price or productcode and your order has an association to a single object of Product, the order will change and not reflect the actual purchase that has been made.
In addition, I also recommend to separate items that are in cart and are associated to an order. Basically, copy the items from ‘In cart’ to ‘Ordered’ and empty the objects that are ‘in cart’, i.e. VendingMachineProduct.
This way you have ‘Product for sale’, Product in cart’ and ‘product ordered’. Whereas ProductInCart could in fact be a non-persistent object (unless you want to keep the cart contents after closing the browser session).
You might want to check for some examples regarding Orderlines.
Good luck!