$row = array(); if (!isset($_GET["categoryID"]) && !isset($_POST["categoryID"])) { $categoryID = 1; $row[0] = ADMIN_CATEGORY_ROOT; } else { //go to the root if category doesn't exist $categoryID = isset($_GET["categoryID"]) ? $_GET["categoryID"] : $_POST["categoryID"]; $q = db_query("SELECT name FROM " . CATEGORIES_TABLE . " WHERE categoryID = " . (int) $categoryID); $row = db_fetch_row($q); if (!$row) { $categoryID = 0; $row[0] = ADMIN_CATEGORY_ROOT; } } if (!isset($_GET["search"])) { $smarty->assign("products_count_category", catGetCategoryProductCount($categoryID, false)); } $smarty->assign("categoryID", $categoryID); $smarty->assign("category_name", $row[0]); $count_row = 0; $offset = 0; $products = null; if (isset($_GET["sort"])) { $callBackParam["sort"] = $_GET["sort"]; if (isset($_GET["sort_dir"])) { $callBackParam["direction"] = $_GET["sort_dir"]; } } if (!isset($_GET["search"])) { $callBackParam["categoryID"] = $categoryID; }
$products[$i]["allow_products_comparison"] = $show_comparison; } if (CONF_PRODUCT_SORT) { _sortSetting($smarty, _getUrlToSort($categoryID)); } if (CONF_SHOW_PARENCAT) { $smarty->assign("catrescur", getContentCatResc($categoryID)); } $smarty->assign("subcategories_to_be_shown", catGetSubCategoriesSingleLayer($categoryID)); $smarty->assign("categorylinkscat", getContentCat($categoryID)); //calculate a path to the category $smarty->assign("product_category_path", catCalculatePathToCategory($categoryID)); $smarty->assign("show_comparison", $show_comparison); $smarty->assign("catalog_navigator", $navigatorHtml); $smarty->assign("products_to_show", $products); $smarty->assign("products_to_show_counter", count($products)); if (isset($_GET["advanced_search_in_category"])) { $smarty->assign("products_to_showc", count($products)); } else { if ($category["show_subcategories_products"]) { $smarty->assign("products_to_showc", $category["products_count"]); } else { $smarty->assign("products_to_showc", catGetCategoryProductCount($categoryID, true)); } } } $smarty->assign("categoryID", $categoryID); $smarty->assign("categoryName", $category["name"]); $smarty->assign("main_content_template", "category.tpl"); } }