- Web templates
- E-commerce Templates
- CMS & Blog Templates
- Facebook Templates
- Website Builders
Magento. How to edit order confirmation page
August 24, 2015
Magento. How to edit order confirmation page
This tutorial shows how to edit order confirmation page in Magento:
-
Navigate to app/design/frontend/base/default/template/checkout/success.phtml inside your site directory on the server via FTP or on your hosting cPanel and copy the success.phtml file to the app/design/frontend/default/themeXXX/template/checkout folder.
-
In order to test the changes, perform the following steps:
-
If your payment method is not Saved CC, set it to it in System -> Configuration -> Sales -> Payment Methods in your dashboard and use a test credit card to check out and get the success page to display. The Visa test card number is 4111111111111111:
- Temporarily edit a Magento Core code file to disable clearing session by commenting out this code around Line 227 in app/code/core/Mage/Checkout/controllers/OnepageController.php:
replace
$session->clear();
with:
//$session->clear();
-
-
In app/design/frontend/default/themeXXX/template/checkout/success.phtml you can edit the Order Confirmation Page code.
We strongly recommend backing up the file before editing it:
-
To edit the default text, replace the text between single quotes with yours. For example:
Replace
<h1><?php echo $this->__('Your order has been received.') ?></h1>
with
<h1><?php echo $this->__('Great, we got your order!!!') ?></h1>
-
For displaying Shipping Address add this code:
<br /> <br /> <p>Shipping Details</p> <?php /* First, let's load some Load order details */ ?> <?php $order_id = Mage::getSingleton('checkout/session')->getLastRealOrderId();?> <?php $order_details = Mage::getModel('sales/order')->loadByIncrementId($order_id);?> <?php /* Get shipping method */ ?> <?php $shipping_method = $order_details->_data["shipping_description"];?> <?php /* Get ship-to address information */ ?> <?php $shipping_address_data = $order_details->getShippingAddress();?> <?php /* Output the ship-to address information */ ?> <?php echo "<br>" . $shipping_address_data['firstname'];?> <?php echo " " . $shipping_address_data['lastname'];?> <?php echo "<br>" . $shipping_address_data['street'];?> <?php echo "<br>" . $shipping_address_data['city'];?> <?php echo ", " . $shipping_address_data['region'];?> <?php echo " " . $shipping_address_data['postcode'];?> <?php echo "<br>" . $shipping_address_data['country_id'];?>
-
This code will display Order Summary Amounts:
<br /> <br /> <p>Order Amounts</p> <br /> <?php /* Billing amounts */ ?> <?php /* These leverage the Magento core helper to format the numbers to currency */ ?> <?php echo '<p class="subtotal">Subtotal:<span class="amount">' . Mage::helper("core")->currency($order_details->subtotal) . "</span></p>";?> <?php echo '<p class="tax">Tax:<span class="amount">' . Mage::helper("core")->currency($order_details->tax_amount) . "</span></p>";?> <?php echo '<p class="discount">Discount:<span class="amount">' . Mage::helper("core")->currency($order_details->discount_amount) . "</span></p>";?> <?php echo '<p class="paid">Amount Paid:<span class="amount">' . Mage::helper("core")->currency($order_details->total_paid) . "</span></p>";?>
-
In order to display a custom static CMS block, for example social-buttons-block, use this code:
<?php /* Loads the CMS static block directly */ ?> <?php /* Note: the identifier for the cms block in this example is social-buttons-block - adjust to suite your cms */ ?> <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('social-buttons-block')->toHtml();?>
-
You may also need to clear the cache.
Feel free to check the detailed video tutorial below: