Question

I got this code, and that works well:

<customer_account translate="label">
    <reference name="customer_account_navigation">
        <action method="addLink"><name>someName</name><path>somePath</path><label>Some Label</label></action>
    </reference>
</customer_account>

But I just want to add this customer account navigation link for specific customers. I would be able to write some PHP what acquires the information if the user should view the custom navigation link, but i cannot do this with XML.

What is the solution for this problem?

Was it helpful?

Solution

Copy app\design\frontend\PACKAGE\THEME\template\customer\account\navigation.phtml to your theme. Then do changes according to this :

<div class="block block-account">

    ... 

    <div class="block-content">
        <ul>

            <?php
            if(true)//YOUR LOGIC FOR specific customers
            {
                //change values according to your requirements
                $this->addLink("Some Name", "MODULE/CONTROLLER/ACTION", "Some Label", array("PARAMETER"=>"VALUE"));
            }
            ?>

            <?php $_links = $this->getLinks(); ?>
            <?php $_index = 1; ?>

            ...

        </ul>
    </div>
</div>

Yes, remove your XML code

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top