How to Customize Magento Checkout Success Page

checkoutmagento-1.9onepage-checkout

I want to customize Success Page in Magento: frontend/base/default/template/checkout/success.phtml

I want to be exactly like in the attached image. And at very bottom to have "You may also be interested in" section. This section is already exist I use ultimo theme.

I found a code that seems to work but is not have all details like in this image.

the code is:

<?php 
    $order_id = Mage::getSingleton('checkout/session')->getLastRealOrderId(); 
    $order_details = Mage::getModel('sales/order')->loadByIncrementId($order_id); 
    $shipping_address_data = $order_details->getShippingAddress();
    ?>
                <table>
                 <tr> 
                    <th><?php echo $this->__('Description') ?></th
                    <th><?php echo $this->__('Description') ?></th>
                    <th><?php echo $this->__('Qty') ?></th>
                    <th><?php echo $this->__('Unit Price') ?></th>
                </tr>

            <?php foreach($order_details->getAllVisibleItems() as $item): 
    $configItem = Mage::getModel('catalog/product')->loadByAttribute('sku', $item->getSku());
    ?> 
                <tr>
                    <td><img src="<?php echo $this->helper('catalog/image')->init($configItem, 'small_image')->resize(200); ?>" width="200" height="200" class="media-object img-responsive" alt="<?php echo $this->getImageLabel($configItem, 'small_image'); ?>"/></td>
                    <td><?php echo $item->getName() ?></td>
                    <td><?php echo round($item->getQtyOrdered(), 0) ?></td>
                    <td><?php echo Mage::helper("core")->currency($item->getPrice()) ?></td>
                </tr>
                </table>
            <?php endforeach ?> 

            <?php echo "<br>" . $shipping_address_data['country_name']; ?>

enter image description here

Best Answer

What you need is to access order information with the following code:

$order = Mage::getSingleton('checkout/session')->getLastRealOrder();
$shippingAddress = $order->getShippingAddress();
$billingAddress = $order->getShippingAddress();

Then if you want to show something, for example the shipping street address, you can use:

$shippingAddress->getStreetFull()

As well as getting the whole shipping address with:

$shippingAddress->format('html')

Of course you will have to adapt to show the information in your template.

Hope this can help you.

Related Topic