1

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

3

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:

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

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

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

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

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

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

<default>
    <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>
            <prepare/>
            <urlParams/>
            <position>10</position> <!-- adjust as needed -->
            <liParams/>
            <!--
                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:
            <aParams>
                <onclick helper="your_module/getPopwinStuff"/>
            </aParams>
            -->
        </action>
    </reference>
</default>

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.