0

This is my xml :

<global>
    <events>
        <sales_order_place_after>
            <observers>
                <test_magewidget_model_observer>
                    <type>singleton</type>
                    <class>Test_MageWidget_Model_Observer</class>
                    <method>testRedirection</method>
                </test_magewidget_model_observer>
            </observers>
        </sales_order_place_after>
    </events>
</global>

This is my Observer :

class Test_MageWidget_Model_Observer {

    public function testRedirection($observer) {
        try {
            Mage::app()->getResponse()->setRedirect(Mage::getUrl("checkout/cart"));
            Mage::log('Hi', null, 'magewidget.log');
        } catch (Exception $e) {
            Mage::logException($e->getMessage());
        }
    }

After placing order event being triggered, but redirection not working properly. It's showing in Browser network response, but not reflecting on the browser.

What can be the reason behind this? Please help me.

0

Try :

public function testRedirection($observer) {
    Mage::log('Hi', null, 'magewidget.log', true); 
    Mage::app()->getResponse()->setRedirect(Mage::getUrl('checkout/cart'))->sendResponse();            
}
| improve this answer | |
  • Hi Prince, Thanks for your help but still having the same issue. – Mr. Nanhe Oct 30 '18 at 5:39

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.