<?php if (!isset($_SESSION)) { session_start(); } require_once './helper/Page.php'; require_once 'entities/Product.php'; require_once './entities/Cart.php'; require_once './helper/Context.php'; $p = new Product(); $ListProMostViewed = $p->loadLimit(10, 0, "View", "DESC"); $ListProNew = $p->loadLimit(10, 0, "ProCreated", "DESC"); $ListProBestSell = $p->loadLimit(10, 0, "OnOrder", "DESC"); $page = new Page(); $page->setTitle('Trang Chủ'); $page->startBody(); //SLIDE-SHOW include './slideshow.php'; ?> <!--/SLIDE-SHOW--> <form id="addToCart-form" method="post" action=""><input type="hidden" id="txtProID" name="txtProID"/></form> <!--LATEST--> <div class="latest box clearfix" id="proLatest"> <div class="box-top"> <p>Mới nhất</p> </div> <div id="proLatestBody"> <?php Product::printListProduct($ListProNew); ?>
Product::printListProduct($ListPro_Cat); ?> </div> <!--/CUNG LOAI SAN PHAM--> <!--CUNG NHA SAN XUAT--> <div class="latest box clearfix"> <div class="box-top"> <p>Cùng nhà sản xuất</p> </div> <?php $p_Bra = new Product(); $c_Bra = new Category(); $c_Bra->setBrand($c->getBrand()); $p_Bra->setCatPro($c_Bra); $ListPro_Bra = $p_Bra->loadLimit(6); Product::printListProduct($ListPro_Bra); ?> </div> <!--/CUNG NHA SAN XUAT--> <script type="text/javascript"> $(document).ready(function () { $('#product-detail button.btn-shopping-cart').on('click', function () { var proID = $(this).data('proid'); $('#txtProID').val(proID); var orderQuantity = $('#txtOrderQuantity').val(); $('#txtOrderQ').val(orderQuantity); $('#addToCart-form').submit(); }); $('button.btn-shopping-cart').on('click', function () {
$c->setDevice(new Device($devID)); require_once 'entities/Device.php'; $device = Device::getDevice($devID); $p->setCatPro($c); $flag = 2; } if (isset($_GET["BraID"]) && !empty($_GET["BraID"])) { $braID = $_GET["BraID"]; $c->setBrand(new Brand($braID)); require_once 'entities/Brand.php'; $bra = Brand::getBrand($braID); $p->setCatPro($c); $flag = 3; } if ($flag != 0) { $ListPro = $p->loadLimit($rowsPerPage, $offset, "CatProID"); $numberOfRows = $p->countRecords(); ?> <form id="addToCart-form" method="post" action=""><input type="hidden" id="txtProID" name="txtProID"/></form> <!--PRODUCTS--> <div class="box clearfix"> <ol class="breadcrumb box-top"> <li><a href="index.php"><i class="fa fa-home"></i></a></li> <?php if ($flag == 1) { echo '<li><a href="productsByCat.php?DeviceID=' . $c->getDevice()->getDeviceID() . '">' . $c->getDevice()->getDeviceName() . '</a></li>'; echo '<li class="active">' . $c->getCatName() . '</li>'; } else { if ($flag == 2) { echo '<li class="active">' . $device->getDeviceName() . '</li>'; } else {
$offset = ($curPage - 1) * $rowsPerPage; // tính offset bắt đầu load if (isset($_GET["btnSearch"])) { $Product = new Product(); $Product->setProName($_GET["txtProName"]); $Price = $_GET["txtPrice"]; $Price = explode(',', $Price); $Product->setPrice($Price); require_once './entities/Category.php'; require_once './entities/Brand.php'; require_once './entities/Device.php'; $CatPro = new Category(); $CatPro->setBrand(new Brand($_GET["cboBra"])); $CatPro->setDevice(new Device($_GET["cboDevice"])); $Product->setCatPro($CatPro); $ListPro = $Product->loadLimit($rowsPerPage, $offset, "ProName"); $numberOfRows = $Product->countRecords(); $flag = true; } ?> <div class="box clearfix"> <ol class="breadcrumb box-top"> <li><a href="index.php"><i class="fa fa-home"></i></a></li> <li class="active">Tìm Kiếm</li> </ol> <div id="searchBody"> <form action="search.php" method="get"> <div class="col-md-12 row"> <div class="form-group col-md-6"> <label for="txtProName">Tên Sản Phẩm:</label> <input type="text" class="form-control note" name="txtProName" id="txtProName">
if (isset($_POST['Status']) & !empty($_POST['Status'])) { $filterPro->setStatus($_POST['Status']); } if (isset($_POST['SortName']) & !empty($_POST['SortName'])) { $SortName = $_POST['SortName']; } if (isset($_POST['SortType']) & !empty($_POST['SortType'])) { $SortType = $_POST['SortType']; } $numberOfRows = $filterPro->countRecords(); // Số lượng dòng của bảng $ListProducts = array(); if ($rowsPerPage == -1) { // nếu là chọn hiển thị là ALL $rowsPerPage = $numberOfRows; $ListProducts = $filterPro->loadLimit($rowsPerPage, 0, $SortName, $SortType); } else { $ListProducts = $filterPro->loadLimit($rowsPerPage, $offset, $SortName, $SortType); } //tổng số trang cần hiển thị $self = $_SERVER['PHP_SELF']; // Lay dia chi truc tiep cua PHP dang mo $pagination = new Pagination($curPage, $rowsPerPage, $offset, $numberOfRows, $self); //end Paging ?> <div id="mainData"> <table class="table table-bordered"> <tbody> <?php $crypter = new Crypter("nhatanh");