additional parameters in magento's customer.xml layout file

additional parameters in magento's customer.xml layout file

August 18, 2026 · Illustrated author avatarBy Stefan Bogdanescu
additional parameters in magento's customer.xml layout file

In Magento 1.4.1.1, you can customize the layout of customer links (like “My Account” or “My Cart”) using the customer.xml file located in your theme folder. This allows for greater control over how these links appear on your website’s header.

Understanding Magento Layout Files

Magento uses XML files to manage the layout and behavior of its pages. These files are organized hierarchically, with parent nodes controlling child nodes. The reference tag is used to link a block to another part of the page template, while the action tag allows you to add or modify elements within that block.

To add text to customer links in Magento, you can use the afterText parameter inside your layout XML file. This should be placed within the <action> tag for the link you want to modify.

Here’s an example of how this looks:

<default>
    <reference name="top.links">
        <action method="addLink" translate="label title" module="customer">
            <label>Your Account</label>
            <url helper="customer/getAccountUrl"/>
            <title>Your Account</title>
            <prepare/>
            <urlParams/>
            <position>10</position>
            <null />
            <aParams>rel="nofollow"</aParams>
            <afterText>click to login</afterText>
        </action>
    </reference>
</default>

In this example, the text “click to login” is added after the link labeled “Your Account”.

The Issue with the afterText Parameter

While Magento theoretically supports the afterText parameter for adding text after a link, in practice it seems to only add the text before the link rather than after. This is because the afterText parameter is actually treated as a sibling element by default.

To fix this, you need to use additional parameters that allow you to specify where exactly the text should be placed relative to the link.

Correct Implementation: Using innerText, beforeText, and afterText

The correct way to add text after a link in Magento is to use the innerText parameter together with beforeText and afterText. Here’s how you do it:

<reference name="top.links">
    <action method="addLink" translate="label title" module="customer">
        <label>Your Account</label>
        <url helper="customer/getAccountUrl"/>
        <title>Your Account</title>
        <prepare/>
        <urlParams/>
        <liParams/>
        <aParams>rel="nofollow"</aParams>
        <innerText/>
        <beforeText>yourbeforetext</beforeText>
        <afterText>youraftertext</afterText>
    </action>
</reference>

In this updated code:

  • label, url, and title are used to specify the link’s text, URL, and title.
  • prepare and urlParams are required but can be left empty.
  • liParams is a necessary container for the additional text parameters we’ll add.
  • aParams allows you to set attributes for the anchor tag (in this case, the “nofollow” attribute).
  • innerText, beforeText, and afterText allow you to specify the additional text elements relative to the link.

With this setup, any text specified in the beforeText or afterText parameters will be correctly positioned before or after the link. The innerText parameter serves as a container for these two.

Conclusion

Customizing customer links in Magento requires understanding how layout files work and which parameters to use. While the documentation might not provide clear guidance on every specific case, a combination of trial-and-error and community support can help you achieve your desired result.

Remember that Magento’s XML layout files are powerful tools for customization, but they require careful handling to avoid breaking the site’s functionality or causing unexpected behavior. Always keep backups of your original files before making any changes.

For more in-depth guides on Magento development and customization, be sure to check out our Magento tutorials at LaravelCompany.

Magento 1 Checkout Extensions Themes

Our network