Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Truncate Cart
 
Julio Vedovatto
Member
 
Total Posts:  33
Joined:  2008-06-18
 

Hello people

I made this function to clear/truncate/empty (all the items added) of “My Cart” section in magento:

/**
     * Truncate Cart
     * @author Julio Vedovatto <juliovedovatto@gmail.com>
     * @version 20081125
     */
    public function clearAction() {
        $cart 
$this->_getCart();
        
$cart->truncate();
        
$cart->save();
        
$this->_getSession()->setCartWasUpdated(true);
    
$this->_redirectReferer(Mage::getUrl('*/*'));
    
}

I put this function in core/Mage/Checkout/controllers/CartController.php and works fine when I request “http://mystore/cart/clear”.

But I want to know how I create a Overwriting for this case, I dont understand how to do it right.

Any help?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top