3

As we have shipping method code for each shipping method.

I want to know how to find that shipping method code

3
  • 1
    Do you want the list of all shipping method codes ? Or do you want to get the shipping method of a particular object for instance an order ? Sep 28, 2015 at 7:14
  • i want to get the list of all shipping method codes including customized shipping methods..... Sep 28, 2015 at 7:16
  • @RaphaelatDigitalPianism, how would you get the shipping method of a particular object? Like for tracking if i wanted to include it in an email or even display on a page the particular code they chose on checkout.
    – Singleton
    Aug 18, 2017 at 0:41

3 Answers 3

2

As per as magento system,for a shipping method,it method code is define in it's Shipping method class.

In cofig.xml,magento define it model class.

Example: <model>shipping/carrier_tablerate</model>

On that model class,You can get method name from $_code variable

Example: for table rate method:

class Mage_Shipping_Model_Carrier_Tablerate
    extends Mage_Shipping_Model_Carrier_Abstract
    implements Mage_Shipping_Model_Carrier_Interface
{..

 protected $_code = 'tablerate'; // this method code:
..
1
  • 1
    mpperproductshipping
    – Amit Bera
    Sep 28, 2015 at 7:26
3

Here is a function to retrieve all the shipping method codes (based on this: https://stackoverflow.com/questions/9433627/programatically-retrieve-list-of-all-shipping-methods)

public function getAllShippingMethodsCode()
{
    $methods = Mage::getSingleton('shipping/config')->getActiveCarriers();

    $options = array();

    foreach($methods as $_ccode => $_carrier)
    {
        if($_methods = $_carrier->getAllowedMethods())
        {
            foreach($_methods as $_mcode => $_method)
            {
                $_code = $_ccode . '_' . $_mcode;
                $options[] = $_code;
            }
        }
    }

    return $options;
}
3
  • please put this as command or descibe somehing
    – Amit Bera
    Sep 28, 2015 at 7:20
  • we bought one extension. this is our config.xml pastebin.com/1D8baRJr can you please check the code and inform me the shipping method code ? Sep 28, 2015 at 7:23
  • 1
    Check this file: Webkul_Mpperproductshipping_Model_Carrier_LocalDelivery that's where the code should be declared. Or paste the code if you want. Sep 28, 2015 at 7:25
1

even u can use SOAP webservice calls to see the Shipping method codes like this

<?php
$proxy = new SoapClient('http://127.0.0.1/magento/index.php/api/v2_soap/?wsdl');

$sessionId = $proxy->login('cats', 'sudhir123');
echo "\nSession Id = ";
var_dump($sessionId);
$cartId = $proxy->shoppingCartCreate($sessionId, '3');
echo "\nCart Id = ";
var_dump($cartId);
$result = $proxy->shoppingCartShippingList($sessionId, $cartId);   
echo "\nAvailable Shipping methods = ";
var_dump($result);
?>
8
  • i will try @Sudhir Belagali Oct 26, 2015 at 10:40
  • we are doing android app for magento site, we are using catalog price rules to give discounts in site and we want to do the same in app. is there any android API , so that we can get the special price of the product in app Oct 27, 2015 at 5:30
  • 1
    provision for giving discounts are available in SOAP magento webservice Oct 27, 2015 at 5:33
  • 1
    s this is the link magentocommerce.com/api/soap/introduction.html and I am able to do most of the stuffs of magento website regarding Product details , customer details , adding to cart , shipping methods , and even discounts also Oct 27, 2015 at 5:35
  • 1
    I have used ksoap2 3rd party jar file for my android application and you can make use of my git hub link of my app github.com/sudhirbelagali/SnowDogSoapAndroid which uses magento soap api Oct 27, 2015 at 5:42

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.