Example #1
0
             if (isset($_POST["chkStatus"])) {
                 $Product->setStatus($_POST["chkStatus"]);
             } else {
                 $Product->setStatus(0);
             }
             $Product->update();
             addImageURL($Product);
             addListImages($Product);
             $update = true;
         }
     }
     $Product = new Product();
 } else {
     if (isset($_GET["ProID"]) && isset($_GET["control"])) {
         $control->setValue($_GET["control"]);
         $Product = Product::loadProductByProID($_GET["ProID"]);
         if ($Product != null) {
             if ($control == Controls::Update) {
             } else {
                 if ($control == Controls::Delete) {
                     $Product->delete();
                     $delete = true;
                     $path = '../assets/images/productImages/' . $Product->getProID();
                     if (file_exists($path)) {
                         File::removeDirectoryAllFiles($path);
                     }
                     $Product = new Product();
                 }
             }
         } else {
             require_once '../helper/Utils.php';
Example #2
0
                        <table class="table table-bordered">
                            <thead>
                            <tr>
                                <td class="text-center">Ảnh</td>
                                <td class="text-center">Tên Sản Phẩm</td>
                                <td class="text-center">Mã Sản Phẩm</td>
                                <td class="text-center">Số Lượng</td>
                                <td class="text-center">Đơn Giá</td>
                                <td class="text-center">Tổng tiền</td>
                            </tr>
                            </thead>
                            <tbody>
                            <?php 
        $total = 0;
        foreach ($arrCarts as $proID => $quantity) {
            $pro = Product::loadProductByProID($proID);
            $amount = $pro->getPrice() * $quantity;
            $srcImage = $pro->getImageURL();
            $srcImage = substr($srcImage, 1, strlen($srcImage));
            $urlPro = 'details.php?ProID=' . $pro->getProID();
            $urlCat = 'productsByCat.php?CatID=' . $pro->getCatPro()->getCatID();
            ?>
                                <tr>
                                    <td class="text-center">
                                        <a href="<?php 
            echo $urlPro;
            ?>
">
                                            <img style="width: 64px" src="<?php 
            echo $srcImage;
            ?>