I'm trying to add My Compare List link to top links near the My Wishlist.
Where is its' template?
I looked lots of files but i couldnt find it.


You should be looking in layout XML. There are a couple of blocks (and templates) involved in that area of the display.

From ./app/design/frontend/base/default/layout/page.xml:

    <block type="page/html_header" name="header" as="header">
        <block type="page/template_links" name="top.links" as="topLinks"/>
        <!-- snip... -->

This is where the "space" for these links is created. Other modules use this space as necessary to add links or blocks which contain links. For example, from ./app/design/frontend/base/default/layout/customer.xml...

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

...and from ./app/design/frontend/base/default/layout/wishlist.xml...

    <reference name="top.links">
        <block type="wishlist/links" name="wishlist_link" />
        <action method="addLinkBlock"><blockName>wishlist_link</blockName></action>
    <!-- snip... -->

You will probably want to create a link for viewing compare following the example of the customer module:

    <reference name="top.links">
        <action method="addLink" translate="label title" module="catalog">
            <label>Compare Products</label>
            <url helper="catalog/product_compare/getListUrl"/> <!-- @see Mage_Catalog_Helper_Product_Compare::getListUrl() */
            <title>Compare Products</title>
            <position>10</position> <!-- adjust as needed -->
                if you want to use the standard behavior, you will need a custom
                helper which returns the popwin() js string and feeds it to the
                "onclick" node below:
                <onclick helper="your_module/getPopwinStuff"/>

Keep in mind that this is normally viewed in a popup and so may require additional styling to have the look and feel you want.

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.