I\'m writing a quick-and-dirty module to restrict shipping methods based on products in the cart. For example, if the customer adds food, I only want overnight shipping met
I've created a function for this out of the answers already provided. This creates an option group of all the shipping methods:
function getShippingMethods($_methods, $fieldId, $fieldName, $fieldClass){
$_shippingHtml = '';
return $_shippingHtml;
}
The $_methods
argument is an object from Magento:
$_methods = Mage::getSingleton('shipping/config')->getActiveCarriers();
So, we can call the function and pass the $_methods
object to it as follows:
Hope that helps someone else.