function after_processing_html($orderID) { $res = ''; $order = ordGetOrder($orderID); $order_amount = roundf(PaymentModule::_convertCurrency($order['order_amount'], 0, $this->_getSettingValue('CONF_CHRONOPAY_CURCODE'))); $currency = currGetCurrencyByID($this->_getSettingValue('CONF_CHRONOPAY_CURCODE')); $zone_iso2 = $order['billing_state']; $countries = cnGetCountries(array('offset' => 0, 'CountRowOnPage' => 1000000), $count_row); foreach ($countries as $country) { if ($country['country_name'] == $order['billing_country']) { $country_iso3 = $country['country_iso_3']; $zones = znGetZones($country['countryID']); foreach ($zones as $zone) { if ($zone['zone_name'] == $zone_iso2) { $zone_iso2 = $zone['zone_code']; break; } } break; } } $post_1 = array('product_id' => $this->_getSettingValue('CONF_CHRONOPAY_PRODUCT_ID'), 'product_name' => CONF_SHOP_NAME, 'product_price' => $order_amount, 'product_price_currency' => $currency['currency_iso_3'], 'f_name' => $order['billing_firstname'], 's_name' => $order['billing_lastname'], 'street' => $order['billing_address'], 'city' => $order['billing_city'], 'state' => $zone_iso2, 'country' => $country_iso3, 'email' => $order['customer_email'], 'cb_url' => getTransactionResultURL('success'), 'cb_type' => 'P', 'decline_url' => getTransactionResultURL('failure')); $hidden_fields_html = ''; reset($post_1); while (list($k, $v) = each($post_1)) { $hidden_fields_html .= '<input type="hidden" name="' . $k . '" value="' . $v . '" />' . "\n"; } $res = ' <form method="post" action="' . xHtmlSpecialChars($this->processing_url) . '" style="text-align:center;"> ' . $hidden_fields_html . ' <input type="submit" value="' . CHRONOPAY_TXT_SUBMIT . '" /> </form> '; return $res; }
function setting_COUNTRY_SELECT($_ShowButton, $_SettingID = null) { if (!isset($_SettingID)) { $_SettingID = $_ShowButton; $_ShowButton = false; } $Options = array(array("title" => STR_ANY_COUNTRY, "value" => 0)); $CountriesNum = 0; $Countries = cnGetCountries(array('raw data' => true), $CountriesNum); foreach ($Countries as $_Country) { $Options[] = array("title" => $_Country['country_name'], "value" => $_Country['countryID']); } return '<nobr>' . setting_SELECT_BOX($Options, $_SettingID) . ($_ShowButton ? ' <input type="submit" name="save" value="' . SELECT_BUTTON . '" />' : '') . '</nobr>'; }
$error = regVerifyAddress($first_name, $last_name, $countryID, $zoneID, $state, $city, $address); if ($error == "") { unset($error); } else { $smarty->assign("error", $error); } if (!isset($error)) { //regTransformAddressToSafeForm( // &$first_name, &$last_name, // &$countryID, &$zoneID, &$state, // &$city, &$address ); if (isset($add_new_address)) { regAddAddress($first_name, $last_name, $countryID, $zoneID, $state, $city, $address, $_SESSION["log"], $errorCode); Redirect("index.php?address_book=yes"); } else { if (isset($address_editor)) { regUpdateAddress($address_editor, $first_name, $last_name, $countryID, $zoneID, $state, $city, $address, $errorCode); Redirect("index.php?address_book=yes"); } } } } else { if (isset($_POST["first_name"])) { $smarty->assign("select_zone_statement", ERROR_ZONE_DOES_NOT_CONTAIN_TO_COUNTRY); } } $callBackParam = null; $count_row = 0; $smarty->assign("countries", cnGetCountries($callBackParam, $count_row)); $smarty->assign("main_content_template", "address_editor.tpl"); }
if (CONF_ENABLE_REGCONFIRMATION && (isset($order) || isset($order_without_billing_address))) { xSaveData('xREGMAILCONF_URLORDER2', $RedirectURL); $RedirectURL = "index.php?act_customer=1&order2=yes"; } RedirectJavaScript($RedirectURL); } else { $smarty->assign("reg_error", ERROR_INPUT_STATE); } } else { $smarty->assign("reg_error", $error); } } // countries $callBackParam = array(); $count_row = 0; $countries = cnGetCountries($callBackParam, $count_row); $smarty->assign("countries", $countries); if (!$isPost) { if (count($countries) != 0) { $zones = znGetZonesById(CONF_DEFAULT_COUNTRY); $smarty->assign("zones", $zones); //var_dump($zones); $smarty->assign("billingZones", $zones); } } else { if (count($countries) != 0) { $zones = znGetZonesById((int) $_POST["countryID"]); $smarty->assign("zones", $zones); //var_dump($zones); $smarty->assign("billingZones", $zones); }
function setting_COUNTRY_SELECT($_ShowButton, $_SettingID = null) { if (!isset($_SettingID)) { $_SettingID = $_ShowButton; $_ShowButton = false; } $Options = array(array("title" => '-', "value" => 0)); $CountriesNum = 0; $Countries = cnGetCountries(array('raw data' => true), $CountriesNum); foreach ($Countries as $_Country) { $Options[] = array("title" => $_Country['country_name'], "value" => $_Country['countryID']); } return '<nobr>' . setting_SELECT_BOX($Options, $_SettingID) . ($_ShowButton ? ' <input type="button" name="save55" onclick="document.getElementById(\'save\').name=\'save\';document.getElementById(\'formmodule\').submit(); return false" value=" ' . SELECT_BUTTON . ' " style="font-size: 11px; font-family: Tahoma, Arial; border: 1px solid #80A2D9; background-color: #E1ECFD;" />' : '') . '</nobr>'; }
function settingCONF_BYCOUNTRY_BYZONE_PERCENT_FORM() { $curr_country = isset($_POST["shipping_module_bycountry_byzone_country"]) ? $_POST["shipping_module_bycountry_byzone_country"] : 0; $curr_country = (int) $curr_country; if (!$curr_country) { $curr_country = xGetData('SXshipping_module_bycountry_byzone_countryPERC'); } xSaveData('SXshipping_module_bycountry_byzone_countryPERC', $curr_country); $module_id = isset($_GET['setting_up']) ? $_GET['setting_up'] : 0; $ModuleConfig = modGetModuleConfig($module_id); if (!$ModuleConfig['ModuleClassName']) { $module_id = 0; } if (isset($_POST["save"])) { $radiotoggle = isset($_POST["shipping_module_bycountry_byzone_radiotoggle"]) ? $_POST["shipping_module_bycountry_byzone_radiotoggle"] : 0; if ($radiotoggle == 0) { $rate = (double) $_POST["shipping_module_bycountry_byzone_zone_rate_0"]; $sql = ' DELETE FROM ' . CSHIPPINGMODULEBYCOUNTRYBYZONEPERCENT_TABLE . ' WHERE module_id="' . $module_id . '" AND countryID=' . $curr_country . ' and zoneID=0 '; db_query($sql); $sql = ' INSERT INTO ' . CSHIPPINGMODULEBYCOUNTRYBYZONEPERCENT_TABLE . ' (module_id, countryID, zoneID, shipping_rate) VALUES (' . $module_id . ', ' . $curr_country . ', 0, ' . $rate . ') '; db_query($sql); } else { $sql = ' DELETE FROM ' . CSHIPPINGMODULEBYCOUNTRYBYZONEPERCENT_TABLE . ' WHERE module_id="' . $module_id . '" AND countryID=' . $curr_country . ' '; db_query($sql); foreach ($_POST as $key => $val) { if (strstr($key, "shipping_module_bycountry_byzone_zone_rate_")) { $zone = (int) str_replace("shipping_module_bycountry_byzone_zone_rate_", "", $key); $rate = (double) $val; if ($zone > 0 && $rate != 0) { $sql = ' INSERT INTO ' . CSHIPPINGMODULEBYCOUNTRYBYZONEPERCENT_TABLE . ' (module_id, countryID, zoneID, shipping_rate) VALUES (' . $module_id . ', ' . $curr_country . ', ' . $zone . ', ' . $rate . ') '; db_query($sql); } } } } } $res = "<table border=0>\n<tr>\n<td>" . CSHIPPINGMODULEBYCOUNTRYBYZONEPERCENT_TXT_1 . "</td>\n"; $countries_count = 0; $countries = cnGetCountries(null, $countries_count); $res .= "<td><select name='shipping_module_bycountry_byzone_country'>\n"; $res .= "<option value='0'>" . ADMIN_NOT_DEFINED . "</option>\n"; foreach ($countries as $country) { $res .= "<option value='" . $country["countryID"] . "' "; if ($curr_country == $country["countryID"]) { $res .= " selected "; } $res .= ">"; $res .= $country["country_name"]; $res .= "</option>\n"; } $res .= "</select></td>"; $res .= "<td><input type=submit name=shipping_module_bycountry_byzone_change_country value=\"" . CSHIPPINGMODULEBYCOUNTRYBYZONEPERCENT_TXT_2 . "\"></td>\n"; $res .= "</tr>\n"; //show toggle + zones if ($curr_country > 0) { $zones = znGetZonesById($curr_country); //toggle $res .= "<tr><td colspan=3><hr size=1></td></tr>\n"; $res .= "<tr><td colspan=3>\n"; $sql = ' SELECT shipping_rate FROM ' . CSHIPPINGMODULEBYCOUNTRYBYZONEPERCENT_TABLE . ' WHERE module_id="' . $module_id . '" AND countryID=' . $curr_country . ' and zoneID=0 '; $q = db_query($sql); $row = db_fetch_row($q); if ($row || count($zones) == 0) { $radiotoggle = 0; //fixed for this country $rate = (double) $row[0]; } else { $radiotoggle = 1; //by zone definition $rate = 0; } $res .= "<table border=0><tr><td valign=top>\n<input type=radio name=shipping_module_bycountry_byzone_radiotoggle value=0"; if ($radiotoggle == 0) { $res .= " checked"; } $res .= " onclick='JavaScript:shipping_module_bycountry_byzone_toogleClickHandler();'></td>\n"; $res .= "<td valign=top>" . CSHIPPINGMODULEBYCOUNTRYBYZONEPERCENT_TXT_7 . "</td>\n"; $res .= "<td><input type=text name=shipping_module_bycountry_byzone_zone_rate_0 value=\"{$rate}\">" . CSHIPPINGMODULEBYCOUNTRYBYZONEPERCENT_TXT_3 . "</td></tr>\n"; $res .= "<tr><td valign=top>\n<input type=radio name=shipping_module_bycountry_byzone_radiotoggle value=1"; if ($radiotoggle == 1) { $res .= " checked"; } $res .= " onclick='JavaScript:shipping_module_bycountry_byzone_toogleClickHandler();'></td>\n"; $res .= "<td colspan=2>" . CSHIPPINGMODULEBYCOUNTRYBYZONEPERCENT_TXT_4 . "\n"; //zones if (count($zones) > 0) { $res .= "<p><table>\n"; foreach ($zones as $zone) { $zoneID = (int) $zone["zoneID"]; $sql = ' SELECT shipping_rate FROM ' . CSHIPPINGMODULEBYCOUNTRYBYZONEPERCENT_TABLE . ' WHERE module_id="' . $module_id . '" AND countryID=' . $curr_country . ' and zoneID=' . $zoneID . ' '; $q = db_query($sql); $row = db_fetch_row($q); $zone_shipping_rate = (double) $row[0]; $res .= "<tr><td>" . $zone["zone_name"] . ":</td>"; $res .= "<td><input type=text name=shipping_module_bycountry_byzone_zone_rate_" . $zoneID . " value='" . $zone_shipping_rate . "'>" . CSHIPPINGMODULEBYCOUNTRYBYZONEPERCENT_TXT_5 . "</td></tr>"; } $res .= "</table>\n"; } else { $res .= "<p>< " . CSHIPPINGMODULEBYCOUNTRYBYZONEPERCENT_TXT_6 . " >"; } $res .= "</td></tr></table>\n"; $res .= "</td></tr>\n"; } $res .= "</table>"; //javascript code if ($curr_country > 0) { $res .= "\n <script language='JavaScript'>\n function shipping_module_bycountry_byzone_toogleClickHandler()\n {\n\n if ( document.shipping_method_form.shipping_module_bycountry_byzone_radiotoggle[0].checked )\n {\n document.shipping_method_form.shipping_module_bycountry_byzone_zone_rate_0.disabled = false;\n " . _create_JS_zones_handlers_bycountryzone_percent($zones, "true") . "\n }\n else if ( document.shipping_method_form.shipping_module_bycountry_byzone_radiotoggle[1].checked )\n {\n document.shipping_method_form.shipping_module_bycountry_byzone_zone_rate_0.disabled = true;\n " . _create_JS_zones_handlers_bycountryzone_percent($zones, "false") . "\n }\n }\n\n shipping_module_bycountry_byzone_toogleClickHandler();\n </script>\n "; } return $res; }
$code = $_POST["new_zone_code"]; $countryID = $_GET["countryID"]; if ($name != "") { znAddZone($name, $code, $countryID); } // update zones list $data = ScanPostVariableWithId(array("zone_name", "zone_code")); foreach ($data as $key => $val) { znUpdateZone($key, $data[$key]["zone_name"], $data[$key]["zone_code"], $countryID); } Redirect(ADMIN_FILE . "?dpt=conf&sub=zones&countryID=" . $_GET["countryID"]); } //if country is not selected, select the first country from the database if (!isset($_GET["countryID"])) { $q = db_query("select countryID from " . COUNTRIES_TABLE); $row = db_fetch_row($q); Redirect(ADMIN_FILE . "?dpt=conf&sub=zones&countryID=" . $row[0]); } $callBackParam = null; $count_row = 0; $navigatorParams = null; $countries = cnGetCountries($callBackParam, $count_row, $navigatorParams); $smarty->assign("countries", $countries); $zones = znGetZones($_GET["countryID"]); $smarty->assign("zones", $zones); $smarty->assign("zones_count", count($zones)); $smarty->assign("countryID", $_GET["countryID"]); //set sub-department template $smarty->assign("admin_sub_dpt", "conf_zones.tpl"); } }