Redirect(ADMIN_FILE . "?dpt=catalog&sub=extra&optionID=" . $_GET["optionID"]); } //delete extra option? if (isset($_GET["kill_option"])) { if (CONF_BACKEND_SAFEMODE) { Redirect(ADMIN_FILE . "?dpt=catalog&sub=extra&safemode=yes"); } $optionid = (int) $_GET["kill_option"]; db_query("delete from " . PRODUCT_OPTIONS_TABLE . " where optionID=" . $optionid); db_query("delete from " . PRODUCTS_OPTIONS_VALUES_VARIANTS_TABLE . " where optionID=" . $optionid); db_query("delete from " . PRODUCT_OPTIONS_VALUES_TABLE . " where optionID=" . $optionid); db_query("delete from " . PRODUCTS_OPTIONS_SET_TABLE . " where optionID=" . $optionid); db_query("delete from " . CATEGORY_PRODUCT_OPTIONS_TABLE . " where optionID=" . $optionid); Redirect(ADMIN_FILE . "?dpt=catalog&sub=extra"); } if (!isset($_GET["optionID"])) { //now select all available product options $options = optGetOptions(); $smarty->assign("options", $options); } else { $option = optGetOptionById((int) $_GET["optionID"]); $values = optGetOptionValues((int) $_GET["optionID"]); $smarty->assign("optionID", (int) $_GET["optionID"]); $smarty->assign("values", $values); $smarty->assign("option_name", $option["name"]); $smarty->assign("value_count", count($values)); } //set sub-department template $smarty->assign("admin_sub_dpt", "catalog_extra.tpl"); } }
function _getOptions() { $options = optGetOptions(); for ($i = 0; $i < count($options); $i++) { if (isset($_GET["categoryID"])) { $res = schOptionIsSetToSearch($_GET["categoryID"], $options[$i]["optionID"]); } else { $res = array("isSet" => true, "set_arbitrarily" => 1); } if ($res["isSet"]) { $options[$i]["isSet"] = true; $options[$i]["set_arbitrarily"] = $res["set_arbitrarily"]; } else { $options[$i]["isSet"] = false; $options[$i]["set_arbitrarily"] = 1; } $options[$i]["variants"] = optGetOptionValues($options[$i]["optionID"]); for ($j = 0; $j < count($options[$i]["variants"]); $j++) { $isSet = false; if (isset($_GET["categoryID"])) { $isSet = schVariantIsSetToSearch($_GET["categoryID"], $options[$i]["optionID"], $options[$i]["variants"][$j]["variantID"]); } $options[$i]["variants"][$j]["isSet"] = $isSet; } } return $options; }