avatar
TrangEdit

Guest 1.7K 10th Apr, 2021

WebAssembly 6.32 KB
<?php
    require_once("entities/product.class.php");
    require_once("entities/category.class.php");
?>
<?php
    include_once("header.php");

    if(!isset($_GET["id"])){
        header('Location: not_found.php');
    }else{
        $id = $_GET["id"];
        $temp_prod = Product::get_product($id);
        $prod = reset($temp_prod);
        $prods_relate = Product::list_product_relate($prod["CateID"], $id);
    }
    $cates = Category::list_category();

?>
<style>
table {

    width: 60%;

    border: 0px solid;
}
.center {
  margin-left: auto;
  margin-right: auto;
}
.textnor{
    padding: 10px 0 10px 0;
    font-family: tahoma;
    font-size: 18px;
}
.textnorbold{
    padding: 10px 0 10px 0;
    font-weight: bold;
}
.productname{
    font-size: 24px;
    color: #770000;
}
.price{
    color: #770000;
}

div.scrollmenu {
  background-color: #F8F8FF;
  overflow: auto;
  white-space: nowrap;
}

div.scrollmenu a {
  display: inline-block;
  color: white;
  text-align: center;
  padding: 10px;
  text-decoration: none;
}

div.scrollmenu a:hover {
  background-color: #777;
}
.lqname{
    padding-left: 20px;
    font-family: tahoma;
    font-size: 18px;
    font-weight: bolder;
}
</style>
<main>
<div class="container">
<!-- Danh mục sản phẩm -->
    <div class="row tm-gallery">

        <div id="tm-gallery-page-pizza" class="tm-gallery-page">
            <h2 class="col-12 text-center tm-section-title" style="padding-top:20px;"><b>Danh mục sản phẩm</b></h2>
            <div class="col-12 text-center tm-section-title">
                <ul>
                    <?php
                        foreach($cates as $item){
                        echo "<li class='tm-btn tm-btn-default' style='text-align: center;'>
                        <a href=/Lab03/list_product.php?cateid=".$item["CateID"]." class='textlist-custom'> ".$item["CategoryName"]." </a></li>";
                        }
                    ?>
                </ul>
            </div>
        </div>
    </div>
    <hr style="width: 80%;"/><br />
    <h2 class="col-12 text-center tm-section-title"><b>Thông tin sản phẩm</b></h2>
    <table class="center">
        <tr>
            <td><img src="<?php echo "/Lab03/".$prod["Picture"];?>" alt="Image"></td>
            <td>
                <div class="textnor textnorbold productname"><?php echo $prod["ProductName"]; ?></div><br />
                <div class="textnor textnorbold">Mô tả sản phẩm </div>
                <div class="textnor"><?php echo $prod["Description"]; ?></div><br />
                <label class="textnor textnorbold">Giá :</label> <label class="textnor price"><?php echo number_format($prod["Price"]) ?> VNĐ</label><br />
                <input type="button" class="tm-btn tm-btn-primary" style="margin-top: 15px;" onclick=" location.href='/lab03/shopping_cart.php?id=<?php echo $prod['ProductID']; ?>'" value="Mua hàng" />
                <input type="button" class="tm-btn tm-btn-primary" style="margin-top: 15px;" onclick=" location.href='/lab03/edit_product.php?id=<?php echo $prod['ProductID']; ?>'" value="Sửa" />
                <input type="button" class="tm-btn tm-btn-primary" style="margin-top: 15px;" onclick=" location.href='/lab03/delete_product.php?id=<?php echo $prod['ProductID']; ?>'" value="Xóa" />

            </td>
        </tr>
    </table><br />

    <hr style="width: 80%"/><br />
    <h2 class="col-12 text-center tm-section-title"><b>Sản phẩm liên quan</b></h2>
    <div class="scrollmenu">
            <table class="center">
                <tr>

                    <?php
                        foreach($prods_relate as $item){
                    ?>
                    <td>
                    <table class="center">
                        <tr>
                            <td>
                                <a href="/Lab03/product_detail.php?id=<?php echo $item["ProductID"]; ?>">
                                <img src="<?php echo "/Lab03/".$item["Picture"];?>" alt="Image">
                                </a>
                            </td>
                        </tr>
                        <tr>
                            <td><div class="lqname"><?php echo $item["ProductName"]; ?></div><br /></td>
                        </tr>
                        <tr>
                            <td><label class="lqname">Giá :</label> <label class="textnor price"><?php echo number_format($item["Price"]) ?> VNĐ</label><br /></td>
                        </tr>
                    </table>
                    </td>

          <?php } ?>
                </tr>
            </table>
            </div>
                <br />
                <br />

</div>
</main>
<?php include_once("footer.php"); ?>
WebAssembly
Description

No description

To share this paste please copy this url and send to your friends
RAW Paste Data