Magento 1.9 Email – Send Order Cancel Email

emailemail-templatesmagento-1.9sales-order

We are using Magento 1.9.1 in my website i tried to send cancel order email but i am not able to send mail to customer. How to send mail to particular customer?

Best Answer

Replace code in file app\code\core\Mage\Adminhtml\controllers\Sales\OrderController.php

From

public function cancelAction()
{
    if ($order = $this->_initOrder()) {
        try {
            $order->cancel()
                ->save();
            $this->_getSession()->addSuccess(
                $this->__('The order has been cancelled.')
            );
        }
        catch (Mage_Core_Exception $e) {
            $this->_getSession()->addError($e->getMessage());
        }
        catch (Exception $e) {
            $this->_getSession()->addError($this->__('The order has not been cancelled.'));
            Mage::logException($e);
        }
        $this->_redirect('*/sales_order/view', array('order_id' => $order->getId()));
    }
}

To

public function cancelAction()
    {
        if ($order = $this->_initOrder()) {
            try {
                $order->cancel()
                    ->save();
                $order->sendOrderUpdateEmail(true, null);
                $this->_getSession()->addSuccess(
                    $this->__('The order has been cancelled.')
                );
            }
            catch (Mage_Core_Exception $e) {
                $this->_getSession()->addError($e->getMessage());
            }
            catch (Exception $e) {
                $this->_getSession()->addError($this->__('The order has not been cancelled.'));
                Mage::logException($e);
            }
            $this->_redirect('*/sales_order/view', array('order_id' => $order->getId()));
        }
    }

Note: if it working then override controller action in core to local

Related Topic