コード例 #1
0
ファイル: MyIndex.php プロジェクト: asandi01/phpLitsTest
 function setNewProduct($data)
 {
     $obj = $this->listPasillo;
     $gPas = isset($_GET['pas']) ? $_GET['pas'] : $data['pasillo'];
     $listPasillo = $obj->offsetGet($gPas);
     $list = $listPasillo->getTypeProducts();
     $gType = isset($_GET['type']) ? $_GET['type'] : $data['type'];
     $listProducts = $list->offsetGet($gType);
     $listProds = $listProducts->getListProduct();
     $gProds = isset($_GET['prods']) ? $_GET['prods'] : $data['prods'];
     $listProduct = $listProds->offsetGet($gProds);
     $listProd = $listProduct->getListProducts();
     if (isset($_GET['del'])) {
         $listProd->offsetUnset($_GET['del']);
     } else {
         $producto = new Producto();
         $producto->setProduct($data['product']);
         $producto->setIdProduct($data['idPoduct']);
         $listProd->push($producto);
     }
     $_SESSION['listPasillo'] = serialize($obj);
     header("location: " . $_SERVER['HTTP_REFERER'] . " ");
 }
コード例 #2
0
 private function getListProduct($cont, $line, $item)
 {
     $listProduct = new SplDoublyLinkedList();
     for ($iProd = 0; $iProd < $cont; $iProd++) {
         $product = new Producto();
         $product->setProduct("Producto " . $item . ($iProd + 1));
         $product->setIdProduct("000" . $line . $item . ($iProd + 1));
         $listProduct->push($product);
     }
     return $listProduct;
 }