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?
Asked
Active
Viewed 1,879 times
0
-
check answer here : http://magento.stackexchange.com/questions/4574/does-magento-send-order-cancellation-emails – Rohit Kundale Jan 12 '16 at 05:57
-
I tried else Condition not working – Jan 12 '16 at 06:03
-
you can use order_cancel_after event to fire cancel email to customer. – Rohit Kundale Jan 12 '16 at 06:06
-
Can you please give a code i am new from magento – Jan 12 '16 at 06:07
-
are you send order cancel email admin end? – Abdul Jan 12 '16 at 06:13
-
yes while click cancel i need to send mail to customer – Jan 12 '16 at 06:18
-
@MagentoDev check here. already code available here http://magento.stackexchange.com/questions/52393/send-email-after-order-is-canceled – Rohit Kundale Jan 12 '16 at 06:20
-
Even i tried this also but not working – Jan 12 '16 at 06:27
-
Open file app\code\core\Mage\Adminhtml\controllers\Sales\OrderController.php – Abdul Jan 12 '16 at 07:03
-
find function cancelAction() and add code $order->sendOrderUpdateEmail(true, null); after $order->cancel() ->save(); – Abdul Jan 12 '16 at 07:05
-
and check again it is working or not – Abdul Jan 12 '16 at 07:05
-
if it working then override controller action in core to local – Abdul Jan 12 '16 at 07:07
-
Ok i will check it – Jan 12 '16 at 08:00
-
@Abdul it's working fine – Jan 12 '16 at 09:54
-
Let us continue this discussion in chat. – Abdul Jan 12 '16 at 09:57
1 Answers
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
Abdul
- 9,701
- 1
- 20
- 43