mam taki oto problem
plik add_cart.php dostaje dane:
i teraz sprawdzam czy taki produkt istnieje w tablicy:
if (isset($_SESSION['cart'][$productId]) && $_SESSION['cart'][$productId]['numer_wymiaru']==$numer_wymiaru ) { $amount=$_SESSION['cart'][$productId]['amount']; $amount=$amount+$ilosc; $_SESSION['cart'][$productId]['amount']=$amount;
i to nie wiem czy jest dobrze bo nie wiem czy z plikiem viev_cart.php jest zwalone czy tutaj
i teraz dla else
else{ ( 'id'=>"$productId", 'numer_wymiaru'=>"$numer_wymiaru", 'amount'=>"$ilosc" ); $_SESSION['cart'][$productId] = $productInfo; // header('Location: index.php?v=cart'); }
nie działa i nie wiem co. Potrzebuje sprawdzic czy produkt o id i numerze wymiarow istnieje. czy ten kod jest ok ?
bo w pliku view_cart.php
$cart = $_SESSION['cart']; else{ echo"<table width=\"670\" border=\"0\"> <tr height=\"40\" bgcolor=\"#433C3C\"> <td width=\"50\" align=\"center\">Nr Kat</td> <td align=\"center\">Nazwa</td> <td width=\"90\" align=\"center\">Cena</td> <td width=\"60\" align=\"center\">Ilość</td> <td width=\"90\" align=\"center\">Razem</td> <td width=\"60\" align=\"center\">Usuń</td> "; $total=0; foreach($cart as $product){ $id=$product['id'];
nadpisuje jesli dam inny numer wymiaru w show_product.php