Magento Forum

   
Page 1 of 3
How do I remove the “My Cart” and “Checkout” Toplinks? 
 
winzippy
Sr. Member
 
Avatar
Total Posts:  101
Joined:  2008-02-08
Rochester, NY, USA
 

I could use CSS, but I need them to be disabled completely in PHP. It’s too bad Magento doesn’t have a built in “Where the hell is it” section like in Zen Cart.

UPDATE:
Yes, I am aware that removing <?=$this->getChildHtml('topRightLinks')?> from header.phtml gets rid of them. However, I want to keep the “My Wishlist” link. *sigh*

 
Magento Community Magento Community
Magento Community
Magento Community
 
winzippy
Sr. Member
 
Avatar
Total Posts:  101
Joined:  2008-02-08
Rochester, NY, USA
 

Thanks for helping. I’ve seen you post to other threads, and you seem to know what you’re doing (more than me, anyway).

That’s the first thing I tried. I even tried deleting the lines outright. For some reason, “Checkout” and “My Cart” still show up.

 
Magento Community Magento Community
Magento Community
Magento Community
 
iblastoff
Sr. Member
 
Total Posts:  252
Joined:  2007-08-31
 

try disabling/clearing your system cache in magento

 
Magento Community Magento Community
Magento Community
Magento Community
 
iblastoff
Sr. Member
 
Total Posts:  252
Joined:  2007-08-31
 

edit:nm

 
Magento Community Magento Community
Magento Community
Magento Community
 
winzippy
Sr. Member
 
Avatar
Total Posts:  101
Joined:  2008-02-08
Rochester, NY, USA
 

Yeah, I was out having a cig with my boss and I mentioned that to him.It’s worth a shot.

 
Magento Community Magento Community
Magento Community
Magento Community
 
winzippy
Sr. Member
 
Avatar
Total Posts:  101
Joined:  2008-02-08
Rochester, NY, USA
 

Grrrr… It works. Sort of. It takes out Wishist anyway.

 
Magento Community Magento Community
Magento Community
Magento Community
 
iblastoff
Sr. Member
 
Total Posts:  252
Joined:  2007-08-31
 

if you only want to take out wishlist, you can look at wishlist.xml. i have absolutely no idea how to remove ONLY “my cart” though. doesnt seem to make sense to me. if i get rid of <action method="addCartLink"></action>, it just gets rid of my cart AND wishlist. i can’t add wishlist back in at all.

 
Magento Community Magento Community
Magento Community
Magento Community
 
NueBe
Member
 
Total Posts:  65
Joined:  2007-09-30
Tres Cantos - Madrid - Spain
 

Set in the CSS

.top-link-cart, .top-link-checkout {display:none}

 
Magento Community Magento Community
Magento Community
Magento Community
 
medic
Sr. Member
 
Total Posts:  173
Joined:  2007-10-30
Sydney
 

I have the same problem!

When you comment out below:

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

            <
block type="checkout/links" name="checkout_link">
                <
action method="addCheckoutLink"></action>
            </
block>
        </
reference

..the wishlist disapears. I can’t find out why the wishlist would disapear?

Glad more than one person has the same problem smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
iblastoff
Sr. Member
 
Total Posts:  252
Joined:  2007-08-31
 

that is a bug.

open app/code/core/Mage/Page/Block/Html/Toplinks.php

at around line 89, replace this:

if (is_numeric($position)) {
            $toplinks 
= array();
            foreach (
$this->_toplinks as $i=>$link{
            
if ($position==$i{
                $toplinks[] 
$toplinkInfo;
                
}
                $toplinks[] 
$link;
            
}
            $this
->_toplinks $toplinks;
        
else {
            $this
->_toplinks[] $toplinkInfo;
        
}
        
return $this;

with this:

if (is_numeric($position)) {
            array_splice
($this->_toplinks$position0, array($toplinkInfo));
        
else {
            $this
->_toplinks[] $toplinkInfo;
        
}
        
return $this;

 
Magento Community Magento Community
Magento Community
Magento Community
 
winzippy
Sr. Member
 
Avatar
Total Posts:  101
Joined:  2008-02-08
Rochester, NY, USA
 

Thanks a bundle Iblastoff. That did the trick.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Bill007
Sr. Member
 
Avatar
Total Posts:  179
Joined:  2008-01-15
New Zealand
 

I blast off can you post this Top links Tutorial here

http://www.magentocommerce.com/boards/viewthread/2756/

Kind regards Bill007

 
Magento Community Magento Community
Magento Community
Magento Community
 
toddh
Jr. Member
 
Total Posts:  3
Joined:  2008-11-28
 

I’ve been struggling to do what was being discussed, removing the “My Cart” and “Checkout” top links.  The client I’m setting this up for is not going to be selling the products on their site, only displaying them.  I tried all the methods described here to the best of my ability, but it was simply not working.  So I experimented.  Finally, I was able to get it to work and I wanted to share what I did in case it might save someone else days of frustrating trial and error, which is what I went through.

I know this may not be the best or ideal way to do it, but I just needed to make it work and this seems to have done it.

I edited this file:

app/code/core/Mage/Checkout/Block/Links.php

I left the functions, but commented out everything within the curly brackets of the functions.  Here is the code when I was done with it (everything below the standard Magento comments at the top):

class Mage_Checkout_Block_Links extends Mage_Core_Block_Template
{
    
/**
     * Add shopping cart link to parent block
     *
     * @return Mage_Checkout_Block_Links
     */
    
public function addCartLink()
    

//        if ($parentBlock = $this->getParentBlock()) {
//            $count = $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->addLink($text, 'checkout/cart', $text, true, array(), 50, null, 'class="top-link-cart"');
//        }
//        return $this;
//    
    
}

    
/**
     * Add link on checkout page to parent block
     *
     * @return Mage_Checkout_Block_Links
     */
    
public function addCheckoutLink()
    
{
//        if (!$this->helper('checkout')->canOnepageCheckout()) {
//            return $this;
//        }
//        if ($parentBlock = $this->getParentBlock()) {
//            $text = $this->__('Checkout');
//            $parentBlock->addLink($text, 'checkout', $text, true, array(), 60, null, 'class="top-link-checkout"');
//        }
//        return $this;
    
}
}

 
Magento Community Magento Community
Magento Community
Magento Community
 
lotusseedsD
Mentor
 
Avatar
Total Posts:  1144
Joined:  2007-08-31
 

Hi toddh, no need to hack the core code. Just go to checkout.xml, and remove this:

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

You can comment it out as Ohiminu suggested. I simply remove the code if I don’t need it.

Remember to refresh your caches in the admin > cache management.

 
Magento Community Magento Community
Magento Community
Magento Community
 
toddh
Jr. Member
 
Total Posts:  3
Joined:  2008-11-28
 

I tried that first, but it didn’t work.  Looks like it was a cache issue.  Thanks for the quick reply!

I removed the lines you said and now the links are gone, which is exactly what I wanted.

I also need to remove the “My Cart” and “Compare Products” boxes on the right column.  What would be the best way to do this?

Thanks,
Todd

 
Magento Community Magento Community
Magento Community
Magento Community
 
toddh
Jr. Member
 
Total Posts:  3
Joined:  2008-11-28
 

Ok, I just found a way to do this, but I’d still like to hear whether this is the best way to do it.

To remove the “Compare Products” box, I edited the /layout/catalog.xml file and commented out this section:

<reference name="right">
            <
block type="core/template" before="cart_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/>
            <
block type="core/template" name="right.permanent.callout" template="callouts/right_col.phtml"/>
        </
reference>

And to remove the “My Cart” box, I edited the layout/checkout.xml file and commented out this section:

<reference name="right">
            <
block type="checkout/cart_sidebar" name="cart_sidebar" template="checkout/cart/sidebar.phtml" before="-">
                <
action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/sidebar/default.phtml</template></action>
                <
action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/sidebar/default.phtml</template></action>
                <
action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/sidebar/default.phtml</template></action>
            </
block>
        </
reference>

Thanks,
Todd

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
Page 1 of 3