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 { echo '<li class="active">' . $bra->getBraName() . '</li>';
// 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"> </div>
if (isset($_POST['InStock']) & !empty($_POST['InStock'])) { $filterPro->setInStock($_POST['InStock']); } if (isset($_POST['CatProID']) & !empty($_POST['CatProID'])) { $filterPro->setCatPro(new Category($_POST['CatProID'])); } 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 ?>