function settingCONF_DEFAULT_CUSTOMER_GROUP() { if (isset($_POST["save"])) { _setSettingOptionValue("CONF_DEFAULT_CUSTOMER_GROUP", $_POST["settingCONF_DEFAULT_CUSTOMER_GROUP"]); } $res = "<select name='settingCONF_DEFAULT_CUSTOMER_GROUP'>"; $selectedID = _getSettingOptionValue("CONF_DEFAULT_CUSTOMER_GROUP"); $res .= "<option value='0'>" . ADMIN_NOT_DEFINED . "</option>"; $custGroups = GetAllCustGroups(); foreach ($custGroups as $custGroup) { $res .= "<option value='" . $custGroup["custgroupID"] . "'"; if ($selectedID == $custGroup["custgroupID"]) { $res .= " selected "; } $res .= ">"; $res .= " " . $custGroup["custgroup_name"]; $res .= "</option>"; } $res .= "</select>"; return $res; }
if (isset($_POST["subscribed4news_submit"])) { if (CONF_BACKEND_SAFEMODE) { Redirect(ADMIN_FILE . "?dpt=custord&sub=custlist&customer_details=contact_info&customerID=" . $_GET["customerID"] . "&encodedReturnUrl=" . $_GET["encodedReturnUrl"] . "&safemode=yes"); } regSetSubscribed4news($_GET["customerID"], isset($_POST["subscribed4news"]) ? 1 : 0); } if (isset($_POST["custgroupID"])) { if (CONF_BACKEND_SAFEMODE) { Redirect(ADMIN_FILE . "?dpt=custord&sub=custlist&customer_details=contact_info&customerID=" . $_GET["customerID"] . "&encodedReturnUrl=" . $_GET["encodedReturnUrl"] . "&safemode=yes"); } regSetCustgroupID($_GET["customerID"], $_POST["custgroupID"]); } $log1 = regGetLoginById($_GET["customerID"]); $customerInfo = regGetCustomerInfo2($log1); $reg_fields_values = GetRegFieldsValues($log1); $customer_groups = GetAllCustGroups(); $smarty->assign("customer_groups", $customer_groups); $smarty->assign("reg_fields_values", $reg_fields_values); $smarty->assign("customerInfo", $customerInfo); } if ($_GET["customer_details"] == "address_book") { $log1 = regGetLoginById($_GET["customerID"]); $addresses = regGetAllAddressesByLogin($log1); for ($i = 0; $i < count($addresses); $i++) { $addresses[$i]["addressStr"] = regGetAddressStr($addresses[$i]["addressID"]); } $defaultAddressID = regGetDefaultAddressIDByLogin($log1); $smarty->assign("addresses", $addresses); $smarty->assign("defaultAddressID", $defaultAddressID); } if ($_GET["customer_details"] == "order_history") {
if (trim($_POST["new_custgroup_name"]) != "") { AddCustGroup($_POST["new_custgroup_name"], $_POST["new_custgroup_discount"], $_POST["new_sort_order"]); } // update groups $data = array(); foreach ($_POST as $key => $val) { if (strstr($key, "custgroup_name_")) { $key = str_replace("custgroup_name_", "", $key); $data[$key]["custgroup_name"] = $val; } if (strstr($key, "custgroup_discount_")) { $key = str_replace("custgroup_discount_", "", $key); $data[$key]["custgroup_discount"] = $val; } if (strstr($key, "sort_order_")) { $key = str_replace("sort_order_", "", $key); $data[$key]["sort_order"] = $val; } } foreach ($data as $key => $val) { UpdateCustGroup($key, $val["custgroup_name"], $val["custgroup_discount"], $val["sort_order"]); } Redirect(ADMIN_FILE . "?dpt=custord&sub=custgroup"); } // get all groups $custgroups = GetAllCustGroups(); $smarty->assign("custgroups", $custgroups); //set sub template $smarty->assign("admin_sub_dpt", "custord_custgroup.tpl"); } }