Magento 1.9 – Add Custom Data to Order Email Content

emailmagento-1.9orders

I want to add custom data in order confirmation email. I have vehicle information that are attached to the order email to show to customer their vehicle make, model, year. These values are attached with order_id.

Best Answer

First copy app\code\core\Mage\Sales\Model\Order.php to app\code\local\Mage\Sales\Model\Order.php

Now you have to create function for your requirement. If your order data return value for vehicle model as $order['vehicle_model'] then you have to declare function in Order.php file of local.

public function getVehicleModel(){
    return $this->getVehicleModel();
}

You have to set value in System -> Transactional email -> New order template.

You have to set below statement in your email template.
{{var order.getVehicleModel()}}

Now email template will display vehicle model value.

Same as above you have to generate function for Vehicle year, Vehicle make and call in email template file in admin.