I’m creating a Magento Extension and want to be programatically add links to the ‘My account’ navigation. I’ve read the following thread (Magento – How to add/remove links on my account navigation?) and the sites it references, but they only talk about adding a link statically.
By adding the following to a layout file in my module I can get a new link to appear in the customer account navigation.
<customer_account>
<reference name="customer_account_navigation">
<action method="addLink" translate="label" module="mymodule">
<name>modulename</name>
<path>mymodule/</path>
<label>New link</label>
</action>
</reference>
</customer_account>
How can I make it so that this links appearance depends on the results of a method call to one of my extensions models.
You have to use event-observer functionality of magento
The event you have to use it “controller_action_layout_load_before”
In your module’s config.xml
and in the corresponding observer.php use the following code
and in local.xml write