Magento – how to add icon instead of text in magento top links My Account My Wishlist My Cart Checkout Log In

magento-1.9toplinks

i'm working with Magento ver. 1.9.0.1 and magento boilerplate theme. i want to change the top link text with icons.but unable to find the file.

Here is the code inside my app/code/core/Mage/Checkout/Block/links.php

public function addCartLink()
    {
        $parentBlock = $this->getParentBlock();
        if ($parentBlock && Mage::helper('core')->isModuleOutputEnabled('Mage_Checkout')) {
            $count = $this->getSummaryQty() ? $this->getSummaryQty()
                : $this->helper('checkout/cart')->getSummaryCount();
            if ($count == 1) {
                $text = $this->__('My Cart (%s item)', $count);
            } elseif ($count > 0) {
                $text = $this->__('My Cart (%s items)', $count);
            } else {
                $text = $this->__('My Cart');
            }

            $parentBlock->removeLinkByUrl($this->getUrl('checkout/cart'));
            $parentBlock->addLink($text, 'checkout/cart', $text, true, array(), 50, null, 'class="top-link-cart"');
        }
        return $this;
    }

Best Answer

As you can see in this line

$parentBlock->addLink($text, 'checkout/cart', $text, true, array(), 50, null, 'class="top-link-cart"');

the class name top-link-cart is added to the cart link.
Do your magic via css. It should be the easiest way to do it.
I'm not much of a css expert (not even close) but I think you can hook on this class and set a background image, hide the text, give it a width and height and problem solved.