Search code examples
magento-1.8magento-layout-xml

add icon instead of label in link


I'd written this code:

<action method="addLink" translate="label title" module="checkout">
    <label>Cart</label>
    <url helper="checkout/url/getCartUrl"/>
    <title>Cart</title>
    <prepare/>
    <urlParams/>
    <position>150</position>
</action>

But instead of the label Cart I want to show an image. How could I add image in the above xml code?


Solution

  • <action method="addLink" translate="label title" module="checkout">
        <label>Cart</label>
        <url helper="checkout/url/getCartUrl"/>
        <title>Cart</title>
        <prepare/>
        <urlParams/>
        <position>150</position>
        <liParams />
        <aParams><![CDATA[ class="cart"]]></aParams>
    </action>
    

    This should add a class cart to the <a> element. You can add your css on that class that hides the text and displays an icon.