I want to display a li in the order confirmation email only when the customer selected check / money order.

Is this possible and if so, how?



Yes it's possible.
Here is not so pretty solution, but it works.

You need to rewrite the Mage_Sales_Model_Order::sendNewOrderEmail method and pass an additional parameter to the e-mail template.

To do this, you need to create a custom module (Vendor_Module), add this inside the config.xml of the module inside the <global><models> tag.


Then create the file Vendor/Module/Model/Order.php with this code:

class Vendor_Module_Model_Order extends Mage_Sales_Model_Order 
    public function sendNewOrderEmail()
        $storeId = $this->getStore()->getId();

        if (!Mage::helper('sales')->canSendNewOrderEmail($storeId)) {
            return $this;
        // Get the destination email addresses to send copies to
        $copyTo = $this->_getEmails(self::XML_PATH_EMAIL_COPY_TO);
        $copyMethod = Mage::getStoreConfig(self::XML_PATH_EMAIL_COPY_METHOD, $storeId);

        // Start store emulation process
        $appEmulation = Mage::getSingleton('core/app_emulation');
        $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);

        try {
            // Retrieve specified view block from appropriate design package (depends on emulated store)
            $paymentBlock = Mage::helper('payment')->getInfoBlock($this->getPayment())
            $paymentBlockHtml = $paymentBlock->toHtml();
        } catch (Exception $exception) {
            // Stop store emulation process
            throw $exception;

        // Stop store emulation process

        // Retrieve corresponding email template id and customer name
        if ($this->getCustomerIsGuest()) {
            $templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_GUEST_TEMPLATE, $storeId);
            $customerName = $this->getBillingAddress()->getName();
        } else {
            $templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE, $storeId);
            $customerName = $this->getCustomerName();

        $mailer = Mage::getModel('core/email_template_mailer');
        $emailInfo = Mage::getModel('core/email_info');
        $emailInfo->addTo($this->getCustomerEmail(), $customerName);
        if ($copyTo && $copyMethod == 'bcc') {
            // Add bcc to customer email
            foreach ($copyTo as $email) {

        // Email copies are sent as separated emails if their copy method is 'copy'
        if ($copyTo && $copyMethod == 'copy') {
            foreach ($copyTo as $email) {
                $emailInfo = Mage::getModel('core/email_info');
        //this needs to be added
        if ($this->getPayment()->getMethodInstance()->getCode() == 'checkmo') {
            $checkmoComment = Mage::helper('sales')->__('Your message here');
        else {
            $checmoComment = '';
        // Set all required params and send emails
        $mailer->setSender(Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId));
                'order'        => $this,
                'billing'      => $this->getBillingAddress(),
                'payment_html' => $paymentBlockHtml,
                'checkmo_comment' => $checkmoComment //this needs to be added

        $this->_getResource()->saveAttribute($this, 'email_sent');

        return $this;

The code above is basically the original sendNewOrderEmail method with a few additional lines. I commented those lines with this needs to be added.

Now you should be able to add in the e-mail template this variable {{var checkmo_comment}} where you want your text to appear.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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