Magento Forum

Duplicating top.Links in the footer
 
pixelwarior
Jr. Member
 
Total Posts:  8
Joined:  2009-01-30
 

I am trying to have a copy of top.Links (from the header) in the footer. ie My Account, My Wishlist etc

I’ve found

<block type="page/template_links" name="top.links" as="topLinks"/>
in page.phtml
And I have tried copying this into the footer. I know this isn’t the correct way to go about it but the links DID appear in the footer, but the ones in the header disappeared!

I’ve tried just about everything, from adding the code manually through xml (I don’t really know the syntax) to hardcoding it into footer.phtml

But the problem with hardcoding is that once the user logs in, “Log In” doesn’t automatically become “Log Out”.

Can someone point me in the right direction please?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Siim
Jr. Member
 
Total Posts:  6
Joined:  2008-09-18
 

I know this isn’t the correct way to go about it but the links DID appear in the footer, but the ones in the header disappeared!

Try to change the name attribute:

From:

<block type="page/template_links" name="top.links" as="topLinks"/>

To

<block type="page/template_links" name="myCoolFooterLinks" as="topLinks"/>
 
Magento Community Magento Community
Magento Community
Magento Community
 
pixelwarior
Jr. Member
 
Total Posts:  8
Joined:  2009-01-30
 

I just tried, but no luck, when I renamed the name to something else, nothing would happen, top links remained.
So I guess top.links means something somewhere else in another file so I’ve done a file search and found a “top.links.phtml” within app\design\frontend\*\*\template\page\html

I duplicated that, renamed it “bottom.links.phtml” and changed the name of the xml tag inside page.xml accordingly… And it didn’t work.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Siim
Jr. Member
 
Total Posts:  6
Joined:  2008-09-18
 

Hi again.

Old post deleted. Edited at 20:10 2009-01-30

Open app/design/frontend/default/default/layout/page.xml

paste

<block type="page/template_links" name="bottom.links" template="page/template/links.phtml" />

into footer section, so it should look like this:

<block type="page/html_footer" name="footer" as="footer" template="page/html/footer.phtml">
    <
block type="page/switch" name="store_switcher" as="store_switcher" template="page/switch/stores.phtml"/>
    <
block type="page/template_links" name="footer_links" as="footer_links" template="page/template/links.phtml"/>
    <
block type="page/template_links" name="bottom.links" template="page/template/links.phtml" />
</
block>

Now edit app/design/frontend/default/default/layout/customer.xml

paste the following xml into <default></default> section:

<reference name="bottom.links">
            <
action method="addLink" translate="label title" module="customer">
                  <
label>Log In</label>
                  <
url helper="customer/getLoginUrl"/>
                  <
title>Log In</title>
                  <
prepare/>
                  <
urlParams/>
                  <
position>100</position>
            </
action>
            
            <
action method="addLink" translate="label title" module="customer">
                  <
label>My account</label>
                  <
url helper="customer/getAccountUrl"/>
                  <
title>Log In</title>
                  <
prepare/>
                  <
urlParams/>
                  <
position>200</position>
            </
action>
            
        </
reference>

Result:

<layout version="0.1.0">

<!--
Default 
layoutloads most of the pages
-->

    <default>
        <!-- 
Mage_Customer -->
        <
reference name="top.links">
            <
action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>10</position></action>
        </
reference>
        
        
        <
reference name="bottom.links">
            <
action method="addLink" translate="label title" module="customer">
                  <
label>Log In</label>
                  <
url helper="customer/getLoginUrl"/>
                  <
title>Log In</title>
                  <
prepare/>
                  <
urlParams/>
                  <
position>100</position>
            </
action>
            
            <
action method="addLink" translate="label title" module="customer">
                  <
label>My account</label>
                  <
url helper="customer/getAccountUrl"/>
                  <
title>Log In</title>
                  <
prepare/>
                  <
urlParams/>
                  <
position>200</position>
            </
action>
        </
reference>
    </default>

    ....

</
layout>

Here we added two links to this footer section: My account and Log in.

Good luck!

Siim

 
Magento Community Magento Community
Magento Community
Magento Community
 
pixelwarior
Jr. Member
 
Total Posts:  8
Joined:  2009-01-30
 

Thanks for your great help! It worked great!

But one more thing I couldn’t figure out was that why getLogingUrl, getLogoutUrl, getAccountUrl all works, but ones like getWishlistUrl does not.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top