Magento – Change shipping method names in email templates in magento

email-templatesmagento-1.7

I am using matrixrates for shipping methods for my store. For some methods I have the same name but different prices, like "Standard" for above $350 and "Standard" for below $350. So programmatically I have distinct these two by putting ":2" with the below rate. so it becomes "Standard:2" I have successfully modified the front and backend to display "Standard" for both rates but in email send to customer "Standard:2" is sending. So I goes to the code deeply. New order email template is in locale/template/emai/sales/new_order.html, and for shipping details this function is used.

{{var order.getShippingDescription()}}

I found this function in Core/Mage/Checkout/Block/Onepage/Progress.php. But by changing the return value, does not effect the shipping description in email. I am wondering where this function getShippingDescription() is so I can modify it.

Best Answer

Actually this is a string saved to object not actual value that you can depend on. Best bet would be to alter the shipping method code to use different label on different rate directly.

you can see where it is genreated and set in code

grep '>setShippingDescription' app/code -rsn
app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php:320:        $this->getQuote()->getShippingAddress()->setShippingDescription($order->getShippingDescription());
app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Callback.php:696:                ->setShippingDescription($shipping['shipping-name']['VALUE']);
app/code/core/Mage/Sales/Model/Quote/Address/Total/Shipping.php:169:                    $address->setShippingDescription(trim($shippingDescription, ' -'));
app/code/core/Mage/Sales/Model/Quote/Address.php:824:                ->setShippingDescription('');
Related Topic