How to customize this function order.getShippingDescription(), where is this function is written in Magento.
Can someone please help in it
emailtemplatetransactional
How to customize this function order.getShippingDescription(), where is this function is written in Magento.
Can someone please help in it
Best Answer
When calling
{{var order.getShippingDescription()}}
magento will actually call$order->getShippingDescription()
where$order
is the current order object...the one you are sending the e-mail for.But that method does not exist. It is called through the magic of
__call
. it basically returns theshipping_description
field from thesales_flat_order
table.If you want to customize it, you can rewrite the
Mage_Sales_Model_Order
and implement the methodgetShippingDescription
where you process the data from$this->getData('shipping_description')
.But I advice against it, because that method is used in many places. You might change something you don't want changed.
Instead you care rewrite the class mentioned above and create your own method
getEmailShippingDescription
where you put your code, and change the e-mail template to include{{var order.getEmailShippingDescription()}}
.An other approach would be to create your own short code. Something like this:
Here is an explanation on how to do that.
and in your short code directive do this:
(Learned this custom short code approach from Vinai Kopp's book Grokking Magento - ha Vinai, you said I will learn nothing new from your book).