I have a task to create an individual calculation for the shipping costs per product. What I need to do is calculate shipping costs for manufacturers individualy.
Example: I have a SUPPLIER1 whose shipping cost is 5$, and SUPPLIER2 whose shipping cost is 10$.
What I need to do is calculate the shipping costs as a sum of the manufacturers shipping costs, no matter the quantity of products. So if SUPPLIER1 has 10 products in the cart, and SUPPLIER2 has 2 products in the cart, the shipping costs will still be total 15$. Of course, there are a lot more manufacturers but I need a query for this simple example. I’ve managed to create a query that calculates the shipping costs for every product individualy, but that doesn’t work for me because they get summed up.
Here is my current query:
SUM(IF(a.supplierID=1 or a.supplierID=4 ,5 ,IF(a.supplierID=2, 10, 20)))