Charlie Harvey

Magento tip: Working on success page without having to place an order

The other day I needed to make a trivial change in the checkout page in the New iNternationalist ethical shop. I always want to visually test a page before rolling it out live. I know how easy it is to mess up the position of an angle bracket or something! Normally you can only see the checkout success page when you have actually placed an order. Which is reasonable enough. But you hardly want to place an order for every trivial HTML tweak.

As it turns out you can simply comment out a bit of the OnepageController success method. The onepage controller lives at app/code/core/Mage/Checkout/controllers/OnepageController.php

The code that needs commenting out is in the successAction() method. Here is what I do in magento 1.7.x 227 /*if (!$session->getLastSuccessQuoteId()) { 228 $this->_redirect('checkout/cart'); 229 return; 230 } 231 232 $lastQuoteId = $session->getLastQuoteId(); 233 $lastOrderId = $session->getLastOrderId(); 234 $lastRecurringProfiles = $session->getLastRecurringProfileIds(); 235 if (!$lastQuoteId || (!$lastOrderId && empty($lastRecurringProfiles))) { 236 $this->_redirect('checkout/cart'); 237 return; 238 } 239 240 $session->clear();*/

Now I can work on the checkout success page at app/design/frontend/default/_your_theme_/template/checkout/success.phtml I use a seperate dev environment, so I simply revert the OnepageController.php code when I am done.


  • Be respectful. You may want to read the comment guidelines before posting.
  • You can use Markdown syntax to format your comments. You can only use level 5 and 6 headings.
  • You can add class="your language" to code blocks to help highlight.js highlight them correctly.

Privacy note: This form will forward your IP address, user agent and referrer to the Akismet, StopForumSpam and Botscout spam filtering services. I don’t log these details. Those services will. I do log everything you type into the form. Full privacy statement.