designersvsoft
designersvsoft

Reputation: 1859

magento top link changes

I am new to Magento. I have downloaded a theme in Magento and trying to change the top links. I couldn't track the files. How do i change the toplinks in Magento theme.

enter image description here

Upvotes: 1

Views: 9966

Answers (17)

Abhinav Kumar Singh
Abhinav Kumar Singh

Reputation: 2325

If you want to know the file loacation then you can use magento default template path hint feature. Check given below URL.

http://excellencemagentoblog.com/blog/2011/09/07/magento-template-path-hints-magento/

Upvotes: 0

user44599
user44599

Reputation: 1

if you remove / change specific link than goto specific file like if you want to change my account link than goto yourtheme->layout->customer.xml if not exist than goto base->layout->customer.xml

find <reference name="top.links"> remove / update.

Upvotes: 0

user6649803
user6649803

Reputation:

you can modify it by edit reference name="top.links" block in following .xml files

  1. app/design/frontend/Your_theme/default/layout/checkout.xml

  2. app/design/frontend/Your_theme/default/layout/customer.xml

Check this following post

For information please visit this URL :-https://www.templatemonster.com/help/magento-how-to-edit-header-links-2.html#gref

Upvotes: 1

Arun
Arun

Reputation: 11

you can on you template path and change accordingly in this file :- System > Configuration > Developer > Template Path Hints 'YES' also you will get the block information as well

Upvotes: 0

Sangeeta Jain
Sangeeta Jain

Reputation: 26

No code is needed for this.

Go to System - Configuration - General - Design - Header and change "Welcome Text"

Upvotes: 0

Filthy_Rich
Filthy_Rich

Reputation: 665

Template hints is your best friend in this situation. If you are using the terminal, run:

n98-magerun.phar dev:template-hints

Then select whichever store view you are currently using and press enter. If you aren't overly comfortable with the terminal you can also activate them in the admin:

System > Configuration > Developer > Template Path Hints 'YES'

NOTE: Ensure you are on the right 'Current Configuration Scope'. You can amend this if necessary in the drop-down located in the top-left hand corner.

Then refresh the front-end, copy the file path and search for your file. Bingo.

Upvotes: 0

Deep Zalavadiya
Deep Zalavadiya

Reputation: 581

Top Links includes: Login/Logout, My Account, My Wishlist, My Cart and Checkout links. One of the most important differences between top links and regular static links is that when you add products to the cart or to your wishlist, top links automatically records products which were added. Example of Top links in the default Magento theme in the header. Usage of Top links in Magento Edit header links in Magento is easy. At first we have to call the block.

<?php echo $this->getChildHtml('topLinks'); ?>

in template template/page/html/header.phtml, but creates in page.xml

<block type="page/html_header" name="header" as="header">
    <block type="page/template_links" name="top.links" as="topLinks"/>
    <block type="core/text_list" name="top.menu" as="topMenu"/>
</block>

Now we need to add links to this block by using the command:

<action method="addLink" translate="label title" >...</action>

We make it in the following XML files:
Login/Logout, My Account – customer.xml
My Cart and Checkout – checkout.xml
My Wishlist – wishlist.xml

It should be noted that link to My Cart calls by the command:

<action method="addCartLink"></action>
<action method="addCheckoutLink"></action>

If you want to change Magento toplinks you need to know that all top links are based on a template which is located here: page/template/links.phtml. Here you can add additional classes or commit needed changes.

Often people want to use separate links. For example Login/Logout and My Account should be on the left side and My Wishlist, My Cart and Checkout on the right side.

Something like on the example below It is very easy to do:

Open page.xml and create another block there, almost identical to "topLinks" but with name "topLinksLeft";

<block type="page/html_header" name="header" as="header">
    <block type="page/switch" name="store_language" as="store_language" template="page/switch/languages.phtml"/>
    <block type="core/text_list" name="top.menu" as="topMenu"/>
    <block type="page/template_links" name="top.links" as="topLinks"/>
    <block type="page/template_links" name="top.links.left" as="topLinksLeft"/>
</block>

In template template/page/html/header.phtml with help of the command:

<?php echo $this->getChildHtml('topLinksLeft'); ?>

we can call our block in the proper place

<div>
    <h1 id="logo" title="<?php echo $this->getLogoAlt() ?>" style="background-image:url(<?php echo $this->getLogoSrc() ?>);"><a href="<?php echo $this->getUrl('') ?>"><?php echo $this->getLogoAlt() ?></a></h1>
    <div><?php echo $this->getChildHtml('topLinksLeft') ?></div>
    <?php echo $this->getChildHtml('topLinks') ?>
    <?php echo $this->getChildHtml('topMenu') ?>
</div>

When you have done this, open customer.xml where we have to change the name of the block which is responsible for Login/Logout, My Account. We are changing its name from "top.links" on "top.links.left" as in example:

<customer_logged_in>
    <reference name="top.links.left">
        <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="top.links.left">
        <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>

We also can assign other template to the links on the left ( rather useful in some cases) For that we just have to duplicate template "page/template/links.phtml" and call it links_left.phtml. So now we have 2 templates "links.phtml" for the right side and "links_left.phtml" for the left side. Now all we need to do is just connect it. For connection we use block «topLinksLeft» page.xml and change it to links_left.phtml.

