2

I have an extension with a Block/Tracking.php. It contains

class Custom_Analytics_Block_Tracking extends Mage_Core_Block_Template
{
    protected function _toHtml() { return "Hi"; }
}

The layout update file contains

<checkout_onepage_success>
    <reference name="content">
        <block type="analytics/tracking" name="analytics_tracking" />
    </reference>
</checkout_onepage_success>

I also added in success.phtml (it looks like this is not needed!)

<?php echo $this->getChildHtml('analytics_tracking'); ?>

But this doesn't add the return value of _toHtml() to the success page. What am I doing wrong? Thank you so much!

3

I remember you explicitly have to state it has to use toHtml output

<checkout_onepage_success>
    <reference name="content">
        <block type="analytics/tracking" name="analytics_tracking" output="toHtml"/>
    </reference>
</checkout_onepage_success>
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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