tinkesh
tinkesh

Reputation: 313

How to get the shipping method code by the rate_id in the Magento?

How can I get the shipping method code when I have its rate_id.

I have the table sales_flat_quote_shipping_rate in which the shipping method code, code title and all other are defined. I just want to get the code. my rate_id is like 2163.

Upvotes: 1

Views: 3208

Answers (1)

Haijerome
Haijerome

Reputation: 1550

Pretty simple. Use the code below :

/*Shipping Rate ID*/
$rate_id = 2163;

/*Load the Shipping Rate Model by its ID*/
$salesQuoteRate = Mage::getModel('sales/quote_address_rate')->load($rate_id);

if($salesQuoteRate){
   echo '<br/>CODE : '.$salesQuoteRate->getCode();
   echo '<br/>METHOD : '.$salesQuoteRate->getMethod();
}       

Upvotes: 3

Related Questions