0

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?

15
  • check answer here : magento.stackexchange.com/questions/4574/… Jan 12, 2016 at 5:57
  • I tried else Condition not working
    – user31402
    Jan 12, 2016 at 6:03
  • you can use order_cancel_after event to fire cancel email to customer. Jan 12, 2016 at 6:06
  • Can you please give a code i am new from magento
    – user31402
    Jan 12, 2016 at 6:07
  • are you send order cancel email admin end?
    – Abdul
    Jan 12, 2016 at 6:13

1 Answer 1

2

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

Your Answer

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