0 items in cart

Please wait, updating cart

Cart is empty.

Total: $0

Checkout

Subscribe Feed

Archive for the ‘Extensions’ Category

Adding your extension version to admin pages

So you’d like users of your extension to know which version it is, so you can give them support, without asking them to open extension files?

In your helper add this method:


public function addAdminhtmlVersion($module)
{
    $layout = Mage::app()->getLayout();
    $version = (string)Mage::getConfig()
        ->getNode("modules/{$module}/version");

    $layout->getBlock('before_body_end')->append(
        $layout->createBlock('core/text')->setText('

<script type="text/javascript">
$$(".legality")[0].insert({after:"'.$module.' ver. '.$version.'<br/>"});
</script>

        ')
    );

    return $this;
}

And in your controller action, add the method call:


// ADD:
Mage::helper('yourhelper')->addAdminhtmlVersion('Your_Module');
// BEFORE:
$this->renderLayout();

Now on admin pages that were introduced by your module it will show “Your_Module ver. 1.2.3″ right above the Magento version.