Magento 1.8 Email Templates – How to Insert Customer’s Email

email-templatesmagento-1.8sales-order

How can I insert the customer’s email into the email templates for both guest and registered customers?

I came across this answer but it seems a bit too old now as I am using Magento 1.8. The code looks different now.

The code from the answer for app/code/core/Mage/Sales/Model/Order.php,

foreach ($sendTo as $recipient) {
$mailTemplate->setDesignConfig(array('area'=>'frontend', 'store'=>$this->getStoreId()))
->sendTransactional(
$template,
Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $this->getStoreId()),
$recipient['email'],
$recipient['name'],
array(
'order'         => $this,
'billing'       => $this->getBillingAddress(),
'payment_html'  => $paymentBlock->toHtml(),
'guestemailvalue' => $recipient['email']
)
);
}

the code from the 1.8 for app/code/core/Mage/Sales/Model/Order.php,

    // Set all required params and send emails
    $mailer->setSender(Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId));
    $mailer->setStoreId($storeId);
    $mailer->setTemplateId($templateId);
    $mailer->setTemplateParams(array(
            'order'        => $this,
            'billing'      => $this->getBillingAddress(),
            'payment_html' => $paymentBlockHtml
        )
    );
    $mailer->send();

Any ideas?

Best Answer

tealau, for getting new order email goto

app/locale/yourlanguae/template/email/sales/

magento used different different email template for guest and register

find and here you find list order email and you can getusing

 {{htmlescape var=$order.getCustomerEmail()}}