Looking to Build/Redesign a Website or Blog ?

To speak to Rakshit, call +91 968 704 2303

[Magento] How to add Dynamic Menu Item in User Dashboard


Hi Friends,

I am working with Magento project in recent days and my client asks me to add menu on left hand side in my dashboard. I set the menu in left side in dashboard so logged in users can access the menu link. Now client don’t want it static anymore. Client want it dynamic as per user’s ID. To add menu item, you are adding code to xml file and you can not put php code there or write logic to get User ID and make it dynamic. Only way to achieve it is use the helper. Here are both cases.

Static Menu Item in User’s Dashboard

Here is code to set static menu item in user’s dashboard.

<action method="addLink" translate="label" module="pmembers">
 <label>Notification Area</label>

Dynamic Menu Item in User’s Dashboard

If you want to make menu link dynamic, you can not do it using help. Here is code.

class Namespace_Yourmodule_Helper_Dynamic extends Mage_Core_Helper_Abstract {
    function getDynamicUserIdLink() {
        // Logic to get User's ID
        $dynamic = 4;
        return "alerts/" . $dynamic . "/messages";
<action method="addLink" translate="label" module="pmembers">
 <path helper="yourmodule/dynamic/getDynamicUserIdLink" />
 <label>Notification Area</label>

Now as per your logic to get User ID, it will create dynamic menu link for each logged in user. Isn’t it easy to add Dynamic Menu Item in User Dashboard in Magento ? If “[Magento] How to add Dynamic Menu Item in User Dashboard” helps you, please share with your friends in social media and help them to save time.


No Comments Yet.

Leave a Reply

Your email address will not be published.