I am trying to modify the success checkout page on magento to add a javascript snippet for tracking revenue. I have created my own plugin and I have been following this blogpost but whenever I do a successful checkout I get an empty page which doesn't load my custom success.phtml file. I am attaching a screenshot for more details.

enter image description here


<?xml version="1.0"?>


<?xml version="1.0"?>
<layout version="0.1.0">
    <checkout_onepage_success translate="label">
        <label>One Page Checkout Success</label>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
        <reference name="content">
            <reference name="checkout.success">
                <action method="setTemplate"><template>mymodule/success.phtml</template></action>


 * Magento
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to [email protected] so we can send you a copy immediately.
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magento.com for more information.
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
<div class="page-title">
    <h1><?php echo $this->__('Your order has been received.') ?></h1>
<?php echo $this->getMessagesBlock()->toHtml() ?>
<h2 class="sub-title"><?php echo $this->__('Thank you for your purchase!') ?></h2>

<?php if ($this->getOrderId()):?>
<?php if ($this->getCanViewOrder()) :?>
    <p><?php echo $this->__('Your order # is: %s.', sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getViewOrderUrl()), $this->escapeHtml($this->getOrderId()))) ?></p>
<?php  else :?>
    <p><?php echo $this->__('Your order # is: %s.', $this->escapeHtml($this->getOrderId())) ?></p>
<?php endif;?>
    <p><?php echo $this->__('You will receive an order confirmation email with details of your order and a link to track its progress.') ?></p>
<?php if ($this->getCanViewOrder() && $this->getCanPrintOrder()) :?>
        <?php echo $this->__('Click <a href="%s" onclick="this.target=\'_blank\'">here to print</a> a copy of your order confirmation.', $this->getPrintUrl()) ?>
        <?php echo $this->getChildHtml() ?>
<?php endif;?>
<?php endif;?>

<?php if ($this->getAgreementRefId()): ?>
    <p><?php echo $this->__('Your billing agreement # is: %s.', sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getAgreementUrl()), $this->escapeHtml($this->getAgreementRefId())))?></p>
<?php endif;?>

<?php if ($profiles = $this->getRecurringProfiles()):?>
<p><?php echo $this->__('Your recurring payment profiles:'); ?></p>
<ul class="disc">
<?php foreach($profiles as $profile):?>
<?php $profileIdHtml = ($this->getCanViewProfiles() ? sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getProfileUrl($profile)), $this->escapeHtml($this->getObjectData($profile, 'reference_id'))) : $this->escapeHtml($this->getObjectData($profile, 'reference_id')));?>
    <li><?php echo $this->__('Payment profile # %s: "%s".', $profileIdHtml, $this->escapeHtml($this->getObjectData($profile, 'schedule_description')))?></li>
<?php endforeach;?>
<?php endif;?>
<?php echo "<b>hello</b>"; ?>
<div class="buttons-set">
    <button type="button" class="button" title="<?php echo $this->__('Continue Shopping') ?>" onclick="window.location='<?php echo $this->getUrl() ?>'"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
<script type="text/javascript">
    var _vis_opt_revenue = <?php $order = Mage::getModel('sales/order')->loadByIncrementId($orderId); echo $order['base_grand_total'];?>;
    window._vis_opt_queue = window._vis_opt_queue || [];
    window._vis_opt_queue.push(function() {_vis_opt_revenue_conversion(_vis_opt_revenue);});

My module structure

- ArchitVerma
    - MyModule
        - Block
            - Onepage
                - Success.php
        - etc
            - config.xml

What am I missing here?

  • That means your .phtml file is not getting called. Please add your code so we can look in to it (config.xml, your_layout.xml and .phtml file with folder structure) Commented Jun 14, 2015 at 8:55
  • @AdarshKhatri I've edited my question and added the required details. Commented Jun 14, 2015 at 9:16

1 Answer 1


Replace your app/design/frontend/base/default/layout/mymodule.xml file with this code:

<?xml version="1.0"?>
<layout version="0.1.0">
    <checkout_onepage_success translate="label">
        <label>One Page Checkout Success</label>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
            <reference name="checkout.success">
                <action method="setTemplate"><template>mymodule/success.phtml</template></action>

Basically, when you are using setTemplate then no need to put it inside content, you can just put it as standalone. However, <reference name="" should match with the original magento name of that template file (check inside<checkout_onepage_success> tag in layout/checkout.xml file).

  • It worked! Thanks a lot! Could you please also explain the changes you made? Commented Jun 14, 2015 at 9:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.