How to calculate a total cost from the collection?
Hello, I have a collection of products with data about the unit price and quantity for each product. I have created an attribute Total cost in the data model in which I want to store the data obtained by calculating the sum of all the product unit prices multiplied with their quantity. Can anyone tell me how can I do that? Do I need to create another attribute that will hold the information about the cost of each product separately and then sum all those values in the Total cost attribute?