Showing the Review Step in Magento One Page Checkout
The one page checkout feature in Magento provides a seamless shopping experience for your customers by allowing them to complete their purchases without leaving the current page. By default, it hides the order review step until all other steps (shipping, payment) are completed successfully.
However, there might be cases where you want to display this final review stage immediately, especially if you have complex configurations or need users to double-check their information before proceeding. In this guide, we’ll show you how to modify the one page checkout process to reveal the order summary step from the start.
Understanding the Checkout Flow
The Magento one page checkout follows a logical flow divided into several steps:
- Customer Information: Here, customers enter their contact details and shipping methods.
- Shipping Method: Customers select their preferred shipping options.
- Payment Method: They choose their payment method (cash on delivery, PayPal, etc.).
- Order Summary: This is the final step where customers review their order before submitting it.
By default, Magento hides this last step until users complete all previous steps without errors. Let’s modify this behavior to display the order summary immediately.
Modifying the Checkout Process
To achieve this, you’ll need to override the onepageCheckout controller and its associated view files. Here are the steps:
-
Create a new module: In your Magento installation, navigate to
app/code. Create a new folder namedYour_Company/OnePageCheckout. Inside this module, create the following folders:Controller,etc, andview/frontend/templates. -
Override the onepagecheckout controller:
-
Open
app/code/core/Mage/Checkout/controllers/OnepageController.phpin your text editor. -
Duplicate this file to your new module’s Controller folder as
Your_Company_OnePageCheckoutController.xml. -
In this XML file, define a new configuration that overrides the core controller:
<config> <modules> <Your_Company_OnepageCheckout> <version>1.0.0</version> </Your_Company_OnepageCheckout> </modules> <global> <models> <checkout> <rewrite> <onepageController>Your_Company_OnepageCheckoutController</onepageController> </rewrite> </checkout> </models> </global> </config> -
Save and close the file.
-
-
Create a custom controller: In your
app/code/Your_Company/OnePageCheckout Controllerfolder, create a new PHP file namedOnepageController.php. -
Override the onepage action:
-
Open this new file and create a class that extends the native
Mage_Checkout_OnepageController:<?php class Your_Company_OnepageCheckoutController extends Mage_Checkout_OnepageController { public function indexAction() { // Your custom code here } } ?> -
In this method, you can add your own logic. For example, to display the order summary immediately:
$cartHelper = Mage::helper('checkout/cart'); if ($cartHelper->getCart()->getQuote()->getItemsCount()) { $this->_redirect('checkout/onepage/summary', array('_secure' => true)); return; } -
Save and close the file.
-
-
Override the view template: Create a new file named
summary.phtmlin your module’sview/frontend/templatesfolder, and add your own custom HTML markup if needed. -
Enable your module:
- Navigate to
System > Configuration > Advanced. - In the ‘Disable Modules On’ section, find and enable your new module (
Your_Company_OnepageCheckout).
- Navigate to
Conclusion
While Magento’s one page checkout system is highly flexible, it may require some customization to meet specific business needs. By overriding the core controller and view templates, you can modify the checkout process to display the order summary step immediately.
Remember that extensive modifications like this should be thoroughly tested before deployment, as they can affect other functionalities in your store. Always refer to the Magento documentation for detailed instructions on module development: https://laravelcompany.com/magento-development-documentation.
The code examples provided are simplified and serve to demonstrate the concept. In a real-world scenario, you would need to handle edge cases, validations, and other complex logic related to the checkout process.
Implementing these changes will help enhance your customers’ shopping experience by providing them with clear visibility into their final order details before submission.