0

I'm trying to build a custom extension for an existing Magento setup which will fire on the sales_order_save_after observer.

With the extension disabled, the checkout completes fine, going through to the success page. The only thing HTTPfox records is a single successful call to:

/sgps/payment/onepageSaveOrder/?SID=<removed> - {"success":"true","response_status":"OK"}

With the extension enabled, the checkout seems to go through OK, but returns to the Cart - the order is not saved. HTTPfox records the same URL is called, but returns an Nginx 502 error:

<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.6.2</center>
</body>
</html>

This is what comes up in my error log:

2015/08/06 12:31:02 [error] 29163#0: *240923 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: <removed>, server: <removed?, request: "POST /sgps/payment/onepageSaveOrder/?SID=o$

This is the relevant config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <WS_FirstOrder>
            <version>0.0.4</version>
        </WS_FirstOrder>
    </modules>   
    <global>
        <models>
            <ws_firstorder>
                <class>ws_firstorder/observer</class>
            </ws_firstorder>
        </models>
        <events>
            <sales_order_place_after>
                <observers>
                    <first_order_handle>
                        <class>ws_firstorder/observer</class>
                        <method>handleCustomerFirstOrder</method>
                        <type>singleton</type>                        
                    </first_order_handle>
                </observers>
            </sales_order_place_after>
        </events>
    </global>
</config>

I've tried using loads of different observers (sales_order_save_after, sales_order_save_after_commit), all seem to do the same thing. I've also tried altering the dependencies so that my module fires first on that observer, and last. I've upped the max_children php_fpm can run; restarted php-fpm - I'm pretty confident php-fpm is not at fault.

I've also completely emptied out the method so that all it does is return $this; the same thing seems to happen.

I'd really appreciate any pointers on what might be causing this.

Edit 1: I've also tried adding a die(...) statement within the relevant method. It seems to make no difference.

1 Answer 1

2
<models>
    <ws_firstorder>
        <class>ws_firstorder/observer</class>
    </ws_firstorder>
</models>

is wrong. Assuming your observer file is Ws_Firstorder/Model/Observer.php and the class is called Ws_Firstorder_Model_Observer then it should be <class>Ws_Firstorder_Model</class>

If you check var/log/exception.log and var/log/system.log you'll probably see it moaning about not being able to find your class.

Also, you may find it easier to test your extension using the purchase order payment method, as you'll have fewer pages to go through and won't be redirecting off your site.

1
  • Cheers! You're right, I saw that literally just before I saw the window activate with your reply.
    – WillPS
    Aug 6, 2015 at 15: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.