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/checkout/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