2

I am working on a project where I want to display few links on left side of top bar at Home page, as shown below.

Top bar - Magento Home

To do this i created a new block with name left.top.links very similar to Magento's block top.links and modified header template and added this block before currency block, very similar to as described in the post here.

but even though i have named this block differently i.e. left.top.links when I logout Sign Up links gets added on both the blocks, top.links and left.top.links.

First place which I wanted to check was customer_logged_out handle in customer.xml, which looks completely OK to me and In fact, i could not find Sign Up link being added anywhere in Magento frontend layouts.

So, my question is, Is there any way to find out how Sign Up link is added in block? Also, what all layout handles are evaluated to render a page? Which will help me in checking on all those places.

  • please confirm the right question. – Fra Jul 1 '14 at 17:48
  • Hi @Fra, my main question was to know, If there is any alternate way to addlinks. At the same time how we can figure out what all handles are being used so that we can confirm that it is definitely layout update handle. Answer to 2nd part is already answered below. – Lalit Jul 1 '14 at 17:59
  • maybe it is better to split the question in 2 question – Fra Jul 1 '14 at 19:32
7

try this

Zend_Debug::dump($this->getLayout()->getUpdate()->getHandles());
  • 1
    this is work like a charm, it is the correct answer ! – Fra Jul 1 '14 at 17:48
  • @deepak, Thanks for this, worked well for me but even after going through all layout handles, I couldn't find any place where Sign Up link is being added. Do you know, any other place where i should look? – Lalit Jul 1 '14 at 17:49
  • sign up link is added through addLink action which can be found in customer.xml – Deepak Mallah Jul 2 '14 at 6:54
2

or better use some developer extensions like

Commerce Bug

or

Mgt Developer Toolbar

We use both of them and give you a lot of usefull information.

regards

  • @glueseppe,@marius Thanks for great share. Even after looking into these layout update handles, I can't find any sign of how Sign Up link is being added in my custom link navigation. Is there any other way to find that out? – Lalit Jul 1 '14 at 17:46
1

To list all layout handle, the approach suggested by @Deepak Mallah works fine:

Zend_Debug::dump($this->getLayout()->getUpdate()->getHandles());

Anyway I think it is not exactly clear to you what is Layout Handle is suggest to dig more on its function in layout files. ( not part of the question/answer )

Here what you are looking for

Give a look at Mage_Page_Block_Template_Links and addlink() method.

In default Magento theme the link "Sign up" is labeled "Log In", this link it is added to the block top.links in app/design/frontend/base/default/layout/customer.xml layout file using the method addlink()

<customer_logged_in>
    <reference name="top.links">
        <action method="addLink" translate="label title" module="customer">
            <label>Log Out</label>
            <url helper="customer/getLogoutUrl"/>
            <title>Log Out</title>
            <prepare/>
            <urlParams/>
            <position>100</position>
        </action>
    </reference>
</customer_logged_in>

Note:
customer_logged_in is a special layout handle that:

   <!--
    Load this update on every page when customer is logged in
    -->
  • I have checked in all these places but wasn't able to find out. Even i can't see it anywhere in layout of theme i have installed. but as you mentioned in base Magento theme Sign Up button is labeled as Login so there is good chance that i can find it in theme's code. – Lalit Jul 2 '14 at 4:52
  • search layout files for this text customer_logged_in ... if you cannot find anything it is probably added by template or code. I would also suggest to put a breakpoint in the addlink() method so you can see if it added by it – Fra Jul 2 '14 at 11:03
  • In my case it's customer_logged_out as i want to show this link when customer is logged out but I can try debugging in addlink method, that should help. :) – Lalit Jul 2 '14 at 11:16
  • Hi @Fra, I added logs in addLink method to check when Sign Up is being added in navigation and to see If i can figure out how this link is being added But to my surprise, it seems Sign Up link is Not added using addLink method in page/template_links. I can see the log for all the other navigation links but not for Sign Up. Is there any other way to add the navigation links? – Lalit Jul 5 '14 at 5:17
  • The reason why i couldn't find it in page/template_links because link was added in template file (links.phtml) for theme I was using. For people who might find same issue for Shopper theme, here is discussion thread: help.queldorei.com/discussion/comment/18537 – Lalit Jul 9 '14 at 7:13
0

For Magento 2 within phtml template files:

<?php var_dump($block->getLayout()->getUpdate()->getHandles()); ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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