コード例 #1
0
 public function addcommandLine($idCommand, $panier)
 {
     $flag = true;
     $article = new Application_Model_Sell();
     foreach ($panier as $idProduct => $qte) {
         $price = $article->getArticle($idProduct, array());
         try {
             $data = array('id_command' => $idCommand, 'id_sell' => $idProduct, 'quantity' => $qte, 'price' => $price[0]['price']);
             $this->insert($data);
             $QtTotal = $article->getArticle($idProduct, array());
             $val = $QtTotal[0]['quantity'] - $qte;
             $article->updateQuantitySell($val, $idProduct);
         } catch (Exception $ex) {
             echo 'ERROR_INSERT_ADDCOMMANDLINE : ' . $ex->getMessage();
             return false;
         }
     }
     return $flag;
 }