I have add a function in the app\code\core\Mage\Checkout\controllers\CartController.php
if you call this it will delete all item in the cart.
the url should be http://www.yoursite.com/index.php/checkout/cart/deleteall/
if you call this it will delete all item in the cart.
the url should be http://www.yoursite.com/index.php/checkout/cart/deleteall/
public function deleteallAction()
{
$cartHelper = Mage::helper('checkout/cart');
$items = $cartHelper->getCart()->getItems();
foreach ($items as $item)
{
$itemId = $item->getItemId();
$cartHelper->getCart()->removeItem($itemId)->save();
}
$this->_redirectReferer(Mage::getUrl('*/*'));
}
No comments:
Post a Comment