Recent Posts


Working on Magento’s Success Page


Frustrated by Magento? Then you’ll love Commerce Bug, the must have debugging extension for anyone using Magento. Whether you’re just starting out or you’re a seasoned pro, Commerce Bug will save you and your team hours everyday. Grab a copy and start working with Magento instead of against it.

Updated for Magento 2! No Frills Magento Layout is the only Magento front end book you'll ever need. Get your copy today!

Nothing dredges up fear and loathing in an e-commerce developer like the phrase

so we’ll just add [—] to the order success page

That’s because testing any changes to this page requires a full purchase flow. Most web developers work in a “type, save, refresh, examine, oops, type, save, refresh” mode, and the idea of “click, click, fill out form, click, fill out form, click, etc., click, examine, oops — oh crap not again” is anathema.

Whenever I need to make a change to the success page in Magento, I’ll walk through a purchase flow (which will save a last order ID in my session), and then temporarily comment out the following lines in the Checkout controller

#File: app/code/core/Mage/Checkout/controllers/OnepageController.php
public function successAction()
    $session = $this->getOnepage()->getCheckout();
//         if (!$session->getLastSuccessQuoteId()) {
//             $this->_redirect('checkout/cart');
//             return;
//         }

This lets me realod the success page

all I want without being redirected, and any required head/keyboard banging may resume as per normal.

Update: More recent version of Magento have added the following call near the end of this method


This will automatically clear out the session data, ensuring each order confirmation page displays once, and once only. If you’re working with the last order id and/or last order object, you’ll want to comment this out as well to preserve this information between page reloads.

Copyright © Alan Storm 1975 – 2022 All Rights Reserved

Originally Posted: 20th April 2012