Refresh the checkout success page in Magento

Something useful when working on the “checkout success” page in Magento, whether it’s just styling, implementing some tracking JS codes or whatever open up app/code/core/Mage/Checkout/controllers/OnepageController.php in your favourite editor (mine is PhpStorm, btw) and on line (approx, at least for Magento EE) 275 you’ll find the successAction() method.

In there, comment out lines 278-281 286-291, so the method looks like this:

public function successAction()
{
    $session = $this->getOnepage()->getCheckout();
//        if (!$session->getLastSuccessQuoteId()) {
//            $this->_redirect('checkout/cart');
//            return;
//        }

        $lastQuoteId = $session->getLastQuoteId();
        $lastOrderId = $session->getLastOrderId();
        $lastRecurringProfiles = $session->getLastRecurringProfileIds();
//        if (!$lastQuoteId || (!$lastOrderId && empty($lastRecurringProfiles))) {
//            $this->_redirect('checkout/cart');
//            return;
//        }

//        $session->clear();
        $this->loadLayout();
        $this->_initLayoutMessages('checkout/session');
        Mage::dispatchEvent('checkout_onepage_controller_success_action', array('order_ids' => array($lastOrderId)));
        $this->renderLayout();
}

IMPORTANT: if you’re using a version control system (e.g. GIT), DON’T COMMIT your changes. Actually, don’t EVER change the Magento Core directly. Remember to undo your changes to this file when you’re done testing.

 

Hope someone will find this useful.

Comments