After a little search, I found the correct file to make the changes. Since I already had "companyname" as one of my attributes, I got the value of this field and passed it as a parameter in the following function
Application / code / core /Mage/Sales/model/Order.php
public function sendNewOrderEmail() { if ($this->getCustomerIsGuest()) { $templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_GUEST_TEMPLATE, $storeId); $customerId = Mage::getModel('customer/customer')->load($this->getCustomerId()); $companyname = $customerId->getCompanyname(); $customerName = $this->getBillingAddress()->getName(); } else { $templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE, $storeId); $customerId = Mage::getModel('customer/customer')->load($this->getCustomerId()); $companyname = $customerId->getCompanyname(); $customerName = $this->getCustomerName(); } $mailer->setTemplateParams(array( 'order' => $this, 'billing' => $this->getBillingAddress(), 'payment_html' => $paymentBlockHtml, 'companyname' => $companyname )); }
After making this change. I edited my Transactional email to enable this option. Since I wanted to display the delivery address, I placed my variable immediately before this line in
System > Transactional Emails > New Order Email {{ var companyname }} {{var order.getShippingAddress.format('html')}}
If your company name is saved as part of customer information, it will be displayed in your order email in the "Delivery address" field right at the start.
You can do the same for invoices and shipments.
Hope this helps someone !!! :-)
ivn
source share