Hello,
i would like to suggest you adding a delete all function into cart model or adding a simple line of code like this
function delete($number_id){
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onBeforeDeleteProductInCart', array(&$number_id, &$this) );
unset($this->products[$number_id]);
// Simple delete all when passing all parameter
if($_GET['all'])
unset($this->products);
$this->loadPriceAndCountProducts();
$this->reloadRabatValue();
$this->saveToSession();
$dispatcher->trigger('onAfterDeleteProductInCart', array(&$number_id, &$this) );
}
OR whole function
function deleteAll()
{
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onBeforeDeleteProductInCart', array(&$number_id, &$this) );
unset($this->products);
$this->loadPriceAndCountProducts();
$this->reloadRabatValue();
$this->saveToSession();
$dispatcher->trigger('onAfterDeleteProductInCart', array(&$number_id, &$this) );
}
Thanks for reading.