Custom THANK YOU page in Magento – success.phtml PART-1

Magento Offers a very basic “THANK YOU PAGE”. In major E-commerce website they provide a “THANK YOU PAGE” with all order details and summary.

We had the same requirement for our customer. I created a Thank You page with all Order Summary and Order Details in Magento.


I’ll try to cover this up in two posts.

Goto : app/design/frontend/YOURTHEME/default/template/checkout/success.phtml

Part – I : How to bring the Order Summary

I’ll Try to explain the code when necessary, First we will cover the code for Order Summary

Foremost, We need to create the object for Order placed. Create it using

$orderObj = Mage::getModel(‘sales/order’)->loadByIncrementId($this->getOrderId());

Get the object of the Last Order Placed

$lastOrder = Mage::getModel(‘sales/order’)->load(Mage::getSingleton(‘checkout/session’)->getLastOrderId());

From the Last Order Object, billing and shipping address can be obtained. Use following code for it.

$billingAddress = $lastOrder->getBillingAddress();
$shippingAddress = $lastOrder->getShippingAddress();

Suppose, You want to get the detailed Shipping Information use the following code for it.

echo $shippingAddress[‘firstname’]
echo $shippingAddress[‘lastname’]
echo $shippingAddress[‘street’]
echo $shippingAddress[‘city’]
echo $shippingAddress[‘region’]
echo $shippingAddress[‘postcode’]
echo $shippingAddress[‘country_id’]

To Get the Date of the Order, use following code

echo $orderObj->getCreatedAtStoreDate();

To Get the Grand Total use following Code

echo $orderObj->getGrandTotal();

We will cover how to get all order details as shown in the image in Next Post. Please provide your feedback and comments on it.


7 thoughts on “Custom THANK YOU page in Magento – success.phtml PART-1

  1. Hi
    i want to display price on product listing when special price appears on product it will automatically convert the discount ….Eg…regular price-1000 and special price is 900 so want to display 10% discount on this product plz help me asap….thank you


  2. Pingback: Custom THANK YOU page in Magento – success.phtml PART-2 | Universal Coder

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s