</script>
        </head>
        <body class="body" >
 <?php 
include_once 'header.php';
?>
                <div id="contain" class="contain contain box-transparent">
       	<?php 
if (isset($_REQUEST['productid']) && $_REQUEST['productid'] != null) {
    include_once $contextPath . "controller/ProductController.php";
    include_once $contextPath . "controller/CommentController.php";
    include_once $contextPath . "controller/ProductImageController.php";
    include_once $contextPath . "controller/UserController.php";
    $productid = $_REQUEST['productid'];
    $product_detail = ProductController::GetProductByID($_REQUEST['productid']);
    $productImage = ProductImageController::GetImageOfProductFromProductID($productid);
    $productComment = CommentController::GetCommentFromProductID($productid);
    $_SESSION["addCart"] = "true";
} else {
    Utils::redirect("product-list.php");
}
?>
  
	<?php 
require_once 'left-menu.php';
?>
                  
<div >
	<div class="product-detail-picture">
		<div id="image_wrap" >
			<div href='<?php 
Example #2
0
            }
        }
    }
    //echo "<br>count session cart2=".count($_SESSION["cart"]);
}
//end check
if (count($_SESSION["cart"]) > 0) {
    include_once $contextPath . "controller/ProductController.php";
    include_once $contextPath . "controller/ProductImageController.php";
    include_once $contextPath . "controller/CartController.php";
    include_once $contextPath . "utility/Utils.php";
    $totalmoney = 0;
    echo "<form action='" . $contextPath . "controller/AddCartProcessor.php' method='post' id='frmCheckOut' name='frmCheckOut'>";
    for ($i = 0; $i < count($_SESSION["cart"]); $i++) {
        $product_detail = ProductController::GetProductByID($_SESSION["cart"][$i]);
        $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]);
		$("#msgResult").fadeOut(300);
		$("#dvImgResult").fadeOut(300);
	}

	function show_image(src) {
		$("#imgResult").attr('src',src);
		$("#dvImgResult").fadeIn(300);
	}
</script>
<div id="wrapper">
<div id="content">
<div id="box">
		<h3 id="adduser">PRODUCT</h3>
		<!--<form id="form" action="" method="post">-->
		<?php 
$image = ProductImageController::GetImageOfProductFromProductID($_REQUEST['proId']);
?>
			<fieldset id="personal">
				<legend>
					EDIT IMAGE TO PRODUCT
				</legend
				<label >Cover_Img : </label>
				<a href="#" onclick="show_image('<?php 
echo "../../" . $image['Cover_Img'];
?>
');"><?php 
echo $image['Cover_Img'];
?>
 </a>
				<img src="img/icons/user_delete.png"	style="cursor:pointer;"	onclick="deleteImg('Cover_Img',<?php 
echo $_REQUEST["proId"];
            include_once "../../../controller/ProductController.php";
            require_once "../utils/product_util.php";
            $id = $_REQUEST["id"];
            $result = ProductController::Delete($id);
            if ($result) {
                echo ProductUtil::createMessageBox("DELETE PRODUCT", "Delete completed!");
            } else {
                echo ProductUtil::createMessageBox("DELETE PRODUCT", "Delete does not complete!");
            }
        } else {
            if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "deleteImage") {
                include_once "../../../controller/ProductImageController.php";
                require_once "../utils/product_util.php";
                $id = $_REQUEST["proId"];
                $imgType = $_REQUEST["imgType"];
                $img = ProductImageController::GetImageOfProductFromProductID($id);
                $result = ProductImageController::Update($id, $imgType, "");
                $result = true;
                if ($result) {
                    if (unlink("../../../" . $img[$imgType])) {
                        echo ProductUtil::createMessageBox("DELETE IMAGE", "Delete completed!");
                        return;
                    }
                }
                echo ProductUtil::createMessageBox("DELETE IMAGE", "Delete does not complete!");
            }
        }
    }
}
if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "search") {
    $name = $_REQUEST["name"];