if (empty($error)) { } } } $insert = null; $update = null; $delete = null; $control = new Controls(Controls::Insert); $ListCategories = Category::loadAll(); $Product = new Product(); if (isset($_POST["btnSave"])) { if (isset($_POST["txtControl"])) { $control->setValue($_POST["txtControl"]); } if (isset($_POST["txtProID"])) { $Product->setProID($_POST["txtProID"]); } if (isset($_POST["txtProName"])) { $Product->setProName($_POST["txtProName"]); } if (isset($_POST["txtImageURL_Old"])) { $Product->setImageURL($_POST["txtImageURL_Old"]); } if (isset($_POST["txtProPrice"])) { $fProPrice = str_replace(',', '', $_POST["txtProPrice"]); $Product->setPrice($fProPrice); } if (isset($_POST["txtProQuantity"])) { $fProQuantity = str_replace(',', '', $_POST["txtProQuantity"]); $Product->setInStock($fProQuantity); }
if (isset($_POST['page']) && !empty($_POST['page'])) { $curPage = $_POST['page']; //truyền thứ tự trang cần xem } if (isset($_POST['show']) && !empty($_POST['show'])) { $rowsPerPage = $_POST['show']; //truyền số record cần hiển thịs } $offset = ($curPage - 1) * $rowsPerPage; // tính offset bắt đầu load //filter $SortName = ""; $SortType = "ASC"; $filterPro = new Product(); if (isset($_POST['ProID']) & !empty($_POST['ProID'])) { $filterPro->setProID($_POST['ProID']); } if (isset($_POST['ProName']) & !empty($_POST['ProName'])) { $filterPro->setProName($_POST['ProName']); } if (isset($_POST['Price']) & !empty($_POST['Price'])) { $filterPro->setPrice($_POST['Price']); } 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']);