예제 #1
0
파일: ApiCart.php 프로젝트: pers1307/cart
 /**
  * Удаление товара из корзины
  */
 public function removeAction()
 {
     if (!isset($_POST['id']) || !isset($_POST['type'])) {
         $this->errorAction(1001, 'Custom system error', ['postArgument' => 'noPostArgument']);
     }
     $id = getInt($_POST['id']);
     $type = htmlspecialchars(trim($_POST['type']));
     if (empty($id)) {
         $this->errorAction(1001);
     }
     $cart = new ModelCart();
     $cart->remove($id, $type);
     $summ = $cart->getCostItems();
     $count = $cart->getCountItems();
     $this->addData(['succes' => 'Ok', 'count' => $count, 'summ' => $summ]);
     $this->successAction();
 }