We need to update the email template variables in transaction emails in Magento, I don't know which model is responsible for this. Can you please help us to know this file?

1 Answer 1


This depends on the email that you want to send and the variable that you need, for exemple for the sales order email the function responsible is sendNewOrderEmail()located in : app/code/core/Mage/Sales/Model/Order.php and if you want to add some params in your case variable, you should rewrite this file in local (it's forbidden to update the core Magento files) I think you already know.

Solution 1: (Model)

So i'll give an exemple to well understand how to add your custom variable.

For the new order email template:

After rewritting the function in your locale codePool, you can add you new variable like this:

public function sendNewOrderEmail()
  . there is some Magento code here*/

    // it's here where you have to add a variable
    $myValue = Mage::getModel('customer/customer')->load($this->getMyValue()); // for exemple
      'order'         => $this,
      'billing'       => $this->getBillingAddress(),
      'payment_html'  => $paymentBlockHtml,
      'new_variable'  => $myValue // your new param here (variable)
   /*Rest of the code remains the same*/

Now you can get your variable in the this template email like this: {{var new_variable}}

Solution 2: (phtml)

You add your variable in some phtml that you get it in the email template like this:

{{block type='core/template' area='frontend' template='page/html/email/var1.phtml' order=$order}}

And you add your variable value in this phtml like this:

 $customer_id = 10;
 $myValue = Mage::getModel('customer/customer')->load($customer_id);
 echo $myValue->getMyValue() ; 
?> // for exemple
  • I need to separate the shipping & Billing Address Variables but I don't know which files to use or Module >> I will be grateful if you help me to do it @Prince Commented Dec 25, 2017 at 19:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.