Magento Certified Developer GuideCategory: 8. CheckoutDescribe the programmatic structure of shipping methods, how to customize existing methods, and how to implement new methods
Manish Prakash Staff asked 5 years ago

Structure Of Shipping Methods

Shipping methods are defined in config.xml file as below

                <title>Flat Rate</title>
                <specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>

Here we specify the shopping method code and model.
Next we need to define the system.xml configuration parameters, so the shipping method shows up in system configuration.

Next important thing is to define the model

class Mage_Shipping_Model_Carrier_Flatrate
    extends Mage_Shipping_Model_Carrier_Abstract
    implements Mage_Shipping_Model_Carrier_Interface

    protected $_code = 'flatrate';

    public function collectRates(Mage_Shipping_Model_Rate_Request $request)
        if (!$this->getConfigFlag('active')) {
            return false;
        return parent::collectRates($request);
   public function getAllowedMethods()
        return array('flatrate'=>$this->getConfigData('name'));