1

I am using Magento 1.9. I want to send Cancel email to the particular customer.

How to send email to the customer

  • order cancel email right? – Abdul Dec 8 '15 at 10:34
  • yes order cancel email to customer – Magento 2 Dec 8 '15 at 10:35
  • if order cancel admin user then send email to customer right – Abdul Dec 8 '15 at 10:36
  • Yes if admin cancel order user will get the mail – Magento 2 Dec 8 '15 at 10:36
  • What are purpose if u question as it already exit in magento – Amit Bera Dec 8 '15 at 12:31
2

Follow bellow steps

Step :1 app\etc\modules\Arb_Ordercancel.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Arb_Ordercancel>
            <active>true</active>
            <codePool>local</codePool>
        </Arb_Ordercancel>
    </modules>
</config>

Step : 2 app\code\local\Arb\Ordercancel\etc\config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Arb_Ordercancel>
            <version>0.1.0</version>
        </Arb_Ordercancel>
    </modules>
    <global>
        <events>
            <order_cancel_after>
                <observers>
                    <order_cancel_email>
                        <type>singleton</type>
                        <class>ordercancel/observer</class>
                        <method>orderCancelAfter</method>
                    </order_cancel_email>
                </observers>
            </order_cancel_after>
    </events>
    </global>
</config>

Step : 3 app\code\local\Arb\Ordercancel\Model\Observer.php

<?php
/**
* 
*/
class Arb_Ordercancel_Model_Observer
{
    public function orderCancelAfter($observer)
    {
        $order = $observer->getEvent()->getOrder();
        $notify = true;
        $comment = 'Order Cancel';
        $order->sendOrderUpdateEmail($notify, $comment);  
    }
}
  • No I didn't got any mail – Magento 2 Dec 8 '15 at 11:37
  • event working or not? – Abdul Dec 8 '15 at 11:51
  • Event is working but i din't get any mail – Magento 2 Dec 8 '15 at 11:52
  • Pls email configuration in admin side : System -> Configuration -> Sales -> Sales Emails : Order Comments – Abdul Dec 8 '15 at 11:57
  • it's already enabled – Magento 2 Dec 8 '15 at 12:01
1

create file in app/etc/modules/Solsint_Cancelorder.xml

<?xml version="1.0"?>
<config>
  <modules>
    <Solsint_Cancelorder>
      <active>true</active>
      <codePool>local</codePool>
      <version>0.1.0</version>
    </Solsint_Cancelorder>
  </modules>
</config>

create file in app/code/local/Solsint/Cancelorder/etc/config.xml

<?xml version="1.0"?>
<config>
<modules>
<Solsint_Cancelorder>
<version>0.1.0</version>
</Solsint_Cancelorder>
</modules>

<global>
 <events>
  <sales_order_save_commit_after>
        <observers>
            <sales_order_save_commit_after>
                <class>Solsint_Cancelorder_Model_Observer</class>
                <method>sendreviewEmailOnComplete</method>
            </sales_order_save_commit_after>
        </observers>
    </sales_order_save_commit_after>
</events>
</global>
</config>

create file in app/code/local/Solsint/Cancelorder/Model/Observer.php

class Solsint_Cancelorder_Model_Observer{


public function sendreviewEmailOnComplete($observer)
{
    $order = $observer->getOrder();
    if($order->getState() == Mage_Sales_Model_Order::STATE_CANCELED)
    { Mage::log('working');
     $comment='';
     $orderload=Mage::getModel('sales/order')->load($order->getEntityId());
     $orderload->sendOrderUpdateEmail(true, $comment);
    }
}
}
  • Can you please tell me the file path – Magento 2 Dec 8 '15 at 12:55
  • did you create any module for that? – Qaisar Satti Dec 8 '15 at 12:57
  • @Kothari use #abdul code for create module and change event and observer – Qaisar Satti Dec 8 '15 at 13:01
  • can you please tell me how to change that i am not familer in this – Magento 2 Dec 8 '15 at 13:09
  • I will create a simple module and send you – Qaisar Satti Dec 8 '15 at 13:12

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.