<block type="page/html_header" name="header" as="header">
    <block type="page/template_links" name="top.links" as="topLinks"/>
    <block type="page/template_links" name="top.links.left" as="topLinksLeft" template="page/template/links_left.phtml"/>
</block>

Now you can apply different styles and HTML for the left and the right side.

Wow, almost forgot about "Register" button which is usually located near the "Login/Logout" button. No worries about that as well. As you can already guess we start from customer. xml file where we do next, if we want to add “Register” button to the top links:

<customer_logged_out>
    <reference name="top.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>register</label>
            <url helper="customer/getRegisterUrl"/>
            <title>register</title>
            <prepare/>
            <urlParams/>
            <position>10</position>
        </action>
    </reference>
</customer_logged_out>

So now you can change Magento toplinks: for example, add Register button to your header or even remove Login from top links if you want.

Upvotes: 3

Mani Singh
Mani Singh

Reputation: 107

app\design\frontend\{namespace}\{yourtheme}\template\page

here you can find your header.phtml, footer.phtml and body layout

Upvotes: 2

Prashant Kumar Singh
Prashant Kumar Singh

Reputation: 61

step1:Login into magento admin
step2:go to catalog
step3:go to manage categories
step4:their is top links of theme in this then you can edit that links

Upvotes: -1

Shamim Ahmed
Shamim Ahmed

Reputation: 931

You need to edit two files…

  1. app/design/frontend/default/default/layout/checkout.xml
  2. app/design/frontend/default/default/layout/customer.xml

You will see in these files that the links are being added as name="top.links" - simply you need to comment them out using comment tags

hope this will help you.

Thanks

Upvotes: 5

Rahul bodara
Rahul bodara

Reputation: 21

Top link mostly come from .phtml file but we have suggest to you best way for the remove this .XML file. In XML file search "top.links" text & this text assign on reference name so this all the link you can remove from .XML file(layout file)

Example:

<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>

Upvotes: 2

Avik Roy
Avik Roy

Reputation: 149

Please create local.xml under theme folder then try to remove top link by url key. Please paste the below code in local.xml.

<default>
  <reference name="top.links"> 
    <action method="removeLinkByUrl">
      <url helper="checkout/url/getCartUrl" />
    </action> 
  </reference>
</default>

Thanks.

Upvotes: 2

Vishnu Bhadoriya
Vishnu Bhadoriya

Reputation: 1676

enable developer mode from magento admin panel

got system->configuration from admin

then last menu from left sidebar choose your Current Configuration Scope: and ADVANCED->DEVELOPER->DEBUG->Template Path Hints to yes

then goto to frontend that will show you all templates paths follow the template path given and change whatever you want

and don't forgot to disable developer mode

Upvotes: 1

Swapna Taru
Swapna Taru

Reputation: 688

Using template path hints you can easily find your template path files. Login to admin pannel and under

  • System -> Configuration
  • Change the “Configuration Scope” to “Default Store View” (or whichever store view you want to see template paths on)
  • Under Advanced in the left menu click Developer
  • Click “Debug” to expand that section
  • Change “Template Path Hints” to "Yes"
  • Click Save Configuration

Now, all you have to do is refresh the front-end of your store once to see the template paths showing in red color. This template path hints will let you know which block is responsible for displaying a particular section.

Don't forget to hide the template path when you are done edititing.

Upvotes: 0

Jatinder Bhambri
Jatinder Bhambri

Reputation: 36

No need to change any source code.

Step 1: Login to the admin panel.

Step 2: Go to Catalog > Manage Categories from top navigation

Step 3: Click on 'Add subcategory'

Step 4: Go to 'Display Settings' tab, set 'Display Mode' select box value to 'Static Block only' (Create the static block under CMS > Static Block)

Step 5: Save the category with required fields.

Upvotes: 0

Steven Zurek
Steven Zurek

Reputation: 525

It's hard to answer your question as some themes tend to move files around and do wacky things. Try toggling template hints, this will show you where the template that is being rendered lives with in the file system.

http://help.sweettoothrewards.com/article/434-how-do-i-turn-on-template-path-hints

"Layout XML" is probably going to be the "Magento Way" to insert links into that block and the block to reference will be top.links.

A cursory google search yielded a somewhat dated but still relevant article on doing exactly what you want to do.

http://excellencemagentoblog.com/blog/2011/09/07/magento-add-top-links-in-magento/

Be careful about how you are extending and modifying your theme and the base Magento themes. You can end up creating a lot of extra work for the next developer.

I would encourage you to study up on the Magento Theme Rollback system before you make to many modifications.

Upvotes: 0

Sylvain Ray&#233;
Sylvain Ray&#233;

Reputation: 2466

You have to be a little bit like Sherlock Holmes. The top links are generated thanks to a block that you can find in the layout file page.xml of your theme. Then search the block name "topLinks" in the header block (in the default theme, it's the name) and you will find <block type="page/template_links" name="top.links" as="topLinks"/>. This block topLinks is generated thanks to the block class Mage_Page_Block_Template_Links. The important method in this block is public function addLink(...), it means that you will have to search into the xml layout the following element/tag <action method='addLink'>...</action>.

An example for the customer module, in the file customer.xml of the layout folder:

    <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>

You should find more than one xml element which uses this kind of method. Pay attention, the addLink method can also be called programmatically (into PHP code), not only in layout file.

Hope it helps

Upvotes: 3

Related Questions