0

I'm using magento 1.9.1. I want to add dynamic value beside admin menu items to represent the state. for example: under catalog, I want to add number representing the unapproved products beside manage products. so my question is: can I use a function defined in the helper of my module in the adminhtml.xml file within the node

1 Answer 1

1

To understand how menu title is rendered you should look at _getHelperValue() method inside Mage_Adminhtml_Block_Page_Menu class.

protected function _getHelperValue(Varien_Simplexml_Element $child)
{
    $helperName         = 'adminhtml';
    $titleNodeName      = 'title';
    $childAttributes    = $child->attributes();
    if (isset($childAttributes['module'])) {
        $helperName     = (string)$childAttributes['module'];
    }

    return Mage::helper($helperName)->__((string)$child->$titleNodeName);
}

First it checks if your menu item has module property and then uses that to translate text in <title> node by calling __() method. If module property is not set, it will use adminhtml helper.

So I guess you can either set module property on your menu xml and do something funky with __() method in your helper, which seems kinda odd btw, or rewrite admin menu block and add your custom logic.

1
  • Thanks for the info and suggestions. just to put you in the image, what I/m trying to achieve here is helping the admin by giving him info in the menu. for example tell him that you have 15 unapproved products so that he open the page and start approving them. another example, is under sales tell him that he has 10 new orders sothat he can start processing them, instead of keep vising the pages to check if there are any new orders or products. so I thought of this and since I saw the helper used within <url> node to get the url dynamically I wondered if I can do the same with the title Commented Jul 12, 2016 at 12:12

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.