0
votes

Driving me nuts.

I'm replacing the top mini cart in our Magento store to just be a small shopping cart icon with a space for the number of items in cart.

Default Magento displays the word 'Cart' on the link.

I have been searching far and wide through templates, layouts, code, etc for the place where I can remove the word 'Cart'. I'm at a loss.

The code calling that chunk is located in theme/template/page/template/links.phtml:

<li<?php if($_link->getIsFirst()||$_link->getIsLast()): ?> class="<?php if($_link->getIsFirst()): ?>first<?php endif; ?><?php if($_link->getIsLast()): ?> last<?php endif; ?>"<?php endif; ?> <?php echo $_link->getLiParams() ?>><?php echo $_link->getBeforeText() ?><a href="<?php echo $_link->getUrl() ?>" title="<?php echo $_link->getTitle() ?>" <?php echo $_link->getAParams() ?>><?php echo $_link->getLabel() ?></a><?php echo $_link->getAfterText() ?></li>

Specifically: echo $_link->getLabel()

Frustration mounts. Free high fives to anyone who (unlike myself) has a clue. >:|

2
What Magento version are you using?vsushkov

2 Answers

2
votes

In Magento the 'My Cart' link is added in the checkout.xml layout file:

    <reference name="top.links">
        <block type="checkout/links" name="checkout_cart_link">
            <action method="addCartLink"></action>
            <action method="addCheckoutLink"></action>
        </block>
    </reference>

Note the addCartLink action inside checkout/links block. This xml node tells Magento to call Mage_Checkout_Block_Links::addCartLink() method.

If you need to completely remove this link, just remove <action method="addCartLink"></action> from layout. If you need to customize it, you have to override this block. If you need just to change words (f.e. not My Cart, but My Basket), use translation csv.

0
votes

Can use css to get rid of the cart label:

#cartHeader {visibility: hidden;}
#cartHeader strong, #cartHeader span {visibility:visible;}

This assumes that the element with id cartHeader is the cart (it usually is) and that the count is stored either in a span or strong element.