0

I have created a custom module for sending order email to customer on order success.

my config.xml file :

...
        <checkout_onepage_controller_success_action>
            <observers>
                <company_customizeorderemail_checkout_onepage_controller_success_action>
                    <class>Company_CustomizeOrderEmail_Model_Observer</class>
                    <method>send_order_email</method>
                </company_customizeorderemail_checkout_onepage_controller_success_action>
            </observers>
        </checkout_onepage_controller_success_action>
... 

My observer file has function as following :

public function send_order_email($observer)
    {
        try
        {

            $order_ids = $observer->getData('order_ids'); 
            $order_id = $order_ids[0];


            $order = Mage::getModel('sales/order')->load($order_id);

            /* send new order email */              
            $order->sendNewOrderEmail();
            return;
        }
        catch (Exception $e)
        {
            Mage::log($e->getMessage());
        }
    }

this module send email on order success but order success page showing page content on white page, it means there is problem in loading layout.

What is the problem in my custom module?

Or Is there any another method to send order email?

1 Answer 1

0

I have check your code, find that few code may be create issue.

  • Have you declare the class of Company_CustomizeOrderEmail_Model_Observer, if not then not then you define the class bcoz as per as, your code at observer.php, you did not declare class.
  • For getting order id, you need to use:
    $order_ids = $observer->getEvent()->getData('order_ids');
    instead of
    $order_ids = $observer->getData('order_ids');
10
  • Thanks For Reply, but I have declared class in observer.php and the code $observer->getData('order_ids') working, it return correct order_id so that functioning is perfect, problem is in page layout. Please reply. Commented Jun 3, 2016 at 7:22
  • renove the observer code from config.xml and check that success page ok or not?
    – Amit Bera
    Commented Jun 3, 2016 at 7:23
  • Yes, after removing event from config.xml success page showing correct. this module only created for this one task. What do I do? Commented Jun 3, 2016 at 7:30
  • PLease remove "$order->getSendConfirmation(null); $order->sendNewOrderEmail();"
    – Amit Bera
    Commented Jun 3, 2016 at 7:32
  • check that what will happne
    – Amit Bera
    Commented Jun 3, 2016 at 7:32

Your Answer

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

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