Пример #1
0
             }
         }
         if ($flag_delete == "false") {
             echo "<br>***********delete id=" . $allcart_of_userid[$i][0];
             $rs = CartController::Delete($allcart_of_userid[$i][0]);
         }
     }
     for ($i = 0; $i < count($_SESSION['cart']); $i++) {
         //$str="txtQuantity1";
         $str = "txtQuantity" . $i;
         echo "<br>str quantity=" . $str;
         echo "<br>quantity=" . $_POST[$str];
         if ($_POST[$str] > 0) {
             echo "<br>************product id =" . $_SESSION["cart"][$i];
             echo "<br>************user id =" . $_SESSION["curUser"][0];
             $check = CartController::GetCartByUserIDAndProductId($_SESSION["curUser"][0], $_SESSION["cart"][$i]);
             echo "<br>************cart id =" . $check[0];
             if ($check != null) {
                 echo "<br>********amount cart of userid productid=" . $check[3];
                 //$rs=CartController::UpdateCart($_SESSION["curUser"][0],$_SESSION["cart"][$i],($check[3]+$_POST[$str]));
                 $rs = CartController::UpdateCart($_SESSION["curUser"][0], $_SESSION["cart"][$i], $_POST[$str]);
             } else {
                 $rs = CartController::AddCart($_SESSION["curUser"][0], $_SESSION["cart"][$i], $_POST[$str]);
             }
             if ($rs == null) {
                 $flag = "false";
                 echo "<br>flag=" . $flag;
             }
         }
     }
 } else {
Пример #2
0
 $productImage = ProductImageController::GetImageOfProductFromProductID($_SESSION["cart"][$i]);
 $totalmoney += $product_detail[4];
 if ($i % 2 == 0) {
     echo "<tr style='background-color: rgb(239, 239, 239);'>";
 } else {
     echo "<tr style='background-color: rgb(255, 255, 255);'>";
 }
 //Image
 echo "<td style='border-right:solid 1px #D3D3D3; padding:4px;' width='35px' align='center'><a href='' ><img  src='" . $contextPath . $productImage[1] . "'width='80px'/></a></td>";
 //productID
 echo "<td  align='center' style='border-right:solid 1px #D3D3D3; padding:4px;' width='20px'>\r\n\t\t\t\t\t\t\t  <a href='product-detail.php?productid=" . $product_detail[0] . "&type=" . $product_detail[2] . "'><b style='color:blue;'>" . $product_detail[0] . "</b></a></td>";
 //product Name
 echo "<td style='border-right:solid 1px #D3D3D3; padding:4px;'>" . $product_detail[1] . "</td>";
 //Quantity
 if (isset($_SESSION["curUser"]) && $_SESSION["curUser"][0] > 0) {
     $quantityofUser = CartController::GetCartByUserIDAndProductId($_SESSION["curUser"][0], $product_detail[0]);
     if ($quantityofUser[3] > 0) {
         echo "<td align='center' style='border-right:solid 1px #D3D3D3; padding:4px;' width='10px'>\r\n\t\t\t\t\t\t\t\t<input type='text' onkeypress='return keypress(event);' name='txtQuantity" . $i . "' id='txtQuantity" . $i . "' size='5' value='" . $quantityofUser[3] . "' /></td>";
     } else {
         echo "<td align='center' style='border-right:solid 1px #D3D3D3; padding:4px;' width='10px'>\r\n\t\t\t\t\t\t\t\t<input type='text' onkeypress='return keypress(event);' name='txtQuantity" . $i . "' id='txtQuantity" . $i . "' size='5' value='1' /></td>";
     }
 } else {
     echo "<td align='center' style='border-right:solid 1px #D3D3D3; padding:4px;' width='10px'>\r\n\t\t\t\t\t\t\t<input type='text' onkeypress='return keypress(event);' name='txtQuantity" . $i . "' id='txtQuantity" . $i . "' size='5' value='1' /></td>";
 }
 //money
 echo "<td style='border-right:solid 1px #D3D3D3;padding:4px;'>" . Utils::convert_Money($product_detail[4]) . "(VND)</td>";
 echo "<td style='border-right:solid 1px #D3D3D3; padding:4px;'>" . Utils::convert_Money($product_detail[4]) . "(VND)</td>";
 echo "<td style='border-right:solid 1px #D3D3D3; padding:4px;' width='10px' align='center'>";
 $btn = "btnDelete" . $i;
 //echo "<bt>btn=".$btn;
 echo "<input type='image' src='" . $contextPath . "template/images/delete.png'' name='" . $btn . "' id='" . $btn . "' width='15px' height='15px' value='" . $product_detail[0] . "' onclick='DeleteCart(" . $product_detail[0] . ");'/>";