I created custom shipping methods using following link


Now I want enable /disable option(multiselect) at system->configuration->shipping methods->custom carrier

(For example ups carrier->allowed methods multiselect field in system configuration->shipping methods).

In order to get I'm using following code in system.xml

<allowed_methods translate="label">
    <label>Allowed Methods</label>

and I created Methods.php in proper place.

class SmashingMagazine_MyCarrier_Model_Source_Methods
    public function toOptionArray()

        $arr = array();
//how to get created custom shipping methods here?

        return $arr;

This post on Stackoverflow is exactly what you are looking for.

Copied from the answer:

public function toOptionArray($isMultiSelect = false)
    $methods = Mage::getSingleton('shipping/config')->getActiveCarriers();

    $options = array();

    foreach($methods as $_code => $_method)
        if(!$_title = Mage::getStoreConfig("carriers/$_code/title"))
            $_title = $_code;

        $options[] = array('value' => $_code, 'label' => $_title . " ($_code)");

        array_unshift($options, array('value'=>'', 'label'=> Mage::helper('adminhtml')->__('--Please Select--')));

    return $options;
| improve this answer | |

In case you would like to disable (or enable) multishipping for your custom shipping method, you can use this code in your Model/Carrier.php

public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
    if (Mage::app()->getRequest()->getControllerName() === 'multishipping') {
        return false;
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.