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('*/*'));
}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/
No comments:
Post a Comment