The Magento order process completes with an order success page confirming that the order has been received and displaying the order number. This poses a problem for orders with non-instantaneous payment methods (like Check/Money Order) since the necessary payment details are then only available to customers during the payment step before the order is placed and customers need to know to note these down. Ideally you want any necessary payment information to be shown to the customer once they have finished placing the order. This post shows how to customise the order success page based on the selected payment type to show payment details for non-instantaneous payment methods, ensuring that customers properly complete the full order process.
To demonstrate the necessary changes we will use the Check/Money Order payment method. To get started we need to create a static block with "money_order_msg" set as the block id and add the following content: "Your order will be processed as soon as payment has been received. Please make cheques payable to ACME Inc."
To include the static block we have just created the following template needs to be modified:
app/design/frontend/default/_your_theme_/template/checkout/success.phtml
Custom code is best inserted above the <div class="button-set"> element, which defines a 'Continue Shopping' button. Insert the following above the "button-set" line:
<?php
// Get the id of the order just made.
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
// If the order was paid for by Check or Money Order, display the custom message
if ($order->getPayment()->getMethod() == "checkmo")
{
echo $this->getLayout()->createBlock('cms/block')->setBlockId('money_order_msg')->toHtml();
}
?>
This code will retrieve the order that has been placed and check whether the payment method is "checkmo", which is the payment method code for the Check / Money Order method. If Check/Money Order has been used as the payment method, then our new static block will be placed on the success page, above the "Continue Shopping" button.
One way to find the payment method code for other payment methods is to inspect the payment method header in the Magento backend with Firebug or simply viewing the page source.
To improve the checkout process further, you can modify the details shown in the payment step to state that full payment details will only be made available once the order is placed. This helps ensure that those who prefer non-instantenous payment methods actually complete the entire checkout process.
By using the appropriate payment method code you can add customised reminders for any non-instantenous payment method, and your customers will be able to refer to the payment details once the order is placed.
Magento Compatibility
Post originally written for Magento version: | 1.3.2.4 |
Tested with Magento versions: | 1.3.2.4, 1.4.0.1 |