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
http://store.example.com/checkout/onepage/success/
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
$session->clear();
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.