2

I'm trying to make a WebService, getting in argument shoppingCartId and storeId, to return all shipping method available. I'm also using the Owebia shipping extension.

But my problem is here, I have able 5 shipping methos (flatrate, free, owebia 1/2/3), but I only get the flat and free when I use cart_shipping.list like it : $resultShippingMethods=$proxy>call($sessionId,"cart_shipping.list",array($shoppingCartId));

So my question is, how can I get magento's default shipping method and also Owebia methods ?

1 Answer 1

1

You are using cart_shipping.list it Allows you to retrieve the list of available shipping methods for a shopping cart (quote).

your Requirement is that you have to fetch all active shipping method available in that store.

Then you One Solution I have found that

Step 1: you can create your custom API to fetch the All active shipping method.

Step 2: To create a new API you can follow the steps which are giving my Magento it self link

Step 3: In your API method getActiveShippingMethods() type below code.

public function getActiveShippingMethods()
{
    $methods = array(array('value'=>'','label'=>Mage::helper('adminhtml')->__('--Please Select--')));

    $activeCarriers = Mage::getSingleton('shipping/config')->getActiveCarriers();
    foreach($activeCarriers as $carrierCode => $carrierModel)
    {
       $options = array();
       if( $carrierMethods = $carrierModel->getAllowedMethods() )
       {
           foreach ($carrierMethods as $methodCode => $method)
           {
                $code= $carrierCode.'_'.$methodCode;
                $options[]=array('value'=>$code,'label'=>$method);

           }
           $carrierTitle = Mage::getStoreConfig('carriers/'.$carrierCode.'/title');

       }
        $methods[]=array('value'=>$options,'label'=>$carrierTitle);
    }
    return $methods;
}

Step 4 : Refresh the cache and test the API.

2
  • Thank's, little complicated but usefull =)
    – Malerick
    Commented Oct 16, 2014 at 12:04
  • yes some thing is completed but helpful
    – Keyul Shah
    Commented Oct 16, 2014 at 12:17

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.