function quote($method = '') { global $order, $shipping_weight; $calc_weight = $shipping_weight; $error = false; $dest_country = $order->delivery['country']['iso_code_2']; if (defined('MODULE_SHIPPING_CHINAPOSTREGISTERED_BASIS_WEIGHT_FEE') && defined('MODULE_SHIPPING_CHINAPOSTREGISTERED_BASIS_WEIGHT') && defined('MODULE_SHIPPING_CHINAPOSTREGISTERED_REST_WEIGHT_UNIT_FEE') && MODULE_SHIPPING_CHINAPOSTREGISTERED_REST_WEIGHT_UNIT_FEE > 0) { if ($calc_weight <= MODULE_SHIPPING_CHINAPOSTREGISTERED_BASIS_WEIGHT) { $shipping_cost = MODULE_SHIPPING_CHINAPOSTREGISTERED_BASIS_WEIGHT_FEE + MODULE_SHIPPING_CHINAPOSTREGISTERED_REGISTER_FEE; } else { $calc_weight = $calc_weight - MODULE_SHIPPING_CHINAPOSTREGISTERED_BASIS_WEIGHT; $shipping_cost = ceil($calc_weight / MODULE_SHIPPING_CHINAPOSTREGISTERED_REST_WEIGHT_UNIT) * MODULE_SHIPPING_CHINAPOSTREGISTERED_REST_WEIGHT_UNIT_FEE; $shipping_cost = MODULE_SHIPPING_CHINAPOSTREGISTERED_BASIS_WEIGHT_FEE + $shipping_cost + MODULE_SHIPPING_CHINAPOSTREGISTERED_REGISTER_FEE; } $shipping_method = MODULE_SHIPPING_CHINAPOSTREGISTERED_TEXT_WAY . ' ' . $dest_country . ' (' . number_format($shipping_weight, 2) . MODULE_SHIPPING_CHINAPOSTREGISTERED_TEXT_UNITS . ') '; //modified by john 2010-06-30 //for better calculate with currency $shipping_cost = $shipping_cost / (defined('MODULE_SHIPPING_CHINAPOSTREGISTERED_EXCHANGE_RATE') ? MODULE_SHIPPING_CHINAPOSTREGISTERED_EXCHANGE_RATE : 1); } if ($shipping_weight > MODULE_SHIPPING_CHINAPOSTREGISTERED_BEYOND_WEIGHTLIMIT) { $error = true; } $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_CHINAPOSTREGISTERED_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => $shipping_method, 'cost' => $shipping_cost))); if ($this->tax_class > 0) { $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); } if (zen_not_null($this->icon)) { $this->quotes['icon'] = zen_image($this->icon, $this->title); } if ($error == true) { $this->quotes['error'] = MODULE_SHIPPING_CHINAPOSTREGISTERED_BEYOND_WEIGHTLIMIT_TEXT; } return $this->quotes; }
function process() { global $order; $order_total_array = array(); if (is_array($this->modules)) { reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); if (!isset($GLOBALS[$class])) { continue; } $GLOBALS[$class]->process(); for ($i = 0, $n = sizeof($GLOBALS[$class]->output); $i < $n; $i++) { if (zen_not_null($GLOBALS[$class]->output[$i]['title']) && zen_not_null($GLOBALS[$class]->output[$i]['text'])) { $order_total_array[] = array('code' => $GLOBALS[$class]->code, 'title' => $GLOBALS[$class]->output[$i]['title'], 'text' => $GLOBALS[$class]->output[$i]['text'], 'value' => $GLOBALS[$class]->output[$i]['value'], 'sort_order' => $GLOBALS[$class]->sort_order); } } } //print_r($order_total_array); } // $order_total_array[3]['code']="ot_coupon"; // $order_total_array[3]['title']="12312312312"; // $order_total_array[3]['text']="-US$18.00"; // $order_total_array[3]['value']="16.00"; // $order_total_array[3]['sort_order']="400"; return $order_total_array; }
/** * Returns an array with countries * * @param int If set limits to a single country * @param boolean If true adds the iso codes to the array */ function zen_get_countries($countries_id = '', $with_iso_codes = false) { global $db; $countries_array = array(); if (zen_not_null($countries_id)) { if ($with_iso_codes == true) { $countries = "select countries_name, countries_iso_code_2, countries_iso_code_3\n from " . TABLE_COUNTRIES . "\n where countries_id = '" . (int) $countries_id . "'\n order by countries_name"; $countries_values = $db->Execute($countries); $countries_array = array('countries_name' => $countries_values->fields['countries_name'], 'countries_iso_code_2' => $countries_values->fields['countries_iso_code_2'], 'countries_iso_code_3' => $countries_values->fields['countries_iso_code_3']); } else { $countries = "select countries_name\n from " . TABLE_COUNTRIES . "\n where countries_id = '" . (int) $countries_id . "'"; $countries_values = $db->Execute($countries); $countries_array = array('countries_name' => $countries_values->fields['countries_name']); } } else { $countries = "select countries_id, countries_name\n from " . TABLE_COUNTRIES . "\n order by countries_name"; $countries_values = $db->Execute($countries); $front_list = array(223, 204, 195, 163, 81, 38, 14, 13); array_unshift($countries_array, array('countries_id' => '-1', 'countries_name' => '-----------------------')); while (!$countries_values->EOF) { if (in_array($countries_values->fields['countries_id'], $front_list)) { array_unshift($countries_array, array('countries_id' => $countries_values->fields['countries_id'], 'countries_name' => $countries_values->fields['countries_name'])); } $countries_array[] = array('countries_id' => $countries_values->fields['countries_id'], 'countries_name' => $countries_values->fields['countries_name']); $countries_values->MoveNext(); } array_unshift($countries_array, array('countries_id' => '-1', 'countries_name' => '-----------------------')); } return $countries_array; }
function quote($method = '') { global $order; if ($this->enabled) { $excluded_array = explode(',', MODULE_SHIPPING_PREFERRED_SHIPPING_EXCLUDED_PRODUCTS); $products_in_cart_array = explode(',', $_SESSION['cart']->get_product_id_list()); echo var_dump($products_in_cart_array); foreach ($products_in_cart_array as $product_in_cart) { $base_product_in_cart = substr($product_in_cart, 0, strpos($product_in_cart, ':')); if (in_array($base_product_in_cart, $excluded_array)) { $this->enabled = false; } } if ($_SESSION['cart']->show_total() < MODULE_SHIPPING_PREFERRED_SHIPPING_MIN_ORDER) { $this->enabled = false; } } if ($this->enabled) { $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_PREFERRED_SHIPPING_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_PREFERRED_SHIPPING_TEXT_WAY, 'cost' => '0.00'))); if ($this->tax_class > 0) { $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); } if (zen_not_null($this->icon)) { $this->quotes['icon'] = zen_image($this->icon, $this->title); } } return $this->quotes; }
function quote($method = '') { global $order, $shipping_weight; $error = false; $dest_country = $order->delivery['country']['iso_code_2']; if (defined('MODULE_SHIPPING_HKPOSTREGISTERED_COST_UNIT') && MODULE_SHIPPING_HKPOSTREGISTERED_COST_UNIT > 0) { //hkpost weight as gram g. $shipping_cost = MODULE_SHIPPING_HKPOSTREGISTERED_COST_UNIT * $shipping_weight; if (defined('MODULE_SHIPPING_HKPOSTREGISTERED_HANDLE_FEE') && MODULE_SHIPPING_HKPOSTREGISTERED_HANDLE_FEE > 0) { $shipping_cost += MODULE_SHIPPING_HKPOSTREGISTERED_HANDLE_FEE; } //$shipping_method = MODULE_SHIPPING_HKPOSTREGISTERED_TEXT_WAY . ' ' . $dest_country . ' ('.number_format($shipping_weight,2).MODULE_SHIPPING_HKPOSTREGISTERED_TEXT_UNITS.')'; $shipping_method = MODULE_SHIPPING_HKPOSTREGISTERED_TEXT_WAY; //############################for better calculate with currency######################### //modified by john 2010-06-30 2/3 $shipping_cost = $shipping_cost / (defined('MODULE_SHIPPING_HKPOSTREGISTERED_EXCHANGE_RATE') ? MODULE_SHIPPING_HKPOSTREGISTERED_EXCHANGE_RATE : 1); } if ($shipping_weight > MODULE_SHIPPING_HKPOSTREGISTERED_BEYOND_WEIGHTLIMIT) { $error = true; } $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_HKPOSTREGISTERED_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => $shipping_method, 'cost' => $shipping_cost))); if ($this->tax_class > 0) { $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); } if (zen_not_null($this->icon)) { $this->quotes['icon'] = zen_image($this->icon, $this->title); } if ($error == true) { $this->quotes['error'] = MODULE_SHIPPING_HKPOSTREGISTERED_BEYOND_WEIGHTLIMIT_TEXT; } return $this->quotes; }
public static function required_text($text) { if (zen_not_null($text)) { return "<span class='text-danger'><strong>{$text}</strong></span>"; } return ''; }
/** * Enter description here... * * @return ot_gv */ function ot_gv() { global $currencies; $this->code = 'ot_gv'; $this->title = MODULE_ORDER_TOTAL_GV_TITLE; $this->header = MODULE_ORDER_TOTAL_GV_HEADER; $this->description = MODULE_ORDER_TOTAL_GV_DESCRIPTION; $this->user_prompt = MODULE_ORDER_TOTAL_GV_USER_PROMPT; $this->sort_order = MODULE_ORDER_TOTAL_GV_SORT_ORDER; $this->include_shipping = MODULE_ORDER_TOTAL_GV_INC_SHIPPING; $this->include_tax = MODULE_ORDER_TOTAL_GV_INC_TAX; $this->calculate_tax = MODULE_ORDER_TOTAL_GV_CALC_TAX; $this->credit_tax = MODULE_ORDER_TOTAL_GV_CREDIT_TAX; $this->tax_class = MODULE_ORDER_TOTAL_GV_TAX_CLASS; $this->show_redeem_box = MODULE_ORDER_TOTAL_GV_REDEEM_BOX; $this->credit_class = true; if (!zen_not_null(ltrim($_SESSION['cot_gv'], ' 0')) || $_SESSION['cot_gv'] == '0') { $_SESSION['cot_gv'] = '0.00'; } if (IS_ADMIN_FLAG !== true) { $this->checkbox = $this->user_prompt . '<input type="text" size="6" onkeyup="submitFunction()" name="cot_gv" value="' . number_format($_SESSION['cot_gv'], 2) . '" onfocus="if (this.value == \'' . number_format($_SESSION['cot_gv'], 2) . '\') this.value = \'\';" />' . ($this->user_has_gv_account($_SESSION['customer_id']) > 0 ? '<br />' . MODULE_ORDER_TOTAL_GV_USER_BALANCE . $currencies->format($this->user_has_gv_account($_SESSION['customer_id'])) : ''); } $this->output = array(); if (IS_ADMIN_FLAG === true) { if ($this->include_tax == 'true' && $this->calculate_tax != "None") { $this->title .= '<span class="alert">' . MODULE_ORDER_TOTAL_GV_INCLUDE_ERROR . '</span>'; } } }
function notifierUpdate($notifier) { global $db; global $order; switch ($notifier) { case 'NOTIFY_HEADER_START_CHECKOUT_SHIPPING': if (zen_not_null($_POST['calendar_hope_delivery_day'])) { $_SESSION['calendar_hope_delivery_day'] = zen_db_prepare_input($_POST['calendar_hope_delivery_day']); } if (zen_not_null($_POST['calendar_hope_delivery_time'])) { $_SESSION['calendar_hope_delivery_time'] = zen_db_prepare_input($_POST['calendar_hope_delivery_time']); } break; case 'NOTIFY_CHECKOUT_PROCESS_AFTER_PAYMENT_MODULES_BEFOREPROCESS': // // 希望配送日時をコメントへ付加する $order->info['comments'] = MODULE_CALENDAR_HOPE_DELIVERY_DAY_HEADER . ":" . $_SESSION['calendar_hope_delivery_day'] . "\n" . MODULE_CALENDAR_HOPE_DELIVERY_TIME_HEADER . ":" . $_SESSION['calendar_hope_delivery_time'] . "\n" . $order->info['comments']; break; case 'NOTIFY_CHECKOUT_PROCESS_AFTER_SEND_ORDER_EMAIL': $_SESSION['calendar_hope_delivery_day'] = ''; $_SESSION['calendar_hope_delivery_time'] = ''; unset($_SESSION['calendar_hope_delivery_day']); unset($_SESSION['calendar_hope_delivery_time']); break; } }
public function exportFinalizeInitialization() { // ----- // Check to see if any of this handler's filter variables have been set. If set, check the values and then // update the where_clause for the to-be-issued SQL query for the export. // if ($_POST['orders_status'] != '0') { $this->where_clause .= ($this->where_clause == '' ? '' : ' AND ') . 'o.orders_status = ' . (int) $_POST['orders_status']; } if (zen_not_null($_POST['orders_id_min']) && ctype_digit($_POST['orders_id_min'])) { $this->where_clause .= ($this->where_clause == '' ? '' : ' AND ') . 'o.orders_id >= ' . (int) $_POST['orders_id_min']; } if (zen_not_null($_POST['orders_id_max']) && ctype_digit($_POST['orders_id_max'])) { $this->where_clause .= ($this->where_clause == '' ? '' : ' AND ') . 'o.orders_id <= ' . (int) $_POST['orders_id_max']; } if (zen_not_null($_POST['orders_date_start'])) { $validated_date = $this->formatValidateDate($_POST['orders_date_start']); if ($validated_date !== false) { $this->where_clause .= ($this->where_clause == '' ? '' : ' AND ') . "o.date_purchased >= '{$validated_date} 00:00:00'"; } } if (zen_not_null($_POST['orders_date_end'])) { $validated_date = $this->formatValidateDate($_POST['orders_date_end']); if ($validated_date !== false) { $this->where_clause .= ($this->where_clause == '' ? '' : ' AND ') . "o.date_purchased <= '{$validated_date} 23:59:59'"; } } return true; }
function currency_update_quotes() { global $gBitDb; $output = array(); if ($currencies = $gBitDb->getAssoc("SELECT `code`, `title` FROM " . TABLE_CURRENCIES)) { foreach ($currencies as $curCode => $curTitle) { $server_used = 'yahoo'; if (!($rate = currency_yahoo_quote($curCode))) { $server_used = CURRENCY_SERVER_PRIMARY; $quote_function = 'currency_' . CURRENCY_SERVER_PRIMARY . '_quote'; $rate = $quote_function($curCode); if (empty($rate) && zen_not_null(CURRENCY_SERVER_BACKUP)) { $output[] = sprintf(WARNING_PRIMARY_SERVER_FAILED, CURRENCY_SERVER_PRIMARY, '', $curCode); $quote_function = 'currency_' . CURRENCY_SERVER_BACKUP . '_quote'; $quote_function = 'currency_yahoo_quote'; $rate = $quote_function($curCode); $server_used = CURRENCY_SERVER_BACKUP; } } if (!empty($rate)) { $gBitDb->query("UPDATE " . TABLE_CURRENCIES . " SET `currency_value`=?, `last_updated` = " . $gBitDb->qtNOW() . " WHERE `code` = ?", array($rate, $curCode)); $output[$curCode] = array('result' => 'success', 'message' => sprintf(TEXT_INFO_CURRENCY_UPDATED, $curTitle, $curCode, $server_used) . ' = ' . $rate); } else { $output[$curCode] = array('result' => 'failure', 'message' => sprintf(ERROR_CURRENCY_INVALID, $curTitle, $curCode, $server_used)); } } } return $output; }
/** * Returns an array with countries * * @param int If set limits to a single country * @param boolean If true adds the iso codes to the array */ function zen_get_countries($pCountryMixed = '', $with_iso_codes = false) { global $gBitDb; $ret = array(); $whereSql = ''; $bindVars = array(); if (zen_not_null($pCountryMixed)) { if (is_numeric($pCountryMixed)) { $whereSql = ' WHERE `countries_id` = ? '; } else { $pCountryMixed = strtoupper($pCountryMixed); $whereSql = ' WHERE UPPER( `countries_name` ) = ? '; } $bindVars = array($pCountryMixed); } $countries = "SELECT *\n\t\t\t\t FROM " . TABLE_COUNTRIES . "\n\t\t\t\t {$whereSql}\n\t\t\t\t ORDER BY `countries_name`"; if ($rs = $gBitDb->query($countries, $bindVars)) { while (!$rs->EOF) { $row = array('countries_id' => $rs->fields['countries_id'], 'countries_name' => $rs->fields['countries_name'], 'address_format_id' => $rs->fields['address_format_id']); if ($with_iso_codes == true) { $row['countries_iso_code_2'] = $rs->fields['countries_iso_code_2']; $row['countries_iso_code_3'] = $rs->fields['countries_iso_code_3']; } if ($rs->RecordCount() == 1) { $ret = $row; } else { $ret[] = $row; } $rs->MoveNext(); } } return $ret; }
function trail($separator = ' ') { $trail_string = ''; for ($i = 0, $n = sizeof($this->_trail); $i < $n; $i++) { // echo 'breadcrumb ' . $i . ' of ' . $n . ': ' . $this->_trail[$i]['title'] . '<br />'; $skip_link = false; if ($i == $n - 1 && DISABLE_BREADCRUMB_LINKS_ON_LAST_ITEM == 'true') { $skip_link = true; } if (isset($this->_trail[$i]['link']) && zen_not_null($this->_trail[$i]['link']) && !$skip_link) { // this line simply sets the "Home" link to be the domain/url, not main_page=index?blahblah: if ($this->_trail[$i]['title'] == HEADER_TITLE_CATALOG) { $trail_string .= ' <a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">' . $this->_trail[$i]['title'] . '</a>'; } else { $trail_string .= ' <a href="' . $this->_trail[$i]['link'] . '">' . $this->_trail[$i]['title'] . '</a>'; } } else { $trail_string .= $this->_trail[$i]['title']; } if ($i + 1 < $n) { $trail_string .= $separator; } $trail_string .= "\n"; } return $trail_string; }
function update_recent_products($products_id) { if ($_COOKIE['recent_viewed'] != '') { $current_products = explode('_', $_COOKIE['recent_viewed']); } else { $current_products = ''; } $new_products = array(); $new_products[] = $products_id; $product_count = 0; if (is_array($current_products)) { foreach ($current_products as $product) { if ($product != $products_id) { if (defined('RECENT_VIEWED_PRODUCTS_MAXIMUM') && RECENT_VIEWED_PRODUCTS_MAXIMUM - 1 > $product_count || !defined('RECENT_VIEWED_PRODUCTS_MAXIMUM') || !zen_not_null(RECENT_VIEWED_PRODUCTS_MAXIMUM)) { $product_count++; $new_products[] = $product; } else { break; } } } } else { //nothing } return implode('_', $new_products); }
function payment($module = '') { global $PHP_SELF, $language, $credit_covers, $messageStack; if (defined('MODULE_PAYMENT_INSTALLED') && zen_not_null(MODULE_PAYMENT_INSTALLED)) { $this->modules = explode(';', MODULE_PAYMENT_INSTALLED); $include_modules = array(); if (zen_not_null($module) && in_array($module . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1), $this->modules)) { $this->selected_module = $module; $include_modules[] = array('class' => $module, 'file' => $module . '.php'); } else { reset($this->modules); // Free Payment Only shows if (zen_get_configuration_key_value('MODULE_PAYMENT_FREECHARGER_STATUS') and ($_SESSION['cart']->show_total() == 0 and $_SESSION['shipping']['cost'] == 0)) { $this->selected_module = $module; if (file_exists(DIR_FS_CATALOG . DIR_WS_MODULES . '/payment/' . 'freecharger.php')) { $include_modules[] = array('class' => 'freecharger', 'file' => 'freecharger.php'); } } else { // All Other Payment Modules show while (list(, $value) = each($this->modules)) { // double check that the module really exists before adding to the array if (file_exists(DIR_FS_CATALOG . DIR_WS_MODULES . '/payment/' . $value)) { $class = substr($value, 0, strrpos($value, '.')); // Don't show Free Payment Module if ($class != 'freecharger') { $include_modules[] = array('class' => $class, 'file' => $value); } } } } } for ($i = 0, $n = sizeof($include_modules); $i < $n; $i++) { // include(DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $include_modules[$i]['file']); $lang_file = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/payment/', $include_modules[$i]['file'], 'false'); if (@file_exists($lang_file)) { include_once $lang_file; } else { if (IS_ADMIN_FLAG === false) { $messageStack->add(WARNING_COULD_NOT_LOCATE_LANG_FILE . $lang_file, 'caution'); } else { $messageStack->add_session(WARNING_COULD_NOT_LOCATE_LANG_FILE . $lang_file, 'caution'); } } include_once DIR_WS_MODULES . 'payment/' . $include_modules[$i]['file']; $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class'](); } // if there is only one payment method, select it as default because in // checkout_confirmation.php the $payment variable is being assigned the // $_POST['payment'] value which will be empty (no radio button selection possible) if (zen_count_payment_modules() == 1 && (!isset($_SESSION['payment']) || isset($_SESSION['payment']) && !is_object($_SESSION['payment']))) { if (!$credit_covers) { $_SESSION['payment'] = $include_modules[0]['class']; } } if (zen_not_null($module) && in_array($module, $this->modules) && isset($GLOBALS[$module]->form_action_url)) { $this->form_action_url = $GLOBALS[$module]->form_action_url; } } }
function is_set($code) { if (isset($this->currencies[$code]) && zen_not_null($this->currencies[$code])) { return true; } else { return false; } }
function set_language($language) { if (zen_not_null($language) && isset($this->catalog_languages[$language])) { $this->language = $this->catalog_languages[$language]; } else { $this->language = $this->catalog_languages[DEFAULT_LANGUAGE]; } }
function quote() { global $shipping_weight, $shipping_num_boxes; global $order; global $a_sagawaex_time; global $cart; global $db; $this->quotes = array('id' => $this->code, 'module' => $this->title); if (zen_not_null($this->icon)) { $this->quotes['icon'] = zen_image($this->icon, $this->title); } $country_id = $order->delivery['country']['id']; $zone_id = $order->delivery['zone_id']; if (in_array($country_id, $this->sagawaex_countries_nbr)) { $zoneinfo = $db->Execute("SELECT zone_code FROM " . TABLE_ZONES . " WHERE zone_id = '" . $zone_id . "'"); $a_zonevalues = $zoneinfo->fields; $s_zone_code = $a_zonevalues['zone_code']; // 送料が条件によって無料になってしまう(ここではtotalではなくsubtotalを確認すべき) if (MODULE_SHIPPING_SAGAWAEX_FREE_SHIPPING != 'True' || (int) $order->info['subtotal'] < (int) MODULE_SHIPPING_SAGAWAEX_OVER) { include DIR_WS_CLASSES . '_sagawaex.php'; $rate = new _SagawaEx($this->code, MODULE_SHIPPING_SAGAWAEX_TEXT_WAY_NORMAL, zen_get_zone_code(STORE_COUNTRY, STORE_ZONE, 0), STORE_COUNTRY); //STORE_ORIGIN_ZONE, STORE_ORIGIN_COUNTRY); $rate->SetDest($s_zone_code, $this->sagawaex_countries[$country_id]); $rate->SetWeight($shipping_weight); $tmpQuote = $rate->GetQuote(); // id, title, cost | error if (isset($tmpQuote['error'])) { $this->quotes['error'] = $tmpQuote['error']; } else { $this->quotes['module'] = $this->title . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . 'kg)'; $tmpQuote['cost'] *= $shipping_num_boxes; // 送料ディスカウント if (defined('MODULE_SHIPPING_SAGAWAEX_DISCOUNT') && 0 < (int) MODULE_SHIPPING_SAGAWAEX_DISCOUNT) { $tmpQuote['cost'] -= (int) ($tmpQuote['cost'] * MODULE_SHIPPING_SAGAWAEX_DISCOUNT / 100); } // 手数料 $tmpQuote['cost'] += MODULE_SHIPPING_SAGAWAEX_HANDLING; } } else { $tmpQuote = array('id' => $this->code, 'title' => MODULE_SHIPPING_SAGAWAEX_TEXT_WAY_NORMAL, 'cost' => 0); } if (!isset($tmpQuote['error'])) { // 配送時刻指定 $timespec = $this->get_timespec(); $tmpQuote['option'] = TEXT_TIME_SPECIFY . zen_draw_pull_down_menu('sagawaex_timespec', $a_sagawaex_time, $timespec); $tmpQuote['timespec'] = $timespec; } $this->quotes['methods'][] = $tmpQuote; if ($this->tax_class > 0) { $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $country_id, $zone_id); } } else { $this->quotes['error'] = MODULE_SHIPPING_SAGAWAEX_TEXT_NOTAVAILABLE; } return $this->quotes; }
function zen_link_info_image($image, $alt, $width = '', $height = '') { global $db; if (zen_not_null($image)) { $image = zen_image($image, $alt, $width, $height); } else { $image = TEXT_IMAGE_NONEXISTENT; } return $image; }
function quote($pShippingWeight, $method = '', $module = '') { global $currencies; $quotes_array = array(); if (!empty($this->modules)) { $shipHash['method'] = $method; $shipHash['shipping_num_boxes'] = 1; $shipHash['shipping_weight'] = $pShippingWeight; $za_tare_array = preg_split("/[:,]/", SHIPPING_BOX_WEIGHT); $zc_tare_percent = $za_tare_array[0]; $zc_tare_weight = $za_tare_array[1]; $za_large_array = preg_split("/[:,]/", SHIPPING_BOX_PADDING); $zc_large_percent = $za_large_array[0]; $zc_large_weight = $za_large_array[1]; if (SHIPPING_MAX_WEIGHT <= $shipHash['shipping_weight']) { // large box add padding $shipHash['shipping_weight'] = $shipHash['shipping_weight'] + $shipHash['shipping_weight'] * ($zc_large_percent / 100) + $zc_large_weight; } else { // add tare weight < large $shipHash['shipping_weight'] = $shipHash['shipping_weight'] + $shipHash['shipping_weight'] * ($zc_tare_percent / 100) + $zc_tare_weight; } if ($shipHash['shipping_weight'] > SHIPPING_MAX_WEIGHT) { // Split into many boxes $shipHash['shipping_num_boxes'] = ceil($shipHash['shipping_weight'] / SHIPPING_MAX_WEIGHT); $shipHash['shipping_weight'] = $shipHash['shipping_weight'] / $shipHash['shipping_num_boxes']; } $include_quotes = array(); reset($this->modules); while (list(, $value) = each($this->modules)) { $base = basename($value); $class = substr($base, 0, strrpos($base, '.')); if (zen_not_null($module)) { if ($module == $class && $GLOBALS[$class]->enabled) { $include_quotes[] = $class; } } elseif ($GLOBALS[$class]->enabled) { $include_quotes[] = $class; } } $size = sizeof($include_quotes); for ($i = 0; $i < $size; $i++) { if ($quotes = $GLOBALS[$include_quotes[$i]]->quote($shipHash)) { if (!empty($quotes['methods'])) { foreach (array_keys($quotes['methods']) as $j) { $quotes['methods'][$j]['cost_add_tax'] = zen_add_tax($quotes['methods'][$j]['cost'], isset($quotes['tax']) ? $quotes['tax'] : 0); $quotes['methods'][$j]['format_add_tax'] = $currencies->format($quotes['methods'][$j]['cost_add_tax']); } } $quotes_array[] = $quotes; } } } return $quotes_array; }
function display_links($query_numrows, $max_rows_per_page, $max_page_links, $current_page_number, $parameters = '', $page_name = 'page') { global $PHP_SELF; $current_page_number = (int) $current_page_number; if (zen_not_null($parameters) && substr($parameters, -1) != '&') { $parameters .= '&'; } if ($max_rows_per_page == 0) { $max_rows_per_page = 20; } if ($query_numrows == 0) { return ''; } // calculate number of pages needing links if ($max_rows_per_page == '' || $max_rows_per_page == 0) { $max_rows_per_page = $query_numrows; } $num_pages = ceil($query_numrows / $max_rows_per_page); $pages_array = array(); for ($i = 1; $i <= $num_pages; $i++) { $pages_array[] = array('id' => $i, 'text' => $i); } if ($num_pages > 1) { $display_links = zen_draw_form('pages', basename($PHP_SELF), '', 'get'); if ($current_page_number > 1) { $display_links .= '<a href="' . zen_href_link(basename($PHP_SELF), $parameters . $page_name . '=' . ($current_page_number - 1), 'NONSSL') . '" class="splitPageLink">' . PREVNEXT_BUTTON_PREV . '</a> '; } else { $display_links .= PREVNEXT_BUTTON_PREV . ' '; } $display_links .= sprintf(TEXT_RESULT_PAGE, zen_draw_pull_down_menu($page_name, $pages_array, $current_page_number, 'onChange="this.form.submit();"'), $num_pages); if ($current_page_number < $num_pages && $num_pages != 1) { $display_links .= ' <a href="' . zen_href_link(basename($PHP_SELF), $parameters . $page_name . '=' . ($current_page_number + 1), 'NONSSL') . '" class="splitPageLink">' . PREVNEXT_BUTTON_NEXT . '</a>'; } else { $display_links .= ' ' . PREVNEXT_BUTTON_NEXT; } if ($parameters != '') { if (substr($parameters, -1) == '&') { $parameters = substr($parameters, 0, -1); } $pairs = explode('&', $parameters); while (list(, $pair) = each($pairs)) { list($key, $value) = explode('=', $pair); $display_links .= zen_draw_hidden_field(rawurldecode($key), rawurldecode($value)); } } if (SID) { $display_links .= zen_draw_hidden_field(zen_session_name(), zen_session_id()); } $display_links .= '</form>'; } else { $display_links = sprintf(TEXT_RESULT_PAGE, $num_pages, $num_pages); } return $display_links; }
function quote($pShipHash = array()) { global $order; $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_STOREPICKUP_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'code' => $this->code, 'title' => MODULE_SHIPPING_STOREPICKUP_TEXT_WAY, 'cost' => MODULE_SHIPPING_STOREPICKUP_COST))); if ($this->tax_class > 0) { $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['countries_id'], $order->delivery['zone_id']); } if (zen_not_null($this->icon)) { $this->quotes['icon'] = $this->icon; } return $this->quotes; }
function quote($method = '') { global $order; $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_FREESHIPPER_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_FREESHIPPER_TEXT_WAY, 'cost' => MODULE_SHIPPING_FREESHIPPER_COST + MODULE_SHIPPING_FREESHIPPER_HANDLING))); if ($this->tax_class > 0) { $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); } if (zen_not_null($this->icon)) { $this->quotes['icon'] = zen_image($this->icon, $this->title); } return $this->quotes; }
function checkdnsrr($host, $type) { if (zen_not_null($host) && zen_not_null($type)) { @exec("nslookup -type={$type} {$host}", $output); while (list($k, $line) = each($output)) { if (preg_match("/^" . $host . "/i", $line)) { return true; } } } return false; }
function un_get_fullname($firstname = '', $lastname = '', $default = '') { if (zen_not_null($firstname) && zen_not_null($lastname)) { $name = $firstname . " " . $lastname; } elseif (zen_not_null($firstname)) { $name = $firstname; } elseif (zen_not_null($lastname)) { $name = $lastname; } else { $name = $default; } return zen_output_string_protected($name); }
function zen_validate_password($plain, $encrypted) { if (zen_not_null($plain) && zen_not_null($encrypted)) { // split apart the hash / salt $stack = explode(':', $encrypted); if (sizeof($stack) != 2) { return false; } if (md5($stack[1] . $plain) == $stack[0]) { return true; } } return false; }
function quote($method = '') { global $order, $total_count; // adjusted count for free shipping $item_total_count = $total_count - $_SESSION['cart']->free_shipping_items(); $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_ITEM_TEXT_WAY, 'cost' => MODULE_SHIPPING_ITEM_COST * $item_total_count + MODULE_SHIPPING_ITEM_HANDLING))); if ($this->tax_class > 0) { $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); } if (zen_not_null($this->icon)) { $this->quotes['icon'] = zen_image($this->icon, $this->title); } return $this->quotes; }
function __construct($module = '') { global $payment, $gBitCustomer; if (defined('MODULE_PAYMENT_INSTALLED') && zen_not_null(MODULE_PAYMENT_INSTALLED)) { $this->modules = explode(';', MODULE_PAYMENT_INSTALLED); $include_modules = array(); if (zen_not_null($module) && in_array($module . '.' . substr($_SERVER['SCRIPT_NAME'], strrpos($_SERVER['SCRIPT_NAME'], '.') + 1), $this->modules)) { $this->selected_module = $module; $include_modules[] = array('class' => $module, 'file' => $module . '.php'); } else { reset($this->modules); // Free Payment Only shows if (zen_get_configuration_key_value('MODULE_PAYMENT_FREECHARGER_STATUS') and ($gBitCustomer->mCart->show_total() == 0 and $gBitCustomer->mCart->show_weight() == 0)) { $this->selected_module = $module; if (file_exists(DIR_FS_CATALOG . DIR_WS_MODULES . '/payment/' . 'freecharger.php')) { $include_modules[] = array('class' => 'freecharger', 'file' => 'freecharger.php'); } } else { // All Other Payment Modules show while (list(, $value) = each($this->modules)) { // double check that the module really exists before adding to the array if (file_exists(DIR_FS_CATALOG . DIR_WS_MODULES . '/payment/' . $value)) { $class = substr($value, 0, strrpos($value, '.')); // Don't show Free Payment Module if ($class != 'freecharger') { $include_modules[] = array('class' => $class, 'file' => $value); } } } } } for ($i = 0, $n = sizeof($include_modules); $i < $n; $i++) { $langFile = zen_get_file_directory(DIR_WS_LANGUAGES . $gBitCustomer->getLanguage() . '/modules/payment/', $include_modules[$i]['file'], 'false'); if (file_exists($langFile)) { include $langFile; } include DIR_WS_MODULES . 'payment/' . $include_modules[$i]['file']; $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class'](); } // if there is only one payment method, select it as default because in // checkout_confirmation.php the $payment variable is being assigned the // $_POST['payment'] value which will be empty (no radio button selection possible) if (zen_count_payment_modules() == 1 && (!isset($_SESSION['payment']) || isset($_SESSION['payment']) && !is_object($_SESSION['payment']))) { $_SESSION['payment'] = $include_modules[0]['class']; } if (zen_not_null($module) && in_array($module, $this->modules) && isset($GLOBALS[$module]->form_action_url)) { $this->form_action_url = $GLOBALS[$module]->form_action_url; } } }
/** Product Finder mod * /includes/functions/extra_functions/product_finder.php * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: product_finder.php 2010-08-05 */ function zen_my_image_submit($image, $alt = '', $parameters = '', $sec_class = '') { global $template, $current_page_base, $zco_notifier; $zco_notifier->notify('PAGE_OUTPUT_IMAGE_SUBMIT'); $image_submit = '<input type="image" src="' . zen_output_string($template->get_template_dir($image, DIR_WS_TEMPLATE, $current_page_base, 'buttons/' . $_SESSION['language'] . '/') . $image) . '" alt="' . zen_output_string($alt) . '"'; if (zen_not_null($alt)) { $image_submit .= ' title=" ' . zen_output_string($alt) . ' "'; } if (zen_not_null($parameters)) { $image_submit .= ' ' . $parameters; } $image_submit .= ' />'; return $image_submit; }
function trail($separator = ' ') { $trail_string = ''; for ($i = 0, $n = sizeof($this->_trail); $i < $n; $i++) { if (isset($this->_trail[$i]['link']) && zen_not_null($this->_trail[$i]['link'])) { $trail_string .= '<a href="' . $this->_trail[$i]['link'] . '">' . $this->_trail[$i]['title'] . '</a>'; } else { $trail_string .= $this->_trail[$i]['title']; } if ($i + 1 < $n) { $trail_string .= $separator; } } return $trail_string; }
function password_verify($plain, $encrypted) { if (zen_not_null($plain) && zen_not_null($encrypted)) { $stack = explode(':', $encrypted); if (sizeof($stack) != 2) { return false; } if (zcPassword::getInstance(PHP_VERSION)->validatePasswordOldMd5($plain, $encrypted) === true) { return true; } elseif (zcPassword::getInstance(PHP_VERSION)->validatePasswordCompatSha256($plain, $encrypted) === true) { return true; } } return false; }