Exemplo n.º 1
0
 public function delete($cartElement)
 {
     $stockroomhelper = new rsstockroomhelper();
     $session = JFactory::getSession();
     $cart = $session->get('cart');
     if (array_key_exists($cartElement, $cart)) {
         $stockroomhelper->deleteCartAfterEmpty($cart[$cartElement]['product_id']);
         unset($cart[$cartElement]);
         $cart = array_merge(array(), $cart);
         $Index = $cart['idx'] - 1;
         if ($Index > 0) {
             $cart['idx'] = $Index;
         } else {
             $cart = array();
             $cart['idx'] = 0;
         }
     }
     $session->set('cart', $cart);
 }