public function actionIndex() { $product_count_main_page = FL::fileGetContents('product_count_main_page.txt'); $product_count_catalog_page = FL::fileGetContents('product_count_catalog_page.txt'); $product_count_category_page = FL::fileGetContents('product_count_category_page.txt'); if (isset($_POST['submit'])) { if (isset($_POST['productCountMainPage'])) { $productCountMainPage = FL::clearInt($_POST['productCountMainPage']); AdminModel::filePutContents(ROOT . '/config/product_count_main_page.txt', $productCountMainPage); } if (isset($_POST['productCountCatalogPage'])) { $productCountCatalogPage = FL::clearInt($_POST['productCountCatalogPage']); AdminModel::filePutContents(ROOT . '/config/product_count_catalog_page.txt', $productCountCatalogPage); } if (isset($_POST['productCountCategoryPage'])) { $productCountCategoryPage = FL::clearInt($_POST['productCountCategoryPage']); AdminModel::filePutContents(ROOT . '/config/product_count_category_page.txt', $productCountCategoryPage); } FL::redirectTo('/admin/view'); } $view = new View(); $view->product_count_main_page = $product_count_main_page; $view->product_count_catalog_page = $product_count_catalog_page; $view->product_count_category_page = $product_count_category_page; $view->display('admin_view/index.php'); return true; }
public function actionIndex() { $showProducts = FL::fileGetContents('product_count_main_page.txt'); if (!$showProducts) { $showProducts = 6; } $categories = CategoryModel::getAllUsingColumns(); $products = ProductModel::getAllUsingColumns(true, $showProducts); $recommended = ProductModel::getAllByColumn('is_recommended', '1'); $view = new View(); $view->categories = $categories; $view->products = $products; $view->recommended = $recommended; $view->display('site/index.php'); return true; }
public function actionCategory($categoryId, $page = 1) { $limit = FL::fileGetContents('product_count_category_page.txt'); if (!$limit) { $limit = 9; } $page = (int) $page; $categories = CategoryModel::getAllUsingColumns(); $products = ProductModel::getByCategoryId($categoryId, $limit, $page); if (!$products) { $products = []; } $total = ProductModel::getTotal('category_id', $categoryId); $pagination = FL::buildPagination($total, $page, $limit, 'page-'); $view = new View(); $view->categories = $categories; $view->products = $products; $view->categoryId = $categoryId; if (isset($pagination)) { $view->pagination = $pagination; } $view->display('catalog/category.php'); return true; }