I have two types of product in my store – one is wines and another is food/ grocery.
The shipping cost for wine is based table rates, while food/ grocery is based on a flat rate.
So when you order a food from my store, I don't want to show you the table rates.
And when you order a wine, I don't want to show you the flat rate as it is always at a lower rate.
But when you order a wine and a food, then you get the table rates.
So, how can I customize the Magento system to do this? Can this be configured in Magento?
When I create a new product, I choose Simple Product as Product Type
for Wines. What about food then?
Best Answer
From what I understand your problem reduces to "If there is a wine type product in the cart, don't show the flat rate and when you order only food type products don't show table rate."
Each shipping method model has a method called
proccessAdditionalValidation
. You need to rewrite the modelsMage_Shipping_Model_Carrier_Flatrate
andMage_Shipping_Model_Carrier_Tablerate
and implement this method. The method receives as parameter an object of typeMage_Shipping_Model_Rate_Request
from which you can access all products.so your method can look something like this: