} } if (!cartCheckMinOrderAmount()) { Redirect("index.php?shopping_cart=yes"); } if (isset($_POST["continue_button"])) { RedirectProtected("index.php?order4_confirmation=yes&" . "shippingAddressID=" . $_GET["shippingAddressID"] . "&" . "shippingMethodID=" . $_GET["shippingMethodID"] . "&" . "billingAddressID=" . $_GET["billingAddressID"] . "&" . "paymentMethodID=" . $_POST["select_payment_method"] . (isset($_GET['shServiceID']) ? "&shServiceID=" . $_GET['shServiceID'] : '')); } if (isset($_GET["selectedNewAddressID"])) { RedirectProtected("index.php?order3_billing=yes&" . "shippingAddressID=" . $_GET["shippingAddressID"] . "&" . "shippingMethodID=" . $_GET["shippingMethodID"] . "&" . "billingAddressID=" . $_GET["selectedNewAddressID"] . (isset($_GET['shServiceID']) ? "&shServiceID=" . $_GET['shServiceID'] : '')); } $moduleFiles = GetFilesInDirectory("core/modules/payment", "php"); foreach ($moduleFiles as $fileName) { include $fileName; } $payment_methods = payGetAllPaymentMethods(true); $payment_methodsToShow = array(); foreach ($payment_methods as $payment_method) { if ($_GET["shippingMethodID"] == 0) { $shippingMethodsToAllow = true; } else { $shippingMethodsToAllow = false; foreach ($payment_method["ShippingMethodsToAllow"] as $ShippingMethod) { if ((int) $_GET["shippingMethodID"] == (int) $ShippingMethod["SID"] && $ShippingMethod["allow"]) { $shippingMethodsToAllow = true; break; } } } if ($shippingMethodsToAllow) { $payment_methodsToShow[] = $payment_method;
if (isset($_POST["save_payment"])) { if (CONF_BACKEND_SAFEMODE) { Redirect(ADMIN_FILE . "?dpt=conf&sub=payment&safemode=yes"); } $values = ScanPostVariableWithId(array("Enabled", "name", "description", "email_comments_text", "module", "sort_order", "calculate_tax")); foreach ($values as $PID => $value) { payUpdatePaymentMethod($PID, $value["name"], $value["description"], isset($value["Enabled"]) ? 1 : 0, (int) $value["sort_order"], $value["module"], $value["email_comments_text"], isset($value["calculate_tax"]) ? 1 : 0); payResetPaymentShippingMethods($PID); foreach ($shipping_methods as $shipping_method) { if (isset($_POST["ShippingMethodsToAllow_" . $PID . "_" . $shipping_method["SID"]])) { paySetPaymentShippingMethod($PID, $shipping_method["SID"]); } } } if (trim($_POST["new_name"]) != "") { $PID = payAddPaymentMethod($_POST["new_name"], $_POST["new_description"], isset($_POST["new_Enabled"]) ? 1 : 0, (int) $_POST["new_sort_order"], $_POST["new_email_comments_text"], $_POST["new_module"], isset($_POST["new_calculate_tax"]) ? 1 : 0); foreach ($shipping_methods as $shipping_method) { if (isset($_POST["new_ShippingMethodsToAllow_" . $shipping_method["SID"]])) { paySetPaymentShippingMethod($PID, $shipping_method["SID"]); } } } Redirect(ADMIN_FILE . "?dpt=conf&sub=payment&save_successful=yes"); } $smarty->assign("payment_types", payGetAllPaymentMethods()); $smarty->assign("payment_modules", modGetAllInstalledModuleObjs(PAYMENT_MODULE)); $smarty->assign("shipping_methods", $shipping_methods); //set sub-department template $smarty->assign("admin_sub_dpt", "conf_payment.tpl"); } }