//this action is forbidden when SAFE MODE is ON Redirect(_getUrlToSubmit() . '&safemode = yes'); } if (DeleteProduct($_GET['terminate'])) { Redirect(_getUrlToSubmit()); } else { Redirect(_getUrlToSubmit() . '&couldntToDelete = 1'); } } } } } if (isset($_POST['update_gc_value'])) { //update button pressed @set_time_limit(60 * 4); update_psCount(1); Redirect(ADMIN_FILE . '?dpt = catalog&sub = products_categories&categoryID = ' . (int) $_POST['categoryID']); } //calculate how many products are there in root category $q = db_query('SELECT count(*) FROM ' . PRODUCTS_TABLE . ' WHERE categoryID = 1'); $cnt = db_fetch_row($q); $smarty->assign('products_in_root_category', $cnt[0]); //show category name as a title $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);
function DeleteAllProductsOfThisCategory($categoryID) { $q = db_query("select productID from " . PRODUCTS_TABLE . " where categoryID=" . (int) $categoryID); $res = true; while ($r = db_fetch_row($q)) { if (!DeleteProduct($r["productID"], 0)) { $res = false; } } if (CONF_UPDATE_GCV == '1') { update_psCount(1); } return $res; }