0

Can anyone help me how to fetch the all shipping methods available in system->config->shipping Methods programatically.

I have used the below code: $methods = Mage::getSingleton('shipping/config')->getActiveCarriers();

Get the result like below:

but iam unable to find what are methods names:

Result:

[freeshipping] => Mage_Shipping_Model_Carrier_Freeshipping Object
    (
        [_code:protected] => freeshipping
        [_isFixed:protected] => 1
        [_rates:protected] => 
        [_numBoxes:protected] => 1
        [_freeMethod:protected] => free_method
        [_customizableContainerTypes:protected] => Array
            (
            )

        [_debugReplacePrivateDataKeys:protected] => Array
            (
            )

        [_data:protected] => Array
            (
                [id] => freeshipping
                [store] => 
            )

        [_hasDataChanges:protected] => 1
        [_origData:protected] => 
        [_idFieldName:protected] => 
        [_isDeleted:protected] => 
        [_oldFieldsMap:protected] => Array
            (
            )

        [_syncFieldsMap:protected] => Array
            (
            )

    )

[tablerate] => Mage_Shipping_Model_Carrier_Tablerate Object
    (
        [_code:protected] => tablerate
        [_isFixed:protected] => 1
        [_default_condition_name:protected] => package_weight
        [_conditionNames:protected] => Array
            (
                [0] => package_weight
                [1] => package_value
                [2] => package_qty
            )

        [_rates:protected] => 
        [_numBoxes:protected] => 1
        [_freeMethod:protected] => free_method
        [_customizableContainerTypes:protected] => Array
            (
            )

        [_debugReplacePrivateDataKeys:protected] => Array
            (
            )

        [_data:protected] => Array
            (
                [id] => tablerate
                [store] => 
            )

        [_hasDataChanges:protected] => 1
        [_origData:protected] => 
        [_idFieldName:protected] => 
        [_isDeleted:protected] => 
        [_oldFieldsMap:protected] => Array
            (
            )

        [_syncFieldsMap:protected] => Array
            (
            )

    )

Thanks

1 Answer 1

1

you can get all active shipping methods titles like this :

$methods = Mage::getSingleton('shipping/config')->getActiveCarriers();
foreach ($methods as $shippingMethodCode => $shippingMethod) 
{
  $shippingTitle = Mage::getStoreConfig('carriers/'.$shippingMethodCode.'/title');
}
10
  • Thanks for reply, In the above code getActiveCarriers means Commented Aug 13, 2018 at 13:29
  • Hi @sami please find the updated question Commented Aug 13, 2018 at 13:37
  • @shivashankarm I updated my answer
    – sami23
    Commented Aug 13, 2018 at 13:41
  • @shivashankarm tell me if it works ;)
    – sami23
    Commented Aug 13, 2018 at 14:00
  • iam getting titles like this: Commented Aug 13, 2018 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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