I have written some code that depending on the selected shipping method of an order, echos an estimated date on the magento order shipping email. I want to include this in the Magento order confirmation email, however the shipping method title (which I use within an if loop) doesn't exist yet at this stage.
By default, Magento gets the shipping details by calling the followig variable
{{var order.getShippingDescription()}}.
Is there a way to use this variable within a php file to write some code based on the value of this variable? How would I call the variable within php to do so?
I have tried getting the order shipping method by doing things such as
$this->getShippingAddress()->getShippingDescription();
However This just returns a Call to a member function on a non-object...
I am really lost so any help would be massively appreciated...
Frank
All shipping information are stored in the order object. So you can get them directly from the order model. Basically {{var order.getShippingDescription()}}
is equal to $order->getShippingDescription();
. So all you need to do is to load your order model and then use the code given above to get shipping description.
Have a look at this answer for a descriptive explanation: https://magento.stackexchange.com/a/30491/14528
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.