• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP zen_get_zone_code函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中zen_get_zone_code函数的典型用法代码示例。如果您正苦于以下问题:PHP zen_get_zone_code函数的具体用法?PHP zen_get_zone_code怎么用?PHP zen_get_zone_code使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了zen_get_zone_code函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: zen_address_format

function zen_address_format($zen, $data, $pre)
{
    $company = $data[$pre . 'company'];
    $name = isset($data[$pre . 'firstname']) ? $data[$pre . 'firstname'] . ' ' . $data[$pre . 'lastname'] : false;
    $street_address = $data[$pre . 'street_address'];
    $suburb = $data[$pre . 'suburb'];
    $city = $data[$pre . 'city'];
    $postcode = $data[$pre . 'postcode'];
    if (not_null($data[$pre . 'state'])) {
        $state = $data[$pre . 'state'];
    } else {
        if (not_null($data[$pre . 'zone_id'])) {
            $state = zen_get_zone_code_from_id($zen, $data[$pre . 'zone_id']);
        }
    }
    if (isset($data[$pre . 'country_id'])) {
        $country = zen_get_country($zen, $data[$pre . 'country_id']);
    } else {
        $country = $data[$pre . 'country'];
    }
    $ret = '';
    if (not_null($company)) {
        $ret .= $company . "\n";
    }
    $ret .= $name . "\n" . $street_address . "\n";
    if (not_null($suburb)) {
        $ret .= $suburb . "\n";
    }
    if (not_null($city)) {
        $ret .= $city;
    }
    if (not_null($state)) {
        $ret .= ", " . zen_get_zone_code($zen, $state);
    }
    if (not_null($postcode)) {
        $ret .= " " . $postcode . "\n";
    } else {
        $ret .= "\n";
    }
    if (not_null($country)) {
        $ret .= $country . "\n";
    }
    return $ret;
}
开发者ID:blestab,项目名称:frontaccounting,代码行数:44,代码来源:zencart.php


示例2: get_extend_param

 function get_extend_param()
 {
     global $order;
     // if shipping info is empty, use billing info
     if (empty($order->delivery['country'])) {
         $order->delivery = $order->billing;
     }
     // ship to country, state
     $ship_to_country = $order->delivery['country']['iso_code_2'];
     $ship_to_state = '';
     if (!in_array($ship_to_country, array('US', 'CA'))) {
         $ship_to_state = 'YT';
     } else {
         $ship_to_state = zen_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], '');
     }
     // telephone
     $telephone = $order->customer["telephone"];
     if (empty($telephone)) {
         $telephone = trim($order->billing["telephone"]);
     }
     if (empty($telephone)) {
         $telephone = trim($order->delivery["telephone"]);
     }
     // js return
     $js_return = '';
     if (isset($_SESSION['alipay_js_return'])) {
         $js_return = $_SESSION['alipay_js_return'];
     }
     $product_name = 'product total:' . $order->info['total'];
     $extend_param = array('ship_to_firstname' => $order->delivery["firstname"], 'ship_to_lastname' => $order->delivery["lastname"], 'ship_to_postalcode' => $order->delivery["postcode"], 'ship_to_phonenumber' => $order->delivery["telephone"], 'ship_to_street1' => $order->delivery['street_address'], 'ship_to_city' => $order->delivery['city'], 'ship_to_state' => $ship_to_state, 'ship_to_country' => $ship_to_country, 'ship_to_shipmethod' => 7, 'logistics_cost' => '', 'registration_name' => $order->customer["firstname"] . ' ' . $order->customer["lastname"], 'registration_email' => $order->customer['email_address'], 'registration_phone' => $telephone, 'product_name' => $product_name, 'js_return' => $js_return);
     $param_str = '';
     foreach ($extend_param as $key => $val) {
         if (!isset($val) || $val == '') {
             unset($extend_param[$key]);
         } else {
             $param_str .= $key . '^' . $val . '|';
         }
     }
     $param_str = substr($param_str, 0, -1);
     return $param_str;
 }
开发者ID:mahuidong,项目名称:doc,代码行数:41,代码来源:(Lucklaser-https)alipay_forcard.php


示例3: zen_address_format

function zen_address_format($address_format_id, $address, $html, $boln, $eoln)
{
    global $db;
    $address_format_query = "select address_format as format\n                             from " . TABLE_ADDRESS_FORMAT . "\n                             where address_format_id = '" . (int) $address_format_id . "'";
    $address_format = $db->Execute($address_format_query);
    //$company = zen_output_string_protected($address['company']);
    if (isset($address['firstname']) && zen_not_null($address['firstname'])) {
        $firstname = zen_output_string_protected($address['firstname']);
        $lastname = zen_output_string_protected($address['lastname']);
    } elseif (isset($address['name']) && zen_not_null($address['name'])) {
        $firstname = zen_output_string_protected($address['name']);
        $lastname = '';
    } else {
        $firstname = '';
        $lastname = '';
    }
    $street = zen_output_string_protected($address['street_address']);
    $suburb = zen_output_string_protected($address['suburb']);
    $city = zen_output_string_protected($address['city']);
    $state = zen_output_string_protected($address['state']);
    $phone = ENTRY_PHONE_NUMBER . zen_output_string_protected($address['phone']);
    if (isset($address['country_id']) && zen_not_null($address['country_id'])) {
        $country = zen_get_country_name($address['country_id']);
        if (isset($address['zone_id']) && zen_not_null($address['zone_id'])) {
            $state = zen_get_zone_code($address['country_id'], $address['zone_id'], $state);
        }
    } elseif (isset($address['country']) && zen_not_null($address['country'])) {
        if (is_array($address['country'])) {
            $country = zen_output_string_protected($address['country']['countries_name']);
        } else {
            $country = zen_output_string_protected($address['country']);
        }
    } else {
        $country = '';
    }
    $postcode = zen_output_string_protected($address['postcode']);
    $zip = $postcode;
    if ($html) {
        // HTML Mode
        $HR = '<hr />';
        $hr = '<hr />';
        if ($boln == '' && $eoln == "\n") {
            // Values not specified, use rational defaults
            $CR = '<br />';
            $cr = '<br />';
            $eoln = $cr;
        } else {
            // Use values supplied
            $CR = $eoln . $boln;
            $cr = $CR;
        }
    } else {
        // Text Mode
        $CR = $eoln;
        $cr = $CR;
        $HR = '----------------------------------------';
        $hr = '----------------------------------------';
    }
    $statecomma = '';
    $streets = $street;
    if ($suburb != '') {
        $streets = $street . ',' . $suburb;
    }
    if ($country == '') {
        if (is_array($address['country'])) {
            $country = zen_output_string_protected($address['country']['countries_name']);
        } else {
            $country = zen_output_string_protected($address['country']);
        }
    }
    if ($state != '') {
        $statecomma = $state . ', ';
    }
    $fmt = $address_format->fields['format'];
    eval("\$address_out = \"{$fmt}\";");
    return $address_out;
}
开发者ID:happyxlq,项目名称:lt_svn,代码行数:77,代码来源:functions_customers.php


示例4: process_button

 /**
  * Build the data and actions to process when the "Submit" button is pressed on the order-confirmation screen.
  * This sends the data to the payment gateway for processing.
  * (These are hidden fields on the checkout confirmation page)
  *
  * @return string
  */
 function process_button()
 {
     global $db, $order, $currencies, $currency;
     $this->totalsum = $order->info['total'];
     // save the session stuff permanently in case paypal loses the session
     $db->Execute("delete from " . TABLE_PAYPAL_SESSION . " where session_id = '" . session_id() . "'");
     $sql = "insert into " . TABLE_PAYPAL_SESSION . " (session_id, saved_session, expiry) values (\r\n            '" . session_id() . "',\r\n            '" . base64_encode(serialize($_SESSION)) . "',\r\n            '" . (time() + 1 * 60 * 60 * 24 * 2) . "')";
     $db->Execute($sql);
     if (MODULE_PAYMENT_PAYPAL_CURRENCY == 'Selected Currency') {
         $my_currency = $_SESSION['currency'];
     } else {
         $my_currency = substr(MODULE_PAYMENT_PAYPAL_CURRENCY, 5);
     }
     if (!in_array($my_currency, array('CAD', 'EUR', 'GBP', 'JPY', 'USD', 'AUD'))) {
         $my_currency = 'USD';
     }
     $telephone = preg_replace('/\\D/', '', $order->customer['telephone']);
     $process_button_string = zen_draw_hidden_field('business', MODULE_PAYMENT_PAYPAL_BUSINESS_ID) . zen_draw_hidden_field('cmd', '_ext-enter') . zen_draw_hidden_field('return', zen_href_link(FILENAME_CHECKOUT_PROCESS, 'referer=paypal', 'SSL')) . zen_draw_hidden_field('cancel_return', zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')) . zen_draw_hidden_field('notify_url', zen_href_link('ipn_main_handler.php', '', 'SSL', false, false, true)) . zen_draw_hidden_field('rm', MODULE_PAYMENT_PAYPAL_RM) . zen_draw_hidden_field('currency_code', $my_currency) . zen_draw_hidden_field('bn', 'zencart') . zen_draw_hidden_field('mrb', 'R-6C7952342H795591R') . zen_draw_hidden_field('pal', '9E82WJBKKGPLQ') . zen_draw_hidden_field('cbt', MODULE_PAYMENT_PAYPAL_CBT) . zen_draw_hidden_field('image_url', MODULE_PAYMENT_PAYPAL_IMAGE_URL) . zen_draw_hidden_field('page_style', MODULE_PAYMENT_PAYPAL_PAGE_STYLE) . zen_draw_hidden_field('item_name', STORE_NAME) . zen_draw_hidden_field('item_number', '1') . zen_draw_hidden_field('lc', $order->customer['country']['iso_code_2']) . zen_draw_hidden_field('amount', number_format($this->totalsum * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) . zen_draw_hidden_field('shipping', '0.00') . zen_draw_hidden_field('custom', zen_session_name() . '=' . zen_session_id()) . zen_draw_hidden_field('upload', sizeof($order->products)) . zen_draw_hidden_field('redirect_cmd', '_xclick') . zen_draw_hidden_field('first_name', $order->customer['lastname']) . zen_draw_hidden_field('last_name', $order->customer['firstname']) . zen_draw_hidden_field('address1', $order->customer['street_address']) . zen_draw_hidden_field('city', $order->customer['city']) . zen_draw_hidden_field('state', zen_get_zone_code($order->customer['country']['id'], $order->customer['zone_id'], $order->customer['zone_id'])) . zen_draw_hidden_field('zip', $order->customer['postcode']) . zen_draw_hidden_field('country', $order->customer['country']['iso_code_2']) . zen_draw_hidden_field('email', $order->customer['email_address']) . zen_draw_hidden_field('night_phone_a', substr($telephone, 0, 3)) . zen_draw_hidden_field('night_phone_b', substr($telephone, 3, 3)) . zen_draw_hidden_field('night_phone_c', substr($telephone, 6, 4)) . zen_draw_hidden_field('day_phone_a', substr($telephone, 0, 3)) . zen_draw_hidden_field('day_phone_b', substr($telephone, 3, 3)) . zen_draw_hidden_field('day_phone_c', substr($telephone, 6, 4)) . zen_draw_hidden_field('paypal_order_id', $paypal_order_id);
     return $process_button_string;
 }
开发者ID:sgkohata,项目名称:zencart-sugu,代码行数:27,代码来源:paypal.php


示例5: quote

 function quote($pShipHash = array())
 {
     /* FedEx integration starts */
     global $gBitCustomer, $order;
     require_once dirname(__FILE__) . '/fedex-common.php5';
     ini_set("soap.wsdl_cache_enabled", "0");
     $shippingWeight = !empty($pShipHash['shipping_weight']) && $pShipHash['shipping_weight'] > 1 ? $pShipHash['shipping_weight'] : 1;
     $shippingNumBoxes = !empty($pShipHash['shipping_num_boxes']) ? $pShipHash['shipping_num_boxes'] : 1;
     $client = new SoapClient(dirname(__FILE__) . "/RateService_v10.wsdl", array('trace' => 1));
     $this->types = array();
     if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_PRIORITY == 'true') {
         $this->types['INTERNATIONAL_PRIORITY'] = array('code' => 'FEDEX_INTERNATIONAL_PRIORITY', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE);
         $this->types['EUROPE_FIRST_INTERNATIONAL_PRIORITY'] = array('code' => 'FEDEX_EUROPE_FIRST_INTERNATIONAL_PRIORITY', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE);
     }
     if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_ECONOMY == 'true') {
         $this->types['INTERNATIONAL_ECONOMY'] = array('code' => 'FEDEX_INTERNATIONAL_ECONOMY', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE);
     }
     if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_STANDARD_OVERNIGHT == 'true') {
         $this->types['STANDARD_OVERNIGHT'] = array('code' => 'FEDEX_STANDARD_OVERNIGHT', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE);
     }
     if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_FIRST_OVERNIGHT == 'true') {
         $this->types['FIRST_OVERNIGHT'] = array('code' => 'FEDEX_FIRST_OVERNIGHT', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE);
     }
     if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_PRIORITY_OVERNIGHT == 'true') {
         $this->types['PRIORITY_OVERNIGHT'] = array('code' => 'FEDEX_PRIORITY_OVERNIGHT', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE);
     }
     if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_2DAY == 'true') {
         $this->types['FEDEX_2_DAY'] = array('code' => 'FEDEX_2_DAY', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE);
     }
     // because FEDEX_GROUND also is returned for Canadian Addresses, we need to check if the country matches the store country and whether international ground is enabled
     if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_GROUND == 'true' && $order->delivery['country']['countries_id'] == STORE_COUNTRY || MODULE_SHIPPING_FEDEX_WEB_SERVICES_GROUND == 'true' && $order->delivery['country']['countries_id'] != STORE_COUNTRY && MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_GROUND == 'true') {
         $this->types['FEDEX_GROUND'] = array('code' => 'FEDEX_GROUND', 'icon' => '', 'handling_fee' => $order->delivery['country']['countries_id'] == STORE_COUNTRY ? MODULE_SHIPPING_FEDEX_WEB_SERVICES_HANDLING_FEE : MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_HANDLING_FEE);
         $this->types['GROUND_HOME_DELIVERY'] = array('code' => 'FEDEX_GROUND_HOME_DELIVERY', 'icon' => '', 'handling_fee' => $order->delivery['country']['countries_id'] == STORE_COUNTRY ? MODULE_SHIPPING_FEDEX_WEB_SERVICES_HANDLING_FEE : MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_HANDLING_FEE);
     }
     if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_GROUND == 'true') {
         $this->types['INTERNATIONAL_GROUND'] = array('code' => 'FEDEX_INTERNATIONAL_GROUND', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_HANDLING_FEE);
     }
     if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_SAVER == 'true') {
         $this->types['FEDEX_EXPRESS_SAVER'] = array('code' => 'FEDEX_EXPRESS_SAVER', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE);
     }
     if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_FREIGHT == 'true') {
         $this->types['FEDEX_FREIGHT'] = array('code' => 'FEDEX_FREIGHT', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE);
         $this->types['FEDEX_NATIONAL_FREIGHT'] = array('code' => 'FEDEX_NATIONAL_FREIGHT', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE);
         $this->types['FEDEX_1_DAY_FREIGHT'] = array('code' => 'FEDEX_1_DAY_FREIGHT', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE);
         $this->types['FEDEX_2_DAY_FREIGHT'] = array('code' => 'FEDEX_2_DAY_FREIGHT', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE);
         $this->types['FEDEX_3_DAY_FREIGHT'] = array('code' => 'FEDEX_3_DAY_FREIGHT', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE);
         $this->types['INTERNATIONAL_ECONOMY_FREIGHT'] = array('code' => 'FEDEX_INTERNATIONAL_ECONOMY_FREIGHT', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE);
         $this->types['INTERNATIONAL_PRIORITY_FREIGHT'] = array('code' => 'FEDEX_INTERNATIONAL_PRIORITY_FREIGHT', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE);
     }
     // customer details
     $street_address = !empty($order->delivery['street_address']) ? $order->delivery['street_address'] : '';
     $street_address2 = !empty($order->delivery['suburb']) ? $order->delivery['suburb'] : '';
     $city = !empty($order->delivery['city']) ? $order->delivery['city'] : '';
     if ($stateLookup = BitBase::getParameter($order->delivery, 'zone_id', BitBase::getParameter($order->delivery, 'state'))) {
         $stateCode = zen_get_zone_code($order->delivery['country']['countries_id'], $stateLookup, '');
         if ($stateCode == "QC") {
             $stateCode = "PQ";
             // is this needed? been here forever
         }
     }
     $postcode = str_replace(array(' ', '-'), '', $order->delivery['postcode']);
     $country_id = $order->delivery['country']['countries_iso_code_2'];
     if (is_object($order)) {
         $totals = $order->subtotal;
     } elseif (is_object($gBitCustomer->mCart)) {
         $totals = $gBitCustomer->mCart->show_total();
     }
     $this->_setInsuranceValue($totals);
     $request['WebAuthenticationDetail'] = array('UserCredential' => array('Key' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_KEY, 'Password' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_PWD));
     $request['ClientDetail'] = array('AccountNumber' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_ACT_NUM, 'MeterNumber' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_METER_NUM);
     $request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Rate Request v10 using PHP ***');
     $request['Version'] = array('ServiceId' => 'crs', 'Major' => '10', 'Intermediate' => '0', 'Minor' => '0');
     $request['ReturnTransitAndCommit'] = true;
     $request['RequestedShipment']['DropoffType'] = $this->_setDropOff();
     // valid values REGULAR_PICKUP, REQUEST_COURIER, ...
     $request['RequestedShipment']['ShipTimestamp'] = date('c');
     //if (zen_not_null($method) && in_array($method, $this->types)) {
     //$request['RequestedShipment']['ServiceType'] = $method; // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
     //}
     $request['RequestedShipment']['PackagingType'] = 'YOUR_PACKAGING';
     // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
     $request['RequestedShipment']['TotalInsuredValue'] = array('Amount' => $this->insurance, 'Currency' => DEFAULT_CURRENCY);
     $request['WebAuthenticationDetail'] = array('UserCredential' => array('Key' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_KEY, 'Password' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_PWD));
     $request['ClientDetail'] = array('AccountNumber' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_ACT_NUM, 'MeterNumber' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_METER_NUM);
     $request['RequestedShipment']['Shipper'] = array('Address' => array('StreetLines' => array(MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_1, MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_2), 'City' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_CITY, 'StateOrProvinceCode' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATE, 'PostalCode' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_POSTAL, 'CountryCode' => $this->country));
     $request['RequestedShipment']['Recipient'] = array('Address' => array('StreetLines' => array(utf8_encode($street_address), utf8_encode($street_address2)), 'City' => utf8_encode($city), 'PostalCode' => $postcode, 'CountryCode' => $country_id, 'Residential' => empty($order->delivery['company'])));
     //customer county code
     if (!empty($stateCode) && in_array($country_id, array('US', 'CA'))) {
         $request['RequestedShipment']['Recipient']['StateOrProvinceCode'] = $stateCode;
     }
     $request['RequestedShipment']['ShippingChargesPayment'] = array('PaymentType' => 'SENDER', 'Payor' => array('AccountNumber' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_ACT_NUM, 'CountryCode' => $this->country));
     $request['RequestedShipment']['RateRequestTypes'] = 'LIST';
     $request['RequestedShipment']['PackageDetail'] = 'INDIVIDUAL_PACKAGES';
     $request['RequestedShipment']['RequestedPackageLineItems'] = array();
     $dimensions_failed = false;
     // check for ready to ship field
     if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_READY_TO_SHIP == 'true') {
         // Not fixed for bitcommerce
         $products = $gBitCustomer->mCart->get_products();
         $packages = array('default' => 0);
//.........这里部分代码省略.........
开发者ID:bitweaver,项目名称:commerce,代码行数:101,代码来源:fedexwebservices.php


示例6: process_button

 /**
  * Build the data and actions to process when the "Submit" button is pressed on the order-confirmation screen.
  * This sends the data to the payment gateway for processing.
  * (These are hidden fields on the checkout confirmation page)
  *
  * @return string
  */
 function process_button()
 {
     global $db, $order, $currencies, $currency;
     $options = array();
     $optionsCore = array();
     $optionsPhone = array();
     $optionsShip = array();
     $optionsLineItems = array();
     $optionsAggregate = array();
     $optionsTrans = array();
     $buttonArray = array();
     // save the session stuff permanently in case paypal loses the session
     $_SESSION['ppipn_key_to_remove'] = session_id();
     $db->Execute("delete from " . TABLE_PAYPAL_SESSION . " where session_id = '" . zen_db_input($_SESSION['ppipn_key_to_remove']) . "'");
     $sql = "insert into " . TABLE_PAYPAL_SESSION . " (session_id, saved_session, expiry) values (\n            '" . zen_db_input($_SESSION['ppipn_key_to_remove']) . "',\n            '" . base64_encode(serialize($_SESSION)) . "',\n            '" . (time() + 1 * 60 * 60 * 24 * 2) . "')";
     $db->Execute($sql);
     $my_currency = select_pp_currency();
     $this->transaction_currency = $my_currency;
     $this->totalsum = $order->info['total'] = zen_round($order->info['total'], 2);
     $this->transaction_amount = zen_round($this->totalsum * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
     $telephone = preg_replace('/\\D/', '', $order->customer['telephone']);
     if ($telephone != '') {
         $optionsPhone['H_PhoneNumber'] = $telephone;
         if (in_array($order->customer['country']['iso_code_2'], array('US', 'CA'))) {
             $optionsPhone['night_phone_a'] = substr($telephone, 0, 3);
             $optionsPhone['night_phone_b'] = substr($telephone, 3, 3);
             $optionsPhone['night_phone_c'] = substr($telephone, 6, 4);
             $optionsPhone['day_phone_a'] = substr($telephone, 0, 3);
             $optionsPhone['day_phone_b'] = substr($telephone, 3, 3);
             $optionsPhone['day_phone_c'] = substr($telephone, 6, 4);
         } else {
             $optionsPhone['night_phone_b'] = $telephone;
             $optionsPhone['day_phone_b'] = $telephone;
         }
     }
     $optionsCore = array('lc' => $this->getLanguageCode(), 'charset' => CHARSET, 'page_style' => MODULE_PAYMENT_PAYPAL_PAGE_STYLE, 'custom' => zen_session_name() . '=' . zen_session_id(), 'business' => MODULE_PAYMENT_PAYPAL_BUSINESS_ID, 'return' => zen_href_link(FILENAME_CHECKOUT_PROCESS, 'referer=paypal', 'SSL'), 'cancel_return' => zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'), 'shopping_url' => zen_href_link(FILENAME_SHOPPING_CART, '', 'SSL'), 'notify_url' => zen_href_link('ipn_main_handler.php', '', 'SSL', false, false, true), 'redirect_cmd' => '_xclick', 'rm' => 2, 'bn' => 'CNZcart_Cart_EC', 'mrb' => 'R-4DM17246PS436904F', 'pal' => 'GR5QUVVL9AFGN');
     $optionsCust = array('first_name' => replace_accents($order->customer['firstname']), 'last_name' => replace_accents($order->customer['lastname']), 'address1' => replace_accents($order->customer['street_address']), 'city' => replace_accents($order->customer['city']), 'state' => zen_get_zone_code($order->customer['country']['id'], $order->customer['zone_id'], $order->customer['state']), 'zip' => $order->customer['postcode'], 'country' => $order->customer['country']['iso_code_2'], 'email' => $order->customer['email_address']);
     // address line 2 is optional
     if ($order->customer['suburb'] != '') {
         $optionsCust['address2'] = $order->customer['suburb'];
     }
     // different format for Japanese address layout:
     if ($order->customer['country']['iso_code_2'] == 'JP') {
         $optionsCust['zip'] = substr($order->customer['postcode'], 0, 3) . '-' . substr($order->customer['postcode'], 3);
     }
     if (MODULE_PAYMENT_PAYPAL_ADDRESS_REQUIRED == 2) {
         $optionsCust = array('first_name' => replace_accents($order->delivery['firstname'] != '' ? $order->delivery['firstname'] : $order->billing['firstname']), 'last_name' => replace_accents($order->delivery['lastname'] != '' ? $order->delivery['lastname'] : $order->billing['lastname']), 'address1' => replace_accents($order->delivery['street_address'] != '' ? $order->delivery['street_address'] : $order->billing['street_address']), 'city' => replace_accents($order->delivery['city'] != '' ? $order->delivery['city'] : $order->billing['city']), 'state' => $order->delivery['country']['id'] != '' ? zen_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], $order->delivery['state']) : zen_get_zone_code($order->billing['country']['id'], $order->billing['zone_id'], $order->billing['state']), 'zip' => $order->delivery['postcode'] != '' ? $order->delivery['postcode'] : $order->billing['postcode'], 'country' => $order->delivery['country']['title'] != '' ? $order->delivery['country']['title'] : $order->billing['country']['title'], 'country_code' => $order->delivery['country']['iso_code_2'] != '' ? $order->delivery['country']['iso_code_2'] : $order->billing['country']['iso_code_2'], 'email' => $order->customer['email_address']);
         if ($order->delivery['suburb'] != '') {
             $optionsCust['address2'] = $order->delivery['suburb'];
         }
         if ($order->delivery['country']['iso_code_2'] == 'JP') {
             $optionsCust['zip'] = substr($order->delivery['postcode'], 0, 3) . '-' . substr($order->delivery['postcode'], 3);
         }
     }
     $optionsShip['no_shipping'] = MODULE_PAYMENT_PAYPAL_ADDRESS_REQUIRED;
     if (MODULE_PAYMENT_PAYPAL_ADDRESS_OVERRIDE == '1') {
         $optionsShip['address_override'] = MODULE_PAYMENT_PAYPAL_ADDRESS_OVERRIDE;
     }
     // prepare cart contents details where possible
     if (MODULE_PAYMENT_PAYPAL_DETAILED_CART == 'Yes') {
         $optionsLineItems = ipn_getLineItemDetails($my_currency);
     }
     if (sizeof($optionsLineItems) > 0) {
         $optionsLineItems['cmd'] = '_cart';
         // $optionsLineItems['num_cart_items'] = sizeof($order->products);
         if (isset($optionsLineItems['shipping'])) {
             $optionsLineItems['shipping_1'] = $optionsLineItems['shipping'];
             unset($optionsLineItems['shipping']);
         }
         unset($optionsLineItems['subtotal']);
         // if line-item details couldn't be kept due to calculation mismatches or discounts etc, default to aggregate mode
         if (!isset($optionsLineItems['item_name_1']) || $optionsLineItems['creditsExist'] == TRUE) {
             $optionsLineItems = array();
         }
         // if ($optionsLineItems['amount'] != $this->transaction_amount) $optionsLineItems = array();
         // debug:
         // ipn_debug_email('Line Item Details (if blank, this means there was a data mismatch or credits applied, and thus bypassed): ' . "\n" . print_r($optionsLineItems, true));
         unset($optionsLineItems['creditsExist']);
     }
     $optionsAggregate = array('cmd' => '_ext-enter', 'item_name' => MODULE_PAYMENT_PAYPAL_PURCHASE_DESCRIPTION_TITLE, 'item_number' => MODULE_PAYMENT_PAYPAL_PURCHASE_DESCRIPTION_ITEMNUM, 'amount' => number_format($this->transaction_amount, $currencies->get_decimal_places($my_currency)), 'shipping' => '0.00');
     if (MODULE_PAYMENT_PAYPAL_TAX_OVERRIDE == 'true') {
         $optionsAggregate['tax'] = '0.00';
     }
     if (MODULE_PAYMENT_PAYPAL_TAX_OVERRIDE == 'true') {
         $optionsAggregate['tax_cart'] = '0.00';
     }
     $optionsTrans = array('upload' => (int) (sizeof($order->products) > 0), 'currency_code' => $my_currency);
     // if line-item info is invalid, use aggregate:
     if (sizeof($optionsLineItems) > 0) {
         $optionsAggregate = $optionsLineItems;
     }
     if (defined('MODULE_PAYMENT_PAYPAL_LOGO_IMAGE')) {
         $optionsCore['cpp_logo_image'] = urlencode(MODULE_PAYMENT_LOGO_IMAGE);
//.........这里部分代码省略.........
开发者ID:wwxgitcat,项目名称:zencart_v1.0,代码行数:101,代码来源:paypal.php


示例7: zen_address_format

function zen_address_format($address_format_id, $address, $html, $boln, $eoln)
{
    global $db;
    $address_format = $db->Execute("select address_format as format\n                             from " . TABLE_ADDRESS_FORMAT . "\n                             where address_format_id = '" . (int) $address_format_id . "'");
    $company = zen_output_string_protected($address['company']);
    if (isset($address['firstname']) && zen_not_null($address['firstname'])) {
        $firstname = zen_output_string_protected($address['firstname']);
        $lastname = zen_output_string_protected($address['lastname']);
    } elseif (isset($address['name']) && zen_not_null($address['name'])) {
        $firstname = zen_output_string_protected($address['name']);
        $lastname = '';
    } else {
        $firstname = '';
        $lastname = '';
    }
    $street = zen_output_string_protected($address['street_address']);
    $suburb = zen_output_string_protected($address['suburb']);
    $city = zen_output_string_protected($address['city']);
    $state = zen_output_string_protected($address['state']);
    $telephone = zen_output_string_protected($address['telephone']);
    $fax = zen_output_string_protected($address['fax']);
    if (isset($address['country_id']) && zen_not_null($address['country_id'])) {
        $country = zen_get_country_name($address['country_id']);
        if (isset($address['zone_id']) && zen_not_null($address['zone_id'])) {
            $state = zen_get_zone_code($address['country_id'], $address['zone_id'], $state);
        }
    } elseif (isset($address['country']) && zen_not_null($address['country'])) {
        $country = zen_output_string_protected($address['country']);
    } else {
        $country = '';
    }
    $postcode = zen_output_string_protected($address['postcode']);
    $zip = $postcode;
    if ($html) {
        // HTML Mode
        $HR = '<hr>';
        $hr = '<hr>';
        if ($boln == '' && $eoln == "\n") {
            // Values not specified, use rational defaults
            $CR = '<br>';
            $cr = '<br>';
            $eoln = $cr;
        } else {
            // Use values supplied
            $CR = $eoln . $boln;
            $cr = $CR;
        }
    } else {
        // Text Mode
        $CR = $eoln;
        $cr = $CR;
        $HR = '----------------------------------------';
        $hr = '----------------------------------------';
    }
    $statecomma = '';
    $streets = $street;
    $state = zen_convert_to_zone_name_m17n($state) . ' ';
    if ($suburb != '') {
        $streets = $street . $cr . $suburb;
    }
    if ($country == '') {
        $country = zen_output_string_protected($address['country']);
    }
    if ($state != '') {
        $statecomma = $state . ', ';
    }
    if ($telephone != '') {
        $telephone = ENTRY_TELEPHONE_NUMBER . $telephone;
    }
    if ($fax != '') {
        $fax = ENTRY_FAX_NUMBER . $fax;
    }
    $fmt = $address_format->fields['format'];
    eval("\$address = \"{$fmt}\";");
    if (ACCOUNT_COMPANY == 'true' && zen_not_null($company)) {
        $address = $company . $cr . $address;
    }
    return $address;
}
开发者ID:homework-bazaar,项目名称:zencart-sugu,代码行数:79,代码来源:general.php


示例8: process_button

 function process_button()
 {
     global $db, $order, $currencies, $order_totals;
     $extend_param = '';
     $extend_param .= 'SHIP_TO_FIRSTNAME^' . ($order->customer['firstname'] == '' ? 'none' : $order->customer['firstname']);
     $extend_param .= '|SHIP_TO_LASTNAME^' . ($order->customer['lastname'] == '' ? 'none' : $order->customer['lastname']);
     $extend_param .= '|SHIP_TO_POSTALCODE^' . ($order->customer['postcode'] == '' ? '0' : $order->customer['postcode']);
     //---------------
     //$extend_param .='|JS_RETURN^'."<script type='text/javascript' src='http://irds.alipay.com/merchant/merchant.js'></script>";
     //---------------
     $extend_param .= '|SHIP_TO_PHONENUMBER^' . preg_replace('/\\D/', '', $order->customer['telephone']);
     $extend_param .= '|SHIP_TO_STREET1^' . ($order->customer['street_address'] == '' ? 'none' : $order->customer['street_address']);
     $extend_param .= '|SHIP_TO_CITY^' . ($order->customer['city'] == '' ? 'none' : $order->customer['city']);
     $extend_param .= '|SHIP_TO_STATE^' . zen_get_zone_code($order->customer['country']['id'], $order->customer['zone_id'], $order->customer['state']);
     //$extend_param .='|SHIP_TO_STATE^US-AL'; //vincent test,hard code
     $extend_param .= '|SHIP_TO_COUNTRY^' . $order->customer['country']['iso_code_2'];
     //$extend_param .='|SHIP_TO_COUNTRY^US'; //vincent test,hard code
     $extend_param .= '|SHIP_TO_SHIPMETHOD^EMS';
     $extend_param .= '|LOGISTICS_COST^0.00';
     $extend_param .= '|REGISTRATION_NAME^' . $order->customer['firstname'] . $order->customer['lastname'];
     $extend_param .= '|REGISTRATION_EMAIL^' . ($order->customer['email_address'] == '' ? 'none' : $order->customer['email_address']);
     $extend_param .= '|REGISTRATION_PHONE^' . preg_replace('/\\D/', '', $order->customer['telephone'] == '' ? 'none' : $order->customer['telephone']);
     $alipay_body = '';
     for ($i = 0; $i < sizeof($order->products); $i++) {
         $alipay_body = $order->products[$i]["name"] . "+" . $alipay_body;
     }
     $alipay_body = substr($alipay_body, 0, -1);
     if (strlen($alipay_body) < 250) {
         $alipay_body = substr($alipay_body, 0, strlen($alipay_body));
     } else {
         $alipay_body = substr($alipay_body, 250);
     }
     $alipay_body = str_replace(PHP_EOL, ' ', $alipay_body);
     $order->info['payment_method'] = MODULE_PAYMENT_ALIPAY_TEXT_CATALOG_TITLE;
     $order->info['payment_module_code'] = 'alipay';
     $insert_id = '';
     if (!isset($_SESSION['alipay_insert_id'])) {
         $insert_id = $order->create($order_totals, 2);
         $order->create_add_products($insert_id);
         $_SESSION['alipay_insert_id'] = $insert_id;
         $_SESSION['alipay_body'] = $alipay_body;
         $_SESSION['alipay_fee'] = $order->info['total'];
     } else {
         if ($_SESSION['alipay_body'] == $alipay_body && $_SESSION['alipay_fee'] == $order->info['total']) {
             $insert_id = $_SESSION['alipay_insert_id'];
         } else {
             $insert_id = $order->create($order_totals, 2);
             $order->create_add_products($insert_id);
             $_SESSION['alipay_insert_id'] = $insert_id;
             $_SESSION['alipay_body'] = $alipay_body;
             $_SESSION['alipay_fee'] = $order->info['total'];
         }
     }
     $order->info['payment_method'] = null;
     $order->info['payment_module_code'] = null;
     $extend_param .= '|product_name^' . $alipay_body;
     $extend_param = str_replace(PHP_EOL, ' ', $extend_param);
     $parameter = array('service' => 'alipay.trade.direct.forcard.pay', 'default_bank' => $_POST['alicardtype'], 'currency' => $order->info['currency'], 'extend_param' => $extend_param, '_input_charset' => 'utf-8', 'partner' => MODULE_PAYMENT_ALIPAY_PARTNER, 'seller_id' => MODULE_PAYMENT_ALIPAY_SELLER, 'return_url' => zen_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL'), 'notify_url' => zen_href_link('alipay_notify.php', '', 'SSL', false, false, true), "show_url" => zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'), 'out_trade_no' => $insert_id, 'subject' => 'order #' . $insert_id . ' from ' . STORE_NAME, 'body' => $alipay_body, "total_fee" => number_format($order->info['total'] * $currencies->get_value($order->info['currency']), '2', '.', ''));
     if ($_POST['alicardtype'] == 'boc-jcb') {
         unset($parameter['currency']);
         $value_cny = $currencies->get_value('CNY');
         if ($value_cny == 0) {
             $parameter['total_fee'] = '0.00';
         } else {
             $parameter['total_fee'] = number_format($order->info['total'] * $value_cny, '2', '.', '');
         }
     }
     $security_code = MODULE_PAYMENT_ALIPAY_MD5KEY;
     $mysign = $this->sign($parameter, $security_code);
     $fields = $this->arg_sort($parameter);
     $fields['sign_type'] = 'MD5';
     $fields['sign'] = $mysign;
     $process_button_string = '';
     while (list($key, $val) = each($fields)) {
         $process_button_string .= zen_draw_hidden_field($key, $val);
     }
     return $process_button_string;
 }
开发者ID:mahuidong,项目名称:doc,代码行数:78,代码来源:alipay.php


示例9: quote

 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;
 }
开发者ID:sgkohata,项目名称:zencart-sugu,代码行数:56,代码来源:sagawaex.php


示例10: zen_address_format

function zen_address_format($address_format_id, $address, $html, $boln, $eoln)
{
    global $gBitDb;
    $address_format_query = "select `address_format` as `format`\n                             from " . TABLE_ADDRESS_FORMAT . "\n                             where `address_format_id` = '" . (int) $address_format_id . "'";
    $address_format = $gBitDb->query($address_format_query);
    $company = zen_output_string_protected($address['company']);
    if (!empty($address['firstname'])) {
        $firstname = zen_output_string_protected($address['firstname']);
        $lastname = zen_output_string_protected($address['lastname']);
    } elseif (!empty($address['name'])) {
        $firstname = zen_output_string_protected($address['name']);
        $lastname = '';
    } else {
        $firstname = '';
        $lastname = '';
    }
    $street = zen_output_string_protected($address['street_address']);
    $suburb = zen_output_string_protected($address['suburb']);
    $city = zen_output_string_protected($address['city']);
    $state = zen_output_string_protected($address['state']);
    $telephone = isset($address['telephone']) ? zen_output_string_protected($address['telephone']) : NULL;
    if (!empty($address['country_id'])) {
        $country = zen_get_country_name($address['country_id']);
        if (!empty($address['zone_id'])) {
            $state = zen_get_zone_code($address['country_id'], $address['zone_id'], $state);
        }
    } elseif (!empty($address['country'])) {
        if (is_array($address['country'])) {
            $country = zen_output_string_protected($address['country']['countries_name']);
        } else {
            $country = zen_output_string_protected($address['country']);
        }
    } else {
        $country = '';
    }
    $postcode = zen_output_string_protected($address['postcode']);
    $zip = $postcode;
    if ($html) {
        // HTML Mode
        $HR = '<hr />';
        $hr = '<hr />';
        if (empty($boln) && $eoln == "\n") {
            // Values not specified, use rational defaults
            $CR = '<br />';
            $cr = '<br />';
            $eoln = $cr;
        } else {
            // Use values supplied
            $CR = $eoln . $boln;
            $cr = $CR;
        }
    } else {
        // Text Mode
        $CR = $eoln;
        $cr = $CR;
        $HR = '----------------------------------------';
        $hr = '----------------------------------------';
    }
    $statecomma = '';
    $streets = $street;
    if ($suburb != '') {
        $streets = $street . $cr . $suburb;
    }
    if (empty($country)) {
        if (is_array($address['country'])) {
            $country = zen_output_string_protected($address['country']['countries_name']);
        } else {
            $country = zen_output_string_protected($address['country']);
        }
    }
    if ($state != '') {
        $statecomma = $state . ', ';
    }
    $fmt = $address_format->fields['format'];
    eval("\$address_out = \"{$fmt}\";");
    if (!empty($telephone)) {
        $address_out .= $cr . $telephone;
    }
    if (ACCOUNT_COMPANY == 'true' && zen_not_null($company)) {
        $address_out = $company . $cr . $address_out;
    }
    return $address_out;
}
开发者ID:bitweaver,项目名称:commerce,代码行数:83,代码来源:common_inc.php


示例11: quote

 /**
  * Get quote from shipping provider's API:
  *
  * @param string $method
  * @return array of quotation results
  */
 function quote($pShipHash = array())
 {
     global $order, $handling_cp;
     $shippingWeight = !empty($pShipHash['shipping_weight']) && $pShipHash['shipping_weight'] > 0.1 ? $pShipHash['shipping_weight'] : 0.1;
     $shippingNumBoxes = !empty($pShipHash['shipping_num_boxes']) ? $pShipHash['shipping_num_boxes'] : 1;
     // will round to 2 decimals 9.112 becomes 9.11 thus a product can be 0.1 of a KG
     $shippingWeight = round($shippingWeight, 2);
     $ret = array();
     if ($shippingWeight < MODULE_SHIPPING_PUROLATOR_MAXWEIGHT) {
         $ret = array('id' => $this->code, 'module' => $this->title, 'icon' => $this->icon);
         $country_name = zen_get_countries(STORE_COUNTRY, true);
         $this->_purolatorOrigin(SHIPPING_ORIGIN_ZIP, $country_name['countries_iso_code_2']);
         if (strlen($order->delivery['state']) > 2 && $order->delivery['zone_id'] > 0) {
             $state_name = zen_get_zone_code($order->delivery['country_id'], $order->delivery['zone_id'], '');
             $order->delivery['state'] = $state_name;
         }
         $this->_purolatorDest($order->delivery['city'], $order->delivery['state'], $order->delivery['country']['countries_iso_code_2'], $order->delivery['postcode']);
         /** Purpose : Creates a SOAP Client in Non-WSDL mode with the appropriate authentication and
          *		   header information
          * */
         require_once dirname(__FILE__) . '/nusoap/nusoap.php';
         //Set the parameters for the Non-WSDL mode SOAP communication with your Development/Production credentials
         $this->client = new nusoap_client(HTTP_SERVER . "/EstimatingService.wsdl", 'wsdl');
         $this->client->setCredentials($this->key, $this->pass, 'basic');
         //if($this->client->getError()) echo '<!--Auth Error: '.$this->client->getError().'-->'; //commented, used to test for authorisation errors
         //Define the SOAP Envelope Headers
         $handheader = '<ns1:RequestContext xmlns:ns1="' . $this->uri . '"><ns1:Version>1.0</ns1:Version><ns1:Language>' . $this->language . '</ns1:Language><ns1:GroupID>xxx</ns1:GroupID><ns1:RequestReference>Rating Example</ns1:RequestReference></ns1:RequestContext>';
         //Apply the SOAP Header to your client
         $this->client->setHeaders($handheader);
         //if($this->client->getError()) echo PHP_EOL.'<!--Header Error: '.$this->client->getError().'-->'. PHP_EOL;  //commented, used to test for header errors
         $params = array("BillingAccountNumber" => $this->acct_num, "SenderPostalCode" => $this->_purolatorOriginPostalCode, "ReceiverAddress" => array("City" => '', "Province" => $this->dest_province, "Country" => $this->dest_country, "PostalCode" => $this->dest_zip), "PackageType" => $this->packaging, "TotalWeight" => array("Value" => $shippingWeight, "WeightUnit" => "lb"));
         //Execute the request and capture the response
         $this->response = $this->client->call('GetQuickEstimate', array('GetQuickEstimateRequest' => $params));
         //  echo PHP_EOL.'<!--'; print_r($params); echo '-->'. PHP_EOL; // for testing. Prints out the entire send in a comment.
         //start error checkin module (ya, I know it's overkill)
         /*
          if ($this->client->fault) {
          echo '<!--Fault: ';
          print_r($result);
          echo '-->';
          } else {
          // Check for errors
          $err = $this->client->getError();
          if ($err) {
          // Display the error
          echo '<!--Error: ' . $err . '-->';
          } else {
          //Success! Display the result
           

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP zen_get_zone_name函数代码示例发布时间:2022-05-23
下一篇:
PHP zen_get_word_count_price函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap