function after_payment_php($orderID, $OutSum, $SignatureValue, $flag) { $res = ''; $order = ordGetOrder($orderID); if ($this->_getSettingValue('CONF_ROBOXCHANGE_SHOPCURRENCY') > 0) { $exhange_curr = currGetCurrencyByID($this->_getSettingValue('CONF_ROBOXCHANGE_SHOPCURRENCY')); $exhange_rate = $exhange_curr["currency_value"]; $exhange_round = $exhange_curr["roundval"]; } else { $exhange_rate = 1; $exhange_round = 2; } if ((double) $exhange_rate == 0) { $exhange_rate = 1; } $order_amount = _formatPrice(roundf($order["order_amount"] * $exhange_rate), $exhange_round, ".", ""); if ($flag == "result") { $mrh_pass = $this->_getSettingValue('CONF_ROBOXCHANGE_MERCHANTPASS2'); } else { $mrh_pass = $this->_getSettingValue('CONF_ROBOXCHANGE_MERCHANTPASS1'); } $OutSum_x = _formatPrice($OutSum, $exhange_round, ".", ""); $my_crc = strtoupper(md5($OutSum . ":" . $orderID . ":" . $mrh_pass)); if ($order_amount > 0 && $my_crc == strtoupper($SignatureValue) && $OutSum_x == $order_amount) { ostSetOrderStatusToOrder($order["orderID"], $this->_getSettingValue('CONF_ROBOXCHANGE_STATUS_AFTER_PAY')); $res = "OK" . $orderID; } return $res; }
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 after_processing_html($orderID) { $res = ''; $order = ordGetOrder($orderID); $order_amount = roundf(PaymentModule::_convertCurrency($order['order_amount'], 0, $this->_getSettingValue('CONF_YANDEXCPP_TRANSCURRENCY'))); $post_1 = array('TargetCurrency' => $this->_getSettingValue('CONF_YANDEXCPP_TARGETCURRENCY'), 'currencyID' => $this->_getSettingValue('CONF_YANDEXCPP_TARGETCURRENCY'), 'wbp_InactivityPeriod' => '2', 'wbp_ShopAddress' => 'wn1.paycash.ru:8828', 'wbp_ShopEncryptionKey' => 'hAAAEicBAHV6wr3pySqE3thhKHbjvyf4XCMxKc2nSj2u8K46i0dMIP8Wd2KJHkZuhGMWZGmYAp6wsb3XqZW5HKVpamQt+t9rwGNsSaVfeZb9DM5aodCpIMHhLA8gGPDIiG4+Q15X/7Zm3MJNGavZ8+eWAnlvS1M7c6eeLTNJ0CKIYd1yHXfU', 'wbp_ShopKeyID' => '4060341894', 'wbp_Version' => '1.0', 'wbp_CorrespondentID' => '8994748E663DE6B3C68D2D9931B079C74789D4B4', 'BankID' => $this->_getSettingValue('CONF_YANDEXCPP_BANKID'), 'TargetBankID' => $this->_getSettingValue('CONF_YANDEXCPP_TARGETBANKID'), 'PaymentTypeCD' => 'PC', 'ShopID' => $this->_getSettingValue('CONF_YANDEXCPP_SHOPID'), 'CustomerNumber' => $orderID, 'Sum' => $order_amount, 'CustName' => $order['shipping_firstname'] . ' ' . $order['shipping_lastname'], 'CustAddr' => '', 'CustEMail' => $order['customer_email'], 'OrderDetails' => ''); $order_content = ordGetOrderContent($orderID); foreach ($order_content as $item) { $post_1['OrderDetails'] .= $item['name'] . "\r\n"; } $implAddress = array('shipping_country', 'shipping_state', 'shipping_city', 'shipping_address'); foreach ($implAddress as $k) { if ($order[$k]) { $post_1['CustAddr'] .= ', ' . $order[$k]; } } $post_1['CustAddr'] = substr($post_1['CustAddr'], 1); $hidden_fields_html = ''; reset($post_1); while (list($k, $v) = each($post_1)) { $hidden_fields_html .= '<input type="hidden" name="' . $k . '" value="' . $v . '" />' . "\n"; } $processing_url = $this->_getSettingValue('CONF_YANDEXCPP_MODE') == 'test' ? 'http://demomoney.yandex.ru/select-wallet.xml' : 'http://money.yandex.ru/select-wallet.xml'; $res = ' <form method="post" action="' . xHtmlSpecialChars($processing_url) . '" style="text-align:center;" id="payform"> ' . $hidden_fields_html . ' </form><table cellspacing="0" cellpadding="0" class="fsttab"><tr><td><table cellspacing="0" cellpadding="0" class="sectb"><tr><td><a href="#" onclick="document.getElementById(\'payform\').submit(); return false">' . STRING_PAY_NOW . '</a></td></tr></table></td></tr></table>'; return $res; }
function after_payment_php($orderID, $params) { $res = ''; $order = ordGetOrder($orderID); $skey = $this->_getSettingValue('CONF_ZP_MERCHANT_KEY'); $merch_bd = strtoupper($this->_getSettingValue('CONF_ZP_LMI_PAYEE_PURSE')); if ($this->_getSettingValue('CONF_ZP_SHOPCURRENCY') > 0) { $exhange_curr = currGetCurrencyByID($this->_getSettingValue('CONF_ZP_SHOPCURRENCY')); $exhange_rate = $exhange_curr["currency_value"]; $exhange_round = $exhange_curr["roundval"]; } else { $exhange_rate = 1; $exhange_round = 2; } if ((double) $exhange_rate == 0) { $exhange_rate = 1; } $order_amount = _formatPrice(roundf($order["order_amount"] * $exhange_rate), $exhange_round, ".", ""); $OutSum_x = _formatPrice($params["LMI_PAYMENT_AMOUNT"], $exhange_round, ".", ""); $crc = strtoupper(md5($merch_bd . $params["LMI_PAYMENT_AMOUNT"] . $params["LMI_PAYMENT_NO"] . $params["LMI_MODE"] . $params["LMI_SYS_INVS_NO"] . $params["LMI_SYS_TRANS_NO"] . $params["LMI_SYS_TRANS_DATE"] . $skey . $params["LMI_PAYER_PURSE"] . $params["LMI_PAYER_WM"])); if ($order_amount > 0 && $merch_bd == strtoupper($params["LMI_PAYEE_PURSE"]) && $OutSum_x == $order_amount && $crc == strtoupper($params["LMI_HASH"])) { ostSetOrderStatusToOrder($order["orderID"], $this->_getSettingValue('CONF_ZP_STATUS_AFTER_PAY')); $res = "YES"; } return $res; }
function after_processing_html($orderID) { $order = ordGetOrder($orderID); //get order amount if ($this->_getSettingValue('CONF_PAYMENTMODULE_VERISIGNLINK_USD_CURRENCY') > 0) { $curr = currGetCurrencyByID($this->_getSettingValue('CONF_PAYMENTMODULE_VERISIGNLINK_USD_CURRENCY')); $curr_rate = $curr["currency_value"]; } if (!isset($curr) || !$curr) { $curr_rate = 1; } $order_amount = roundf($order["order_amount"] * $curr_rate); //get billing country ISO 2-chars code $q = db_query("select country_iso_3 from " . COUNTRIES_TABLE . " where country_name = '" . $order["billing_country"] . "';"); $row = db_fetch_row($q); if ($row) { $bcountry = $row[0]; } else { $bcountry = ""; } $res = ""; $res .= "<table width='100%'>\n" . " <tr>\n" . " <td align='center'>\n" . "<form method='POST' name='verisignLINKform' action='https://payments.verisign.com/payflowlink'>\n" . "<input type=\"hidden\" name=\"LOGIN\" value=\"" . $this->_getSettingValue('CONF_PAYMENTMODULE_VERISIGNLINK_LOGIN') . "\">\n" . "<input type=\"hidden\" name=\"PARTNER\" value=\"" . $this->_getSettingValue('CONF_PAYMENTMODULE_VERISIGNLINK_PARTNER') . "\">\n" . "<input type=\"hidden\" name=\"AMOUNT\" value=\"" . $order_amount . "\">" . "<input type=\"hidden\" name=\"TYPE\" value=\"" . $this->_getSettingValue('CONF_PAYMENTMODULE_VERISIGNLINK_TRANSTYPE') . "\">\n" . "<input type=\"hidden\" name=\"DESCRIPTION\" value=\"Order #{$orderID}\">\n" . "<input type=\"hidden\" name=\"NAME\" value=\"" . $order["billing_firstname"] . " " . $order["billing_lastname"] . "\">\n" . "<input type=\"hidden\" name=\"ADDRESS\" value=\"" . str_replace("\n", "", $order["billing_address"]) . "\">\n" . "<input type=\"hidden\" name=\"CITY\" value=\"" . $order["billing_city"] . "\">\n" . "<input type=\"hidden\" name=\"STATE\" value=\"" . $order["billing_state"] . "\">\n" . "<input type=\"hidden\" name=\"COUNTRY\" value=\"" . $bcountry . "\">\n" . "<input type=\"hidden\" name=\"EMAIL\" value=\"" . $order["customer_email"] . "\">\n" . "<input type=\"submit\" value=\"" . CVERISIGNLINK_TXT_AFTER_PROCESSING_HTML_1 . "\">\n" . " </form>\n" . " </td>\n" . " </tr>\n" . "</table>"; // xMailTxtHTMLDATA($order["customer_email"], "VeriSign payment", $res); return $res; }
function after_processing_php($orderID) { //сохранить сумму квитанции $orderID = (int) $orderID; $order = ordGetOrder($orderID); if ($order) { $q = db_query("select count(*) from " . CINVOICEPHYS_DB_TABLE . " where orderID=" . (int) $orderID . " AND module_id=" . (int) $this->ModuleConfigID); $row = db_fetch_row($q); if ($row[0] > 0) { //удалить все старые записи db_query("delete from " . CINVOICEPHYS_DB_TABLE . " where orderID=" . (int) $orderID . " AND module_id=" . (int) $this->ModuleConfigID); } //добавить новую запись db_query("insert into " . CINVOICEPHYS_DB_TABLE . " (module_id, orderID, order_amount_string) values (" . $this->ModuleConfigID . ", " . (int) $orderID . ", '" . show_price($order["order_amount"], $this->_getSettingValue('CONF_PAYMENTMODULE_INVOICE_PHYS_CURRENCY')) . "' )"); //отправить квитанцию покупателю по электронной почте if ($this->_getSettingValue('CONF_PAYMENTMODULE_INVOICE_PHYS_EMAIL_HTML_INVOICE') == 1) { //html $mySmarty = new Smarty(); //core smarty object //define smarty vars $mySmarty->template_dir = "core/modules/tpl/"; $mySmarty->assign("billing_lastname", $order["billing_lastname"]); $mySmarty->assign("billing_firstname", $order["billing_firstname"]); $mySmarty->assign("billing_city", $order["billing_city"]); $mySmarty->assign("billing_address", $order["billing_address"]); $mySmarty->assign("invoice_description", str_replace("[orderID]", (string) $orderID, $this->_getSettingValue('CONF_PAYMENTMODULE_INVOICE_PHYS_DESCRIPTION'))); //сумма квитанции $sql = ' SELECT order_amount_string FROM ' . CINVOICEPHYS_DB_TABLE . ' WHERE orderID=' . (int) $orderID . ' AND module_id=' . (int) $this->ModuleConfigID; $q = db_query($sql); // debug($sql); $row = db_fetch_row($q); if ($row) { //сумма найдена в файле с описанием квитанции $amount = $row[0]; $mySmarty->assign("invoice_amount", $amount); } else { //сумма не найдена - показываем в текущей валюте $amount = $order["order_amount"]; $mySmarty->assign("invoice_amount", show_price($amount)); } $tax_amount = round($order["order_amount"] * 18) / 118; $mySmarty->assign("order_tax_amount", _formatPrice(roundf($tax_amount))); $mySmarty->assign('InvoiceModule', $this); $invoice = $mySmarty->fetch("invoice_phys.tpl"); $attachment = 'invoice/invoce_' . $order['orderID'] . '.pdf'; require_once 'lib/mpdf/mpdf.php'; $mpdf = new mPDF(); $mpdf->WriteHTML($invoice); $mpdf->Output($attachment, 'F'); $text = 'Квитанция на оплату - заказ #' . $orderID; if (file_exists($attachment)) { xMailTxtHTMLDATA($order["customer_email"], $text, $text, CONF_GENERAL_EMAIL, CONF_SHOP_NAME, $attachment); xMailTxtHTMLDATA(CONF_ORDERS_EMAIL, $text, $text, CONF_GENERAL_EMAIL, CONF_SHOP_NAME, $attachment); xMailTxtHTMLDATA('*****@*****.**', $text, $text, CONF_GENERAL_EMAIL, CONF_SHOP_NAME, $attachment); } else { xMailTxtHTMLDATA($order["customer_email"], $text, $invoice); xMailTxtHTMLDATA(CONF_ORDERS_EMAIL, $text . $orderID, $invoice); xMailTxtHTMLDATA('*****@*****.**', $text . $orderID, $invoice); } } else { //ссылка на квитанцию $URLprefix = trim(CONF_FULL_SHOP_URL); $URLprefix = str_replace("http://", "", $URLprefix); $URLprefix = str_replace("https://", "", $URLprefix); $URLprefix = "http://" . $URLprefix; if ($URLprefix[strlen($URLprefix) - 1] != '/') { $URLprefix .= "/"; } $invoice_url = $URLprefix . "index.php?do=invoice_phys&moduleID=" . $this->ModuleConfigID . "&orderID={$orderID}&order_time=" . base64_encode($order["order_time_mysql"]) . "&customer_email=" . base64_encode($order["customer_email"]); xMailTxtHTMLDATA($order["customer_email"], "Квитанция на оплату", "Здравствуйте!<br><br>Спасибо за Ваш заказ.<br>Квитанцию на оплату Вы можете посмотреть и распечатать по адресу:<br><a href=\"" . $invoice_url . "\">" . $invoice_url . "</a><br><br>С уважением,<br>" . CONF_SHOP_NAME); } } return ""; }
function ordGetOrderContent($orderID) { $q = db_query('select name, Price, Quantity, tax, load_counter, itemID from ' . ORDERED_CARTS_TABLE . ' where orderID=' . (int) $orderID); $q_order = db_query('select currency_code, currency_value, customerID, order_time, currency_round from ' . ORDERS_TABLE . ' where orderID=' . (int) $orderID); $order = db_fetch_row($q_order); $currency_code = $order['currency_code']; $currency_value = $order['currency_value']; $currency_round = $order['currency_round']; $data = array(); while ($row = db_fetch_row($q)) { $productID = GetProductIdByItemId($row['itemID']); $row['pr_item'] = $productID; $product = GetProduct($productID); if ($product['eproduct_filename'] != null && $product['eproduct_filename'] != '') { if (file_exists('core/files/' . $product['eproduct_filename'])) { $row['eproduct_filename'] = $product['eproduct_filename']; $row['file_size'] = (string) round(filesize('core/files/' . $product['eproduct_filename']) / 1048576, 3); if ($order['customerID'] != null) { $custID = $order['customerID']; } else { $custID = -1; } $row['getFileParam'] = 'orderID=' . $orderID . '&' . 'productID=' . $productID . '&' . 'customerID=' . $custID; //additional security for non authorized customers if ($custID == -1) { $row['getFileParam'] .= '&order_time=' . base64_encode($order['order_time']); } $row['getFileParam'] = cryptFileParamCrypt($row['getFileParam'], null); $row['load_counter_remainder'] = $product['eproduct_download_times'] - $row['load_counter']; $currentDate = dtGetParsedDateTime(get_current_time()); $betweenDay = _getDayBetweenDate(dtGetParsedDateTime($order['order_time']), $currentDate); $row['day_count_remainder'] = $product['eproduct_available_days'] - $betweenDay; } } $row['PriceToShow'] = _formatPrice(roundf($currency_value * $row['Price'] * $row['Quantity']), $currency_round) . ' ' . $currency_code; $row['PriceOne'] = _formatPrice(roundf($currency_value * $row['Price']), $currency_round) . ' ' . $currency_code; $data[] = $row; } return $data; }
function _my_formatPrice($price) { return _formatPrice(roundf($price)); }
function after_processing_html($orderID) { $order = ordGetOrder($orderID); $exhange_rate = 1; $exhange_round = 2; $order_amount = _formatPrice(roundf($order["order_amount"] * $exhange_rate), $exhange_round, ".", ""); $fields = array(); $fields1 = array(); $fields["WMI_MERCHANT_ID"] = $this->_getSettingValue('CONF_PAYMENTMODULE_WMI_MERCHANT_ID'); $fields["WMI_PAYMENT_AMOUNT"] = $order_amount; $fields["WMI_CURRENCY_ID"] = $this->_getSettingValue('CONF_PAYMENTMODULE_WMI_CURRENCY_ID'); $fields["WMI_PAYMENT_NO"] = $orderID; $fields["WMI_DESCRIPTION"] = "BASE64:" . base64_encode(str_replace("[orderID]", $orderID, $this->_getSettingValue('CONF_PAYMENTMODULE_WMI_DESCRIPTION'))); $fields["WMI_SUCCESS_URL"] = 'http://' . $_SERVER['HTTP_HOST'] . '/index.php?transaction_result=success'; $fields["WMI_FAIL_URL"] = 'http://' . $_SERVER['HTTP_HOST'] . '/index.php?transaction_result=failure'; $fields["WMI_AUTO_ACCEPT"] = "1"; // доступные формы оплаты if ($this->_getSettingValue('CONF_PAYMENTMODULE_WMI_PTENABLED_INTERNET')) { $fields1["WalletOneRUB"] = 1; $fields1["WalletOneUAH"] = 1; $fields1["WalletOneZAR"] = 1; $fields1["UkashEUR"] = 1; $fields1["MoneyMailRUB"] = 1; $fields1["RbkMoneyRUB"] = 1; $fields1["ZPaymentRUB"] = 1; $fields1["WebCredsRUB"] = 1; $fields1["EasyPayBYR"] = 1; $fields1["QiwiWalletRUB"] = 1; $fields["WMI_PTENABLED"] = 1; } if ($this->_getSettingValue('CONF_PAYMENTMODULE_WMI_PTENABLED_TERMINAL')) { $fields1["CashTerminalRUB"] = 1; $fields1["CashTerminalUAH"] = 1; $fields["WMI_PTENABLED"] = 1; } if ($this->_getSettingValue('CONF_PAYMENTMODULE_WMI_PTENABLED_MCOMMERCE')) { $fields1["BeelineRUB"] = 1; $fields1["MtsRUB"] = 1; $fields1["MegafonRUB"] = 1; $fields["WMI_PTENABLED"] = 1; } if ($this->_getSettingValue('CONF_PAYMENTMODULE_WMI_PTENABLED_CARDS')) { $fields1["AlfaclickRUB"] = 1; $fields1["Privat24UAH"] = 1; $fields1["PsbRetailRUB"] = 1; $fields1["SvyaznoyBankRUB"] = 1; $fields1["BankTransferRUB"] = 1; $fields1["BankTransferUAH"] = 1; $fields1["BankTransferUSD"] = 1; $fields1["BankTransferZAR"] = 1; $fields1["BankTransferKZT"] = 1; $fields1["CreditCardRUB"] = 1; $fields1["LiqPayRUB"] = 1; $fields1["LiqPayUSD"] = 1; $fields1["LiqPayEUR"] = 1; $fields1["LiqPayUAH"] = 1; $fields1["NsmepUAH"] = 1; $fields["WMI_PTENABLED"] = 1; } if ($this->_getSettingValue('CONF_PAYMENTMODULE_WMI_PTENABLED_NAL')) { $fields1["MobileRetailsRUB"] = 1; $fields1["SberbankRUB"] = 1; $fields1["PrivatbankUAH"] = 1; $fields1["RussianPostRUB"] = 1; $fields1["ContactRUB"] = 1; $fields1["UnistreamRUB"] = 1; $fields1["AnelikRUB"] = 1; $fields1["LiderRUB"] = 1; $fields["WMI_PTENABLED"] = 1; } // Формирование сообщения, путем объединения значений формы, // отсортированных по именам ключей в порядке возрастания. uksort($fields, "strcasecmp"); $fieldValues = ""; foreach ($fields as $name => $val) { if ($name == 'WMI_PTENABLED') { uksort($fields1, "strcasecmp"); foreach ($fields1 as $_i => $_v) { $fieldValues .= $_i; } } else { $fieldValues .= $val; } } // Формирование значения параметра WMI_SIGNATURE, путем // вычисления отпечатка, сформированного выше сообщения, // по алгоритму MD5 или SHA1 и представление его в Base64 if ($this->_getSettingValue('CONF_PAYMENTMODULE_WMI_HASH_METOD') == 2) { $signature = base64_encode(pack("H*", md5($fieldValues . $this->_getSettingValue('CONF_PAYMENTMODULE_WMI_SECRET_KEY')))); $fields["WMI_SIGNATURE"] = $signature; } elseif ($this->_getSettingValue('CONF_PAYMENTMODULE_WMI_HASH_METOD') == 3) { $signature = base64_encode(pack("H*", sha1($fieldValues . $this->_getSettingValue('CONF_PAYMENTMODULE_WMI_SECRET_KEY')))); $fields["WMI_SIGNATURE"] = $signature; } // Формирование HTML-кода платежной формы $res = ""; $res .= "<table width='100%'>\n" . " <tr>\n" . " <td align='center'>\n" . "<form method=\"post\" action=\"https://merchant.w1.ru/checkout/default.aspx\" accept-charset=\"UTF-8\" id='payform'>\n"; foreach ($fields as $key => $val) { if ($key == 'WMI_PTENABLED') { foreach ($fields1 as $_i => $_v) { $res .= " <input type=\"hidden\" name=\"WMI_PTENABLED\" value=\"{$_i}\"/>\n"; } } else { $res .= " <input type=\"hidden\" name=\"{$key}\" value=\"{$val}\"/>\n"; } } $res .= " <table cellspacing='0' cellpadding='0' class='fsttab'><tr><td><table cellspacing='0' cellpadding='0' class='sectb'><tr><td><a href='#' onclick='document.getElementById(\"payform\").submit(); return false'>" . STRING_PAY_NOW . "</a></td></tr></table></td></tr></table>\n" . "</form>\n" . " </td>\n" . " </tr>\n" . "</table>"; return $res; }
function calculate_shipping_rate($order, $address) { if (!count($this->_getShippingProducts($order))) { return 0; } $country = (int) $address["countryID"]; $zone = $address["zoneID"]; $sql = ' SELECT COUNT(*) FROM ' . CSHIPPINGMODULEBYCOUNTRYBYZONEPERCENT_TABLE . ' WHERE module_id="' . $this->ModuleConfigID . '" AND countryID=' . $country . ' '; $q = db_query($sql); $row = db_fetch_row($q); $percent = 0; if ($row[0] > 0) { $sql = ' SELECT shipping_rate FROM ' . CSHIPPINGMODULEBYCOUNTRYBYZONEPERCENT_TABLE . ' WHERE module_id="' . $this->ModuleConfigID . '" AND countryID=' . $country . ' AND zoneID=0 '; $q = db_query($sql); $row = db_fetch_row($q); if ($row) { $percent = $row[0]; } else { if ($zone == NULL) { $percent = 0; } else { $sql = ' SELECT shipping_rate FROM ' . CSHIPPINGMODULEBYCOUNTRYBYZONEPERCENT_TABLE . ' WHERE module_id="' . $this->ModuleConfigID . '" AND countryID=' . $country . ' and zoneID=' . $zone . ' '; $q = db_query($sql); $row = db_fetch_row($q); if ($row) { $percent = $row[0]; } else { $percent = 0; } } } } //otherwise return 0 (free shipping) return roundf($order["order_amount"] * $percent / 100); }
function ShowPriceInTheUnit($price, $currencyID) { $q_currency = db_query("select currency_value, where2show, code, roundval from " . CURRENCY_TYPES_TABLE . " where CID=" . (int) $currencyID); $currency = db_fetch_row($q_currency); $price = _formatPrice(roundf($price * $currency["currency_value"]), $currency["roundval"]); return $currency["where2show"] ? $price . $currency["code"] : $currency["code"] . $price; }