Take the 2-minute tour ×
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It's 100% free, no registration required.

I have tried to show the Customer Navigation menu in Custom template file.

Below is My Code:

<div id="customer_menu">
<?php echo $this->getLayout()->createBlock('customer/account_navigation')->setTemplate('customer/account/navigation.phtml')->toHtml();?>
</div>

The menu is not loading well. Showing like below image

enter image description here

Any suggestions will be appreciated.

Thanks,

share|improve this question
    
Have you tried to add the customer menu via the layout handle? –  Amasty Aug 13 at 12:22
    
@Amasty No, I tried via phtml file. –  Vijay S Aug 13 at 12:29
    
are you want to show in special page??? –  Amit Bera Aug 13 at 12:44
    
@AmitBera yes, i tried to show in Popup –  Vijay S Aug 13 at 12:46
    
is pop is coming for which page or all page?? –  Amit Bera Aug 13 at 12:48

3 Answers 3

The result you are getting is normal. The block with alias customer/account_navigation does not actually contain the customer account links.
It acts only as a container where other layout files / modules can add links.
If you use a new instance of the block this one will not contain any links.
What I suggest is to add the following code to the layout handle of your page:

<update handle="customer_account" />

This will automatically load the layout directives for the customer account, including the navigation links.
You won't even need to add any html. The block will be displayed on the left sidebar.

share|improve this answer

Hi can you try of below code

add a event

<frontend>

<events>
            <controller_action_layout_load_before>
                <observers>
                    <mymodule>
                        <class>mymodulemodel/observer</class>
                        <method>beforeLoadLayout</method>
                    </mymodule>
                </observers>
            </controller_action_layout_load_before>
         <events>
</frontend>

and observer code

 public function beforeLoadLayout($observer)
{
    $loggedIn = Mage::getSingleton('customer/session')->isLoggedIn();

    $observer->getEvent()->getLayout()->getUpdate()
       ->addHandle('customer_account');
}

And it is show in all page Where left panel is exist in layout

If you want to show

in call page then create new layout

   <customer_account_custom translate="label">
        <label>Customer My Account (All Pages)</label>
       <reference name="yourlayoutreferce">
            <block type="customer/account_navigation" name="customer_account_navigation" before="-" template="customer/account/navigation.phtml">
                <action method="addLink" translate="label" module="customer"><name>account</name><path>customer/account/</path><label>Account Dashboard</label></action>
                <action method="addLink" translate="label" module="customer"><name>account_edit</name><path>customer/account/edit/</path><label>Account Information</label></action>
                <action method="addLink" translate="label" module="customer"><name>address_book</name><path>customer/address/</path><label>Address Book</label></action>
            </block>
        </reference>
    </customer_account_custom>

and change in

observer  $observer->getEvent()->getLayout()->getUpdate()
       ->addHandle('customer_account_custom');
share|improve this answer

You can add link to your module in the same way as default reviews module does:

<customer_account>
    <!-- Mage_Review -->
    <reference name="customer_account_navigation">
        <action method="addLink" translate="label" module="review"><name>reviews</name><path>review/customer</path><label>My Product Reviews</label></action>
    </reference>
</customer_account>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.