Answer the question
In order to leave comments, you need to log in
How to modify correctly: calculate and add to the data received from the model?
It is necessary to display goods at a discount. Data for products and given discounts is stored in different tables: 'products' and 'discounts' are many-to-many related.
When displaying a list of goods and a detailed page of goods, it is necessary to obtain modified data of goods already calculated based on the parameter of the base price of the goods and the discount - data located in different tables:
• discount percentage, old and new price, benefit - the difference between the old and new prices etc.
• that discounted products received from the model already contain the specified data in the form of a collection or array.
I don't think this should be done in a controller. What is the best approach to take? Where to look?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question