function zen_get_country_list($name, $selected = '', $parameters = '')
 {
     $countriesAtTopOfList = array();
     $countries_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));
     $countries = zen_get_countries();
     // Set some default entries at top of list:
     if (STORE_COUNTRY != SHOW_CREATE_ACCOUNT_DEFAULT_COUNTRY) {
         $countriesAtTopOfList[] = SHOW_CREATE_ACCOUNT_DEFAULT_COUNTRY;
     }
     $countriesAtTopOfList[] = STORE_COUNTRY;
     // IF YOU WANT TO ADD MORE DEFAULTS TO THE TOP OF THIS LIST, SIMPLY ENTER THEIR NUMBERS HERE.
     // Duplicate more lines as needed
     // Example: Canada is 108, so use 108 as shown:
     //$countriesAtTopOfList[] = 108;
     //process array of top-of-list entries:
     foreach ($countriesAtTopOfList as $key => $val) {
         $countries_array[] = array('id' => $val, 'text' => zen_get_country_name($val));
     }
     // now add anything not in the defaults list:
     foreach ($countries as $country) {
         $alreadyInList = FALSE;
         foreach ($countriesAtTopOfList as $key => $val) {
             if ($country['id'] == $val) {
                 // If you don't want to exclude entries already at the top of the list, comment out this next line:
                 $alreadyInList = TRUE;
                 continue;
             }
         }
         if (!$alreadyInList) {
             $countries_array[] = $country;
         }
     }
     return zen_draw_pull_down_menu($name, $countries_array, $selected, $parameters);
 }
Example #2
0
 function __construct()
 {
     global $order, $customer_id;
     parent::__construct();
     @define('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INSURE', 0);
     $this->code = "fedexwebservices";
     $this->title = tra('FedEx');
     $this->description = 'You will need to have registered an account with FedEx and proper approval from FedEx identity to use this module. Please see the README.TXT file for other requirements.';
     $this->icon = 'shipping_fedex';
     if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_FREE_SHIPPING == 'true' || zen_get_shipping_enabled($this->code)) {
         $this->enabled = MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATUS == 'true' ? true : false;
     }
     if (defined("SHIPPING_ORIGIN_COUNTRY")) {
         if ((int) SHIPPING_ORIGIN_COUNTRY > 0) {
             $countries_array = zen_get_countries(SHIPPING_ORIGIN_COUNTRY, true);
             $this->country = $countries_array['countries_iso_code_2'];
         } else {
             $this->country = SHIPPING_ORIGIN_COUNTRY;
         }
     } else {
         $this->country = STORE_ORIGIN_COUNTRY;
     }
     if ($this->enabled == true && (int) MODULE_SHIPPING_FEDEX_WEB_SERVICES_ZONE > 0) {
         $this->sort_order = MODULE_SHIPPING_FEDEX_WEB_SERVICES_SORT_ORDER;
         $this->tax_class = MODULE_SHIPPING_FEDEX_WEB_SERVICES_TAX_CLASS;
         $check_flag = false;
         $check = $this->mDb->query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FEDEX_WEB_SERVICES_ZONE . "' and zone_country_id = '" . $order->delivery['country']['countries_id'] . "' order by zone_id");
         while (!$check->EOF) {
             if ($check->fields['zone_id'] < 1) {
                 $check_flag = true;
                 break;
             } elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) {
                 $check_flag = true;
                 break;
             }
             $check->MoveNext();
         }
         if ($check_flag == false) {
             $this->enabled = false;
         }
     }
 }
Example #3
0
 /**
  * Determine the language to use when redirecting to the PayPal site
  * Order of selection: locale for current language, current-language-code, delivery-country, billing-country, store-country
  */
 function getLanguageCode()
 {
     global $order, $locales;
     $allowed_country_codes = array('US', 'AU', 'DE', 'FR', 'IT', 'GB', 'ES', 'AT', 'BE', 'CA', 'CH', 'CN', 'NL', 'PL', 'PT', 'BR', 'RU');
     $allowed_language_codes = array('da_DK', 'he_IL', 'id_ID', 'ja_JP', 'no_NO', 'pt_BR', 'ru_RU', 'sv_SE', 'th_TH', 'tr_TR', 'zh_CN', 'zh_HK', 'zh_TW');
     $lang_code = '';
     $user_locale_info = array();
     if (isset($locales) && is_array($locales)) {
         $user_locale_info = $locales;
     }
     $user_locale_info[] = strtoupper($_SESSION['languages_code']);
     $shippingISO = zen_get_countries($order->delivery['country']['id'], true);
     $user_locale_info[] = strtoupper($shippingISO['countries_iso_code_2']);
     $billingISO = zen_get_countries($order->billing['country']['id'], true);
     $user_locale_info[] = strtoupper($billingISO['countries_iso_code_2']);
     $custISO = zen_get_countries($order->customer['country']['id'], true);
     $user_locale_info[] = strtoupper($custISO['countries_iso_code_2']);
     $storeISO = zen_get_countries(STORE_COUNTRY, true);
     $user_locale_info[] = strtoupper($storeISO['countries_iso_code_2']);
     $to_match = array_map('strtoupper', array_merge($allowed_country_codes, $allowed_language_codes));
     foreach ($user_locale_info as $val) {
         if (in_array(strtoupper($val), $to_match)) {
             if (strtoupper($val) == 'EN' && isset($locales) && $locales[0] == 'en_GB') {
                 $val = 'GB';
             }
             if (strtoupper($val) == 'EN') {
                 $val = 'US';
             }
             return $val;
         }
     }
 }
function amazon_process_order($pAmazonOrderId)
{
    global $gAmazonMWS, $gBitUser, $gCommerceSystem, $gBitCustomer, $currencies, $order;
    $ret = NULL;
    $request = new MarketplaceWebServiceOrders_Model_GetOrderRequest();
    $request->setSellerId(MERCHANT_ID);
    // @TODO: set request. Action can be passed as MarketplaceWebServiceOrders_Model_GetOrderRequest
    // object or array of parameters
    // Set the list of AmazonOrderIds
    $orderIds = new MarketplaceWebServiceOrders_Model_OrderIdList();
    $orderIds->setId(array($pAmazonOrderId));
    $request->setAmazonOrderId($orderIds);
    $holdUser = $gBitUser;
    $azUser = new BitPermUser($holdUser->lookupHomepage($gCommerceSystem->getConfig('MODULE_PAYMENT_AMAZONMWS_LOCAL_USERNAME', 'amazonmws')));
    $azUser->load();
    $gBitUser = $azUser;
    $gBitCustomer = new CommerceCustomer($gBitUser->mUserId);
    $gBitCustomer->syncBitUser($gBitUser->mInfo);
    $_SESSION['customer_id'] = $gBitUser->mUserId;
    try {
        $response = $gAmazonMWS->getOrder($request);
        if ($response->isSetGetOrderResult()) {
            $getOrderResult = $response->getGetOrderResult();
            if ($getOrderResult->isSetOrders()) {
                $oldCwd = getcwd();
                chdir(BITCOMMERCE_PKG_PATH);
                $azOrderList = $getOrderResult->getOrders();
                if ($azOrders = $azOrderList->getOrder()) {
                    require_once BITCOMMERCE_PKG_PATH . 'classes/CommerceOrder.php';
                    $order = new order();
                    $order->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID, 'subtotal' => 0, 'tax' => 0, 'total' => 0, 'tax_groups' => array(), 'comments' => isset($_SESSION['comments']) ? $_SESSION['comments'] : '', 'ip_address' => $_SERVER['REMOTE_ADDR']);
                    $azOrder = current($azOrders);
                    // Setup delivery address
                    if ($orderTotal = $azOrder->getOrderTotal()) {
                        $order->info['total'] = $orderTotal->getAmount();
                        $order->info['currency'] = $orderTotal->getCurrencyCode();
                        $order->info['currency_value'] = $currencies->currencies[$order->info['currency']]['currency_value'];
                    }
                    if ($shippingAddress = $azOrder->getShippingAddress()) {
                        $country = zen_get_countries(zen_get_country_id($shippingAddress->getCountryCode()), TRUE);
                        $zoneName = zen_get_zone_name_by_code($country['countries_id'], $shippingAddress->getStateOrRegion());
                        $order->delivery = array('firstname' => substr($shippingAddress->getName(), 0, strpos($shippingAddress->getName(), ' ')), 'lastname' => substr($shippingAddress->getName(), strpos($shippingAddress->getName(), ' ') + 1), 'company' => NULL, 'street_address' => $shippingAddress->getAddressLine1(), 'suburb' => trim($shippingAddress->getAddressLine2() . ' ' . $shippingAddress->getAddressLine3()), 'city' => $shippingAddress->getCity(), 'postcode' => $shippingAddress->getPostalCode(), 'state' => $zoneName, 'country' => $country, 'format_id' => $country['address_format_id'], 'telephone' => $shippingAddress->getPhone(), 'email_address' => NULL);
                        $order->customer = $order->delivery;
                        $order->billing = $order->delivery;
                    }
                    // Setup shipping
                    $shipping = array('cost' => 0);
                    switch ($azOrder->getShipServiceLevel()) {
                        case 'Std US Dom':
                            $shipping['id'] = 'usps_MEDIA';
                            $shipping['title'] = 'United States Postal Service (USPS Media Mail (1 - 2 Weeks))';
                            $shipping['code'] = 'USPSREG';
                            break;
                    }
                    $azOrderItems = amazon_mws_get_order_items($azOrder->getAmazonOrderId());
                    $azOrderItem = $azOrderItems->getOrderItem();
                    foreach ($azOrderItem as $azi) {
                        $testSku = $azi->getSellerSKU();
                        list($productsId, $attrString) = explode(':', $testSku, 2);
                        $productsKey = $productsId . ':ASIN-' . $azi->getASIN();
                        $order->contents[$productsKey] = $gBitCustomer->mCart->getProductHash($productsKey);
                        $order->contents[$productsKey]['products_quantity'] = $azi->getQuantityOrdered();
                        $order->contents[$productsKey]['products_name'] = $azi->getTitle();
                        if ($itemPrice = $azi->getItemPrice()) {
                            //							{$itemTax->getCurrencyCode()}
                            $order->contents[$productsKey]['price'] = $itemPrice->getAmount();
                            $order->contents[$productsKey]['final_price'] = $itemPrice->getAmount();
                        }
                        if ($itemTax = $azi->getItemTax()) {
                            //							{$itemTax->getCurrencyCode()}
                            $order->contents[$productsKey]['tax'] = $itemTax->getAmount();
                        }
                        if ($shippingPrice = $azi->getShippingPrice()) {
                            //							{$itemTax->getCurrencyCode()}
                            $order->info['shipping_cost'] = $shippingPrice->getAmount();
                        }
                        if (empty($attrString)) {
                            $attrString = $gCommerceSystem->getConfig('MODULE_PAYMENT_AMAZONMWS_DEFAULT_ATTRIBUTES');
                        }
                        // stock up the attributes
                        if ($attrString && ($attrs = explode(',', $attrString))) {
                            foreach ($attrs as $optionValueId) {
                                $optionId = $order->mDb->getOne("SELECT cpa.`products_options_id` FROM " . TABLE_PRODUCTS_ATTRIBUTES . " cpa WHERE cpa.`products_options_values_id`=?", array($optionValueId));
                                $order->contents[$productsKey]['attributes'][$optionId . '_' . $optionValueId] = $optionValueId;
                            }
                        }
                        if (!empty($order->contents[$productsKey]['attributes'])) {
                            $attributes = $order->contents[$productsKey]['attributes'];
                            $order->contents[$productsKey]['attributes'] = array();
                            $subindex = 0;
                            foreach ($attributes as $option => $value) {
                                $optionValues = zen_get_option_value(zen_get_options_id($option), (int) $value);
                                // Determine if attribute is a text attribute and change products array if it is.
                                if ($value == PRODUCTS_OPTIONS_VALUES_TEXT_ID) {
                                    $attr_value = $order->contents[$productsKey]['attributes_values'][$option];
                                } else {
                                    $attr_value = $optionValues['products_options_values_name'];
                                }
                                $order->contents[$productsKey]['attributes'][$subindex] = array('option' => $optionValues['products_options_name'], 'value' => $attr_value, 'option_id' => $option, 'value_id' => $value, 'prefix' => $optionValues['price_prefix'], 'price' => $optionValues['options_values_price']);
                                $subindex++;
                            }
                        }
                        $shown_price = zen_add_tax($order->contents[$productsKey]['final_price'], $order->contents[$productsKey]['tax']) * $order->contents[$productsKey]['products_quantity'] + zen_add_tax($order->contents[$productsKey]['onetime_charges'], $order->contents[$productsKey]['tax']);
                        $order->subtotal += $shown_price;
                        $products_tax = $order->contents[$productsKey]['tax'];
                        $products_tax_description = $order->contents[$productsKey]['tax_description'];
                        if (DISPLAY_PRICE_WITH_TAX == 'true') {
                            $order->info['tax'] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
                            if (isset($order->info['tax_groups']["{$products_tax_description}"])) {
                                $order->info['tax_groups']["{$products_tax_description}"] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
                            } else {
                                $order->info['tax_groups']["{$products_tax_description}"] = $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
                            }
                        } else {
                            $order->info['tax'] += $products_tax / 100 * $shown_price;
                            if (isset($order->info['tax_groups']["{$products_tax_description}"])) {
                                $order->info['tax_groups']["{$products_tax_description}"] += $products_tax / 100 * $shown_price;
                            } else {
                                $order->info['tax_groups']["{$products_tax_description}"] = $products_tax / 100 * $shown_price;
                            }
                        }
                        $order->info['tax'] = zen_round($order->info['tax'], 2);
                        if ($azi->isSetShippingPrice()) {
                            $shippingPrice = $azi->getShippingPrice();
                            $shipping['cost'] += $shippingPrice->getAmount();
                        }
                    }
                    foreach (array('cc_type', 'cc_owner', 'cc_number', 'cc_expires', 'coupon_code') as $key) {
                        $order->info[$key] = NULL;
                    }
                    $order->info['shipping_method'] = $shipping['title'];
                    $order->info['shipping_method_code'] = $shipping['code'];
                    $order->info['shipping_module_code'] = $shipping['id'];
                    $order->info['payment_module_code'] = 'amazonmws';
                    $order->info['payment_method'] = 'Amazon Order';
                    $_SESSION['sendto'] = NULL;
                    $_SESSION['shipping'] = $shipping;
                    unset($_SESSION['cot_gv']);
                    require_once DIR_FS_CLASSES . 'order_total.php';
                    global $order_total_modules;
                    $order_total_modules = new order_total();
                    $order_totals = $order_total_modules->pre_confirmation_check();
                    require_once DIR_WS_MODULES . 'payment/amazonmws.php';
                    $amazon = new amazonmws($azOrder->getAmazonOrderId());
                    $amazonOutput = $amazon->process();
                    $order_totals = $order_total_modules->process();
                    array_splice($order_totals, count($order_totals) - 1, 0, array($amazonOutput));
                    if ($ordersId = $order->create($order_totals, 2)) {
                        $order->create_add_products($ordersId);
                        $ret = $ordersId;
                        $order->updateStatus(array('status' => MODULE_PAYMENT_AMAZONMWS_INITIAL_ORDER_STATUS_ID));
                    }
                }
                chdir($oldCwd);
            }
        }
    } catch (MarketplaceWebServiceOrders_Exception $ex) {
        echo "Caught Exception: " . $ex->getMessage() . "\n";
        echo "Response Status Code: " . $ex->getStatusCode() . "\n";
        echo "Error Code: " . $ex->getErrorCode() . "\n";
        echo "Error Type: " . $ex->getErrorType() . "\n";
        echo "Request ID: " . $ex->getRequestId() . "\n";
        echo "XML: " . $ex->getXML() . "\n";
    }
    $gBitUser = $holdUser;
    $gBitCustomer = new CommerceCustomer($gBitUser->mUserId);
    $_SESSION['customer_id'] = $gBitUser->mUserId;
    return $ret;
}
Example #5
0
 /**
  * Determine the language to use when visiting the PayPal site
  */
 function getLanguageCode()
 {
     global $order;
     $lang_code = '';
     $orderISO = zen_get_countries($order->customer['country']['id'], true);
     $storeISO = zen_get_countries(STORE_COUNTRY, true);
     if (in_array(strtoupper($orderISO['countries_iso_code_2']), array('US', 'AU', 'DE', 'FR', 'IT', 'GB', 'ES', 'AT', 'BE', 'CA', 'CH', 'CN', 'NL', 'PL'))) {
         $lang_code = strtoupper($orderISO['countries_iso_code_2']);
     } elseif (in_array(strtoupper($storeISO['countries_iso_code_2']), array('US', 'AU', 'DE', 'FR', 'IT', 'GB', 'ES', 'AT', 'BE', 'CA', 'CH', 'CN', 'NL', 'PL'))) {
         $lang_code = strtoupper($storeISO['countries_iso_code_2']);
     } elseif (in_array(strtoupper($_SESSION['languages_code']), array('EN', 'US', 'AU', 'DE', 'FR', 'IT', 'GB', 'ES', 'AT', 'BE', 'CA', 'CH', 'CN', 'NL', 'PL'))) {
         $lang_code = $_SESSION['languages_code'];
     }
     if (strtoupper($lang_code) == 'EN') {
         $lang_code = 'US';
     }
     //return $orderISO['countries_iso_code_2'];
     return strtoupper($lang_code);
 }
Example #6
0
    $shippingAddressCheck = true;
}
// check if the copybilling checkbox should be checked
if (isset($_SESSION['shippingAddress'])) {
    $shippingAddress = $_SESSION['shippingAddress'];
} elseif ($_GET['error'] == 'true') {
    $shippingAddress = false;
} elseif (FEC_COPYBILLING == 'true') {
    // initial load, check by default
    $shippingAddress = true;
}
if (FEC_ORDER_TOTAL == 'true' && $_SESSION['cart']->count_contents() > 0) {
    require DIR_WS_CLASSES . 'order.php';
    $order = new order();
    require DIR_WS_CLASSES . 'order_total.php';
    $order_total_modules = new order_total();
    $fec_order_total_enabled = true;
} else {
    $fec_order_total_enabled = false;
}
// check if country field should be hidden
$numcountries = zen_get_countries();
if (sizeof($numcountries) <= 1) {
    $_SESSION['zone_country_id_shipping'] = $_SESSION['zone_country_id'] = $selected_country = $numcountries[0]['countries_id'];
    $disable_country = true;
} else {
    $disable_country = false;
}
// This should be last line of the script:
$zco_notifier->notify('NOTIFY_HEADER_END_LOGIN');
$zco_notifier->notify('NOTIFY_HEADER_END_EASY_SIGNUP');
/**
 * Alias function to zen_get_countries, which also returns the countries iso codes
 *
 * @param int If set limits to a single country
*/
function zen_get_countries_with_iso_codes($countries_id)
{
    return zen_get_countries($countries_id, true);
}
/**
 * Alias function to zen_get_countries, which also returns the countries iso codes
 *
 * @param int If set limits to a single country
*/
function zen_get_countries_with_iso_codes($countries_id, $activeOnly = TRUE)
{
    return zen_get_countries($countries_id, true, $activeOnly);
}
Example #9
0
 /**
  * Get quote from shipping provider's API:
  *
  * @param string $method
  * @return array of quotation results
  */
 function quote($method = '')
 {
     global $_POST, $order, $shipping_weight, $shipping_num_boxes;
     if (zen_not_null($method) && isset($this->types[$method])) {
         $prod = $method;
         // BOF: UPS USPS
     } else {
         if ($order->delivery['country']['iso_code_2'] == 'CA') {
             $prod = 'STD';
             // EOF: UPS USPS
         } else {
             $prod = 'GNDRES';
         }
     }
     if ($method) {
         $this->_upsAction('3');
     }
     // return a single quote
     $this->_upsProduct($prod);
     $ups_shipping_weight = $shipping_weight < 0.1 ? 0.1 : $shipping_weight;
     $country_name = zen_get_countries(SHIPPING_ORIGIN_COUNTRY, true);
     $this->_upsOrigin(SHIPPING_ORIGIN_ZIP, $country_name['countries_iso_code_2']);
     $this->_upsDest($order->delivery['postcode'], $order->delivery['country']['iso_code_2']);
     $this->_upsRate(MODULE_SHIPPING_UPS_PICKUP);
     $this->_upsContainer(MODULE_SHIPPING_UPS_PACKAGE);
     $this->_upsWeight($ups_shipping_weight);
     $this->_upsRescom(MODULE_SHIPPING_UPS_RES);
     $upsQuote = $this->_upsGetQuote();
     if (is_array($upsQuote) && sizeof($upsQuote) > 0) {
         switch (SHIPPING_BOX_WEIGHT_DISPLAY) {
             case 0:
                 $show_box_weight = '';
                 break;
             case 1:
                 $show_box_weight = ' (' . $shipping_num_boxes . ' ' . TEXT_SHIPPING_BOXES . ')';
                 break;
             case 2:
                 $show_box_weight = ' (' . number_format($ups_shipping_weight * $shipping_num_boxes, 2) . TEXT_SHIPPING_WEIGHT . ')';
                 break;
             default:
                 $show_box_weight = ' (' . $shipping_num_boxes . ' x ' . number_format($ups_shipping_weight, 2) . TEXT_SHIPPING_WEIGHT . ')';
                 break;
         }
         $this->quotes = array('id' => $this->code, 'module' => $this->title . $show_box_weight);
         $methods = array();
         // BOF: UPS USPS
         $allowed_methods = explode(", ", MODULE_SHIPPING_UPS_TYPES);
         $std_rcd = false;
         // EOF: UPS USPS
         $qsize = sizeof($upsQuote);
         for ($i = 0; $i < $qsize; $i++) {
             list($type, $cost) = each($upsQuote[$i]);
             // BOF: UPS USPS
             if ($type == 'STD') {
                 if ($std_rcd) {
                     continue;
                 } else {
                     $std_rcd = true;
                 }
             }
             if (!in_array($type, $allowed_methods)) {
                 continue;
             }
             // EOF: UPS USPS
             $methods[] = array('id' => $type, 'title' => $this->types[$type], 'cost' => ($cost + MODULE_SHIPPING_UPS_HANDLING) * $shipping_num_boxes);
         }
         $this->quotes['methods'] = $methods;
         if ($this->tax_class > 0) {
             $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
         }
     } else {
         $this->quotes = array('module' => $this->title, 'error' => 'We are unable to obtain a rate quote for UPS shipping.<br />Please contact the store if no other alternative is shown.');
     }
     if (zen_not_null($this->icon)) {
         $this->quotes['icon'] = zen_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
Example #10
0
$contents = array();
if ($action == 'list') {
    switch ($saction) {
        case 'new':
            $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_NEW_SUB_ZONE . '</b>');
            $contents = array('form' => zen_draw_form('zones', FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&' . (isset($_GET['sID']) ? 'sID=' . $_GET['sID'] . '&' : '') . 'saction=insert_sub'));
            $contents[] = array('text' => TEXT_INFO_NEW_SUB_ZONE_INTRO);
            $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY . '<br>' . zen_draw_pull_down_menu('zone_country_id', zen_get_countries(TEXT_ALL_COUNTRIES), '', 'onChange="update_zone(this.form);"'));
            $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_ZONE . '<br>' . zen_draw_pull_down_menu('zone_id', zen_prepare_country_zones_pull_down()));
            $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_insert.gif', IMAGE_INSERT) . ' <a href="' . zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&' . (isset($_GET['sID']) ? 'sID=' . $_GET['sID'] : '')) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
            break;
        case 'edit':
            $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_SUB_ZONE . '</b>');
            $contents = array('form' => zen_draw_form('zones', FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $sInfo->association_id . '&saction=save_sub'));
            $contents[] = array('text' => TEXT_INFO_EDIT_SUB_ZONE_INTRO);
            $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY . '<br>' . zen_draw_pull_down_menu('zone_country_id', zen_get_countries(TEXT_ALL_COUNTRIES), $sInfo->zone_country_id, 'onChange="update_zone(this.form);"'));
            $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_ZONE . '<br>' . zen_draw_pull_down_menu('zone_id', zen_prepare_country_zones_pull_down($sInfo->zone_country_id), $sInfo->zone_id));
            $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $sInfo->association_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
            break;
        case 'delete':
            $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_SUB_ZONE . '</b>');
            $contents = array('form' => zen_draw_form('zones', FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $sInfo->association_id . '&saction=deleteconfirm_sub'));
            $contents[] = array('text' => TEXT_INFO_DELETE_SUB_ZONE_INTRO);
            $contents[] = array('text' => '<br><b>' . $sInfo->countries_name . '</b>');
            $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $sInfo->association_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
            break;
        default:
            if (isset($sInfo) && is_object($sInfo)) {
                $heading[] = array('text' => '<b>' . $sInfo->countries_name . '</b>');
                $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $sInfo->association_id . '&saction=edit') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $sInfo->association_id . '&saction=delete') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
                $contents[] = array('text' => '<br>' . TEXT_INFO_DATE_ADDED . ' ' . zen_date_short($sInfo->date_added));
Example #11
0
 /**
  * Get quote from shipping provider's API:
  *
  * @param string $method
  * @return array of quotation results
  */
 function quote($pShipHash = array())
 {
     global $order, $total_weight, $boxcount, $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);
     $country_name = zen_get_countries(STORE_COUNTRY, true);
     $this->_canadapostOrigin(SHIPPING_ORIGIN_ZIP, $country_name['countries_iso_code_2']);
     if (!zen_not_null($order->delivery['state']) && $order->delivery['zone_id'] > 0) {
         $state_name = zen_get_zone_code($order->delivery['country_id'], $order->delivery['zone_id'], '');
         $order->delivery['state'] = $state_name;
     }
     $strXml = '<?xml version="1.0" ?>';
     // set package configuration.
     $strXml .= "<eparcel>\n";
     $strXml .= "\t<language>" . $this->language . "</language>\n";
     $strXml .= "\t<ratesAndServicesRequest>\n";
     $strXml .= "\t\t<merchantCPCID>" . $this->CPCID . "</merchantCPCID>\n";
     $strXml .= "\t\t<fromPostalCode>" . $this->_canadapostOriginPostalCode . "</fromPostalCode>\n";
     $strXml .= "\t\t<turnAroundTime>" . $this->turnaround_time . "</turnAroundTime>\n";
     $strXml .= "\t\t<itemsPrice>" . (string) $this->items_price . "</itemsPrice>\n";
     // add items information.
     $itemXml = '';
     for ($i = 0; $i < $pShipHash['shipping_num_boxes']; $i++) {
         $itemXml .= "\t<item>\n";
         $itemXml .= "\t\t<quantity>1</quantity>\n";
         $itemXml .= "\t\t<weight>" . $shippingWeight / $shippingNumBoxes . "</weight>\n";
         /*
         			if ($this->item_dim_type[$i] == 'in') //convert to centimeters
         			{
         				$itemXml .= "		<length>" . ($this->item_length[$i] * (254 / 100)) . "</length>\n";
         				$itemXml .= "		<width>" . ($this->item_width[$i] * (254 / 100)) . "</width>\n";
         				$itemXml .= "		<height>" . ($this->item_height[$i] * (254 / 100)) . "</height>\n";
         			} else {
         */
         $itemXml .= "\t\t<length>5</length>\n";
         $itemXml .= "\t\t<width>5</width>\n";
         $itemXml .= "\t\t<height>5</height>\n";
         //			}
         $itemXml .= "\t\t<description>Goods</description>\n";
         // Not sure what this means at the moment
         //			if ($this->item_ready_to_ship[$i] == '1') {
         //				$itemXml .= "		<readyToShip/>\n";
         //			}
         $itemXml .= "\t</item>\n";
     }
     if ($itemXml) {
         $strXml .= "\t<lineItems>\n" . $itemXml . "\n\t</lineItems>\n";
     }
     // add destination information.
     $strXml .= "\t <city>" . $order->delivery['city'] . "</city>\n";
     $strXml .= "\t <provOrState>" . $order->delivery['state'] . "</provOrState>\n";
     $strXml .= "\t <country>" . $order->delivery['country']['countries_iso_code_2'] . "</country>\n";
     $strXml .= "\t <postalCode>" . str_replace(' ', '', $order->delivery['postcode']) . "</postalCode>\n";
     $strXml .= "\t</ratesAndServicesRequest>\n";
     $strXml .= "</eparcel>\n";
     $ret = array('id' => $this->code, 'module' => $this->title, 'icon' => $this->icon);
     //printf("\n\n<!--\n%s\n-->\n\n",$strXml); //debug xml
     $resultXml = $this->_sendToHost($this->server, $this->port, 'POST', '', $strXml);
     if ($resultXml && ($canadapostQuote = $this->_parserResult($resultXml))) {
         if ($this->lettermail_available && $shippingWeight <= $this->lettermail_max_weight) {
             /* Select the correct rate table based on destination country */
             switch ($order->delivery['country']['iso_code_2']) {
                 case 'CA':
                     $table_cost = preg_split("/[:,]/", constant('MODULE_SHIPPING_CANADAPOST_LETTERMAIL_CAN'));
                     $lettermailName = "Lettermail";
                     $lettermailDelivery = sprintf("estimated %d-%d business days", round($this->turnaround_time / 24 + 2), round($this->turnaround_time / 24 + 4));
                     //factor in turnaround time
                     break;
                 case 'US':
                     $table_cost = preg_split("/[:,]/", constant('MODULE_SHIPPING_CANADAPOST_LETTERMAIL_USA'));
                     $lettermailName = "U.S.A Letter-post";
                     $lettermailDelivery = "up to 2 weeks";
                     break;
                 default:
                     $table_cost = preg_split("/[:,]/", constant('MODULE_SHIPPING_CANADAPOST_LETTERMAIL_INTL'));
                     //Use overseas rate if not Canada or US
                     $lettermailName = "INTL Letter-post";
                     $lettermailDelivery = "up to 2 weeks";
             }
             for ($i = 0; $i < sizeof($table_cost); $i += 2) {
                 if (round($shippingWeight, 3) <= $table_cost[$i]) {
                     $lettermailCost = $table_cost[$i + 1];
                     break;
                 }
             }
             if (!empty($lettermailCost)) {
                 $canadapostQuote[] = array('name' => $lettermailName, 'cost' => $lettermailCost, 'delivery' => $lettermailDelivery);
             }
         }
         if (!empty($canadapostQuote) && is_array($canadapostQuote)) {
             $methods = array();
             foreach ($canadapostQuote as $quoteCode => $quote) {
                 if (empty($pShipHash['method']) || $quoteCode == $pShipHash['method']) {
                     $method = array('id' => $quote['code'], 'code' => $quote['code'], 'title' => $quote['name'], 'delivery' => $quote['delivery'], 'cost' => $quote['cost']);
                     if ($this->cp_online_handling == true) {
                         $method['cost'] += $this->handling_cp;
                     } else {
                         $method['cost'] += (double) MODULE_SHIPPING_CANADAPOST_SHIPPING_HANDLING;
                     }
                     $methods[] = $method;
                 }
             }
             if ($this->tax_class > 0) {
                 $ret['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
             }
             $ret['methods'] = $methods;
         } else {
             $errmsg = $canadapostQuote;
         }
     } else {
         $errmsg = tra('There was no response from the Canada Post shipping estimate server.');
     }
     if (!empty($errmsg)) {
         $errmsg .= ' ' . tra('If you prefer to use Canada Post as your shipping method, please contact <strong><a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">send us an email</a></strong>.');
         $ret['error'] = $errmsg;
     }
     return $ret;
 }
Example #12
0
 function quote($pShipHash = array())
 {
     global $_POST, $order;
     if (!empty($pShipHash['method']) && isset($this->types[$pShipHash['method']])) {
         $prod = $pShipHash['method'];
     } elseif ($order->delivery['country']['countries_iso_code_2'] == 'CA') {
         $prod = 'STD';
     } else {
         $prod = 'GNDRES';
     }
     if ($pShipHash['method']) {
         $this->_upsAction('3');
     }
     // return a single quote
     // default to 1
     $shippingWeight = !empty($pShipHash['shipping_weight']) && $pShipHash['shipping_weight'] > 1 ? $pShipHash['shipping_weight'] : 1;
     $shippingNumBoxes = !empty($pShipHash['shipping_num_boxes']) ? $pShipHash['shipping_num_boxes'] : 1;
     $this->_upsProduct($prod);
     $country_name = zen_get_countries(SHIPPING_ORIGIN_COUNTRY, true);
     $this->_upsOrigin(SHIPPING_ORIGIN_ZIP, $country_name['countries_iso_code_2']);
     $this->_upsDest($order->delivery['postcode'], $order->delivery['country']['countries_iso_code_2']);
     $this->_upsRate(MODULE_SHIPPING_UPS_PICKUP);
     $this->_upsContainer(MODULE_SHIPPING_UPS_PACKAGE);
     $this->_upsWeight($shippingWeight);
     $this->_upsRescom(MODULE_SHIPPING_UPS_RES);
     $upsQuote = $this->_upsGetQuote();
     if (is_array($upsQuote) && sizeof($upsQuote) > 0) {
         switch (SHIPPING_BOX_WEIGHT_DISPLAY) {
             case 0:
                 $show_box_weight = '';
                 break;
             case 1:
                 $show_box_weight = $shippingNumBoxes . ' ' . TEXT_SHIPPING_BOXES;
                 break;
             case 2:
                 $show_box_weight = number_format($shippingWeight * $shippingNumBoxes, 2) . tra('lbs');
                 break;
             default:
                 $show_box_weight = $shippingNumBoxes . ' x ' . number_format($shippingWeight, 2) . tra('lbs');
                 break;
         }
         $this->quotes = array('id' => $this->code, 'module' => $this->title, 'weight' => $show_box_weight);
         $methods = array();
         // BOF: UPS UPS
         $allowed_methods = explode(", ", MODULE_SHIPPING_UPS_TYPES);
         $std_rcd = false;
         // EOF: UPS UPS
         $qsize = sizeof($upsQuote);
         for ($i = 0; $i < $qsize; $i++) {
             list($type, $cost) = each($upsQuote[$i]);
             // BOF: UPS UPS
             if ($type == 'STD') {
                 if ($std_rcd) {
                     continue;
                 } else {
                     $std_rcd = true;
                 }
             }
             if (!in_array($type, $allowed_methods)) {
                 continue;
             }
             // EOF: UPS UPS
             $methods[] = array('id' => $type, 'title' => 'UPS ' . $this->types[$type], 'cost' => ($cost + MODULE_SHIPPING_UPS_HANDLING) * $shippingNumBoxes, 'code' => 'UPS ' . $this->types[$type]);
         }
         $this->quotes['methods'] = $methods;
         if ($this->tax_class > 0) {
             $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['countries_id'], $order->delivery['zone_id']);
         }
     } else {
         /* ORIGINAL
                 $this->quotes = array('module' => $this->title,
                                       'error' => 'An error occurred with the UPS shipping calculations.<br />' . $upsQuote . '<br />If you prefer to use UPS as your shipping method, please contact the store owner.');
         */
         // BOF: UPS UPS
         $this->quotes = array('module' => $this->title, 'error' => tra('We are unable to obtain a rate quote for UPS shipping. Please contact support if no other alternative is shown.') . '<br /> ( ' . $upsQuote . ' )');
         // EOF: UPS UPS
     }
     if (zen_not_null($this->icon)) {
         $this->quotes['icon'] = $this->icon;
     }
     return $this->quotes;
 }
 // moved below and altered to include Tare
   // totals info
   $totalsDisplay = '';
   switch (true) {
     case (SHOW_TOTALS_IN_CART == '1'):
     $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . TEXT_TOTAL_WEIGHT . $_SESSION['cart']->show_weight() . TEXT_PRODUCT_WEIGHT_UNIT . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
     break;
     case (SHOW_TOTALS_IN_CART == '2'):
     $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . ($_SESSION['cart']->show_weight() > 0 ? TEXT_TOTAL_WEIGHT . $_SESSION['cart']->show_weight() . TEXT_PRODUCT_WEIGHT_UNIT : '') . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
     break;
     case (SHOW_TOTALS_IN_CART == '3'):
     $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
     break;
   }
 */
 $country_info = zen_get_countries($_POST['zone_country_id'], true);
 $order->delivery = array('postcode' => $zip_code, 'country' => array('id' => $_POST['zone_country_id'], 'title' => $country_info['countries_name'], 'iso_code_2' => $country_info['countries_iso_code_2'], 'iso_code_3' => $country_info['countries_iso_code_3']), 'country_id' => $_POST['zone_country_id'], 'zone_id' => $state_zone_id, 'format_id' => zen_get_address_format_id($_POST['zone_country_id']));
 // weight and count needed for shipping !
 $total_weight = $_SESSION['cart']->show_weight();
 $shipping_estimator_display_weight = $total_weight;
 $total_count = $_SESSION['cart']->count_contents();
 require DIR_WS_CLASSES . 'shipping.php';
 $shipping_modules = new shipping();
 $quotes = $shipping_modules->quote();
 //4px shipping
 if (EXTRA_HOST_NOT_OURS) {
     //get services supply by 4px
     $dsf_shipping_query = "SELECT `dsf_shipping_id` FROM `dsf_shipping` WHERE `status`=1 order by `sort_index` desc,`dsf_shipping_code`";
     $dsf_shipping_opens = $db->Execute($dsf_shipping_query);
     $data = array('countries_iso_code_2' => $country_info['countries_iso_code_2'], 'total_weight' => $total_weight);
     if (!$dsf_shipping_opens->EOF) {
Example #14
0
                         $Gshipping = new GoogleFlatRateShipping($shipping_name, $shipping_price);
                         $Gshipping->AddShippingRestrictions($Gfilter);
                         $Gcart->AddShipping($Gshipping);
                     }
                 }
             }
         } else {
             $shipping_config_errors .= $key . " (ignored)<br />";
         }
     }
 }
 if (MODULE_PAYMENT_GOOGLECHECKOUT_CARRIER_CALCULATED_ENABLED == 'True' && !$free_shipping) {
     $Gshipping = new GoogleCarrierCalculatedShipping('Carrier_shipping');
     $country_code = defined('SHIPPING_ORIGIN_COUNTRY') ? SHIPPING_ORIGIN_COUNTRY : STORE_COUNTRY;
     $zone_name = zen_get_zone_code($country_code, STORE_ZONE, '');
     $countries_array = zen_get_countries(SHIPPING_ORIGIN_COUNTRY, true);
     $ship_from = new GoogleShipFrom('Store_origin', '', $countries_array['countries_iso_code_2'], SHIPPING_ORIGIN_ZIP, $zone_name);
     $GSPackage = new GoogleShippingPackage($ship_from, 1, 1, 1, 'IN');
     $Gshipping->addShippingPackage($GSPackage);
     $carriers_config = explode(', ', MODULE_PAYMENT_GOOGLECHECKOUT_CARRIER_CALCULATED);
     //    print_r($carriers_config);die;
     foreach ($googlepayment->cc_shipping_methods_names as $CCSCode => $CCSName) {
         foreach ($googlepayment->cc_shipping_methods[$CCSCode] as $type => $methods) {
             foreach ($methods as $method => $method_name) {
                 $values = explode('|', compare($CCSCode . $method . $type, $carriers_config, "_CCS:", '0|0|0'));
                 if ($values[0] != '0') {
                     $CCSoption = new GoogleCarrierCalculatedShippingOption($values[0], $CCSName, $method, $values[1], $values[2], 'REGULAR_PICKUP');
                     $Gshipping->addCarrierCalculatedShippingOptions($CCSoption);
                 }
             }
         }
Example #15
0
            $pass = true;
            break;
    }
    $free_shipping = false;
    if ($pass == true && $_SESSION['cart']->show_total() >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) {
        $free_shipping = true;
    }
} else {
    $free_shipping = false;
}
if (isset($_SESSION['comments'])) {
    $comments = $_SESSION['comments'];
}
// get all available shipping quotes
$quotes = $shipping_modules->quote();
$country_info = zen_get_countries($order->delivery['country_id'], true);
if (EXTRA_HOST_NOT_OURS) {
    //get services supply by 4px
    $dsf_shipping_query = "SELECT `dsf_shipping_id` FROM `dsf_shipping` WHERE `status`=1 order by `sort_index` desc,`dsf_shipping_code`";
    $dsf_shipping_opens = $db->Execute($dsf_shipping_query);
    $data = array('countries_iso_code_2' => $country_info['countries_iso_code_2'], 'total_weight' => $total_weight);
    if (!$dsf_shipping_opens->EOF) {
        $dsf_shipping_open = '';
        $dsf_shipping_i = 0;
        while (!$dsf_shipping_opens->EOF) {
            $dsf_shipping_open .= $dsf_shipping_i == 0 ? '' : ',';
            $dsf_shipping_open .= $dsf_shipping_opens->fields['dsf_shipping_id'];
            ++$dsf_shipping_i;
            $dsf_shipping_opens->MoveNext();
        }
        if ($dsf_shipping_open != '') {
Example #16
0
function zen_get_country_list($name, $selected = '', $parameters = '')
{
    $countries_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));
    $countries = zen_get_countries();
    for ($i = 0, $n = sizeof($countries); $i < $n; $i++) {
        $countries_array[] = array('id' => $countries[$i]['countries_id'], 'text' => $countries[$i]['countries_name']);
    }
    return zen_draw_pull_down_menu($name, $countries_array, $selected, $parameters);
}
Example #17
0
 /**
  * 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
          echo PHP_EOL.'<!--Success: ';
          print_r($this->response);
          echo '-->'. PHP_EOL;
          }
          }
          if($this->client->getError()) {
          echo '<!-- Debug:';
          print_r($this->client->getDebug());
          echo '-->';
          }
         */
         // end error checking module
         if (!$this->client->fault && ($purolatorQuote = $this->_parserResult($this->response))) {
             $ret['weight'] = $shippingWeight . ' Lb / ' . round($shippingWeight / 2.2) . ' Kg';
             $methods = array();
             for ($i = 0; $i < sizeof($purolatorQuote); $i++) {
                 list($type, $cost) = each($purolatorQuote[$i]);
                 $type = html_entity_decode($type);
                 if ($method == '' || $method == $type) {
                     $methods[] = array('id' => $type, 'title' => $type, 'cost' => MODULE_SHIPPING_PUROLATOR_HANDLING + $cost);
                 }
             }
             if ($this->tax_class > 0) {
                 $ret['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
             }
             $ret['methods'] = $methods;
         } else {
             $errmsg = tra('An unknown error occured with the Purolator shipping calculations.');
         }
         $errmsg .= ' ' . tra('If you prefer to use Canada Post as your shipping method, please <a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">send us an email</a>.');
         $ret['error'] = $errmsg;
     }
     return $ret;
 }
Example #18
0
function zen_cfg_pull_down_country_list_none($country_id, $key = '')
{
    $country_array = zen_get_countries('None');
    $name = $key ? 'configuration[' . $key . ']' : 'configuration_value';
    return zen_draw_pull_down_menu($name, $country_array, $country_id);
}
Example #19
0
 function usps_translation()
 {
     global $order;
     global $selected_country, $state_zone_id;
     if (!empty($order->delivery['country']['countries_iso_code_2'])) {
         $originCountry = zen_get_countries(SHIPPING_ORIGIN_COUNTRY, TRUE);
         if ($originCountry['countries_iso_code_3'] == 'USA') {
             switch ($order->delivery['country']['countries_iso_code_2']) {
                 case 'AS':
                     // Samoa American
                 // Samoa American
                 case 'GU':
                     // Guam
                 // Guam
                 case 'MP':
                     // Northern Mariana Islands
                 // Northern Mariana Islands
                 case 'PW':
                     // Palau
                 // Palau
                 case 'PR':
                     // Puerto Rico
                 // Puerto Rico
                 case 'VI':
                     // Virgin Islands US
                     // which is right
                 // Virgin Islands US
                 // which is right
                 case 'FM':
                     // Micronesia, Federated States of
                     return 'US';
                     break;
                     // stays as original country
                     //				case 'FM': // Micronesia, Federated States of
                 // stays as original country
                 //				case 'FM': // Micronesia, Federated States of
                 default:
                     return $order->delivery['country']['countries_iso_code_2'];
                     break;
             }
         } else {
             return $order->delivery['country']['countries_iso_code_2'];
         }
     }
 }
Example #20
0
 function getCountryInfo($customer_id, $address_id)
 {
     $address_info = zen_get_address_fields($customer_id, $address_id);
     return zen_get_countries($address_info['country_id'], true);
 }
Example #21
0
function zen_get_country_list($name, $selected = '', $parameters = '')
{
    if ($countries = zen_get_countries()) {
        $countries_array = array(array('id' => '', 'text' => tra('Please Choose Your Country')));
        for ($i = 0, $n = sizeof($countries); $i < $n; $i++) {
            $countries_array[] = array('id' => $countries[$i]['countries_id'], 'text' => $countries[$i]['countries_name']);
        }
        if (!empty($selected) && !is_numeric($selected)) {
            $selected = zen_get_country_id($selected);
        }
    }
    return zen_draw_pull_down_menu($name, $countries_array, $selected, $parameters);
}
Example #22
0
 case 'new':
     $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_NEW_ZONE . '</b>');
     $contents = array('form' => zen_draw_form('zones', FILENAME_ZONES, 'page=' . $_GET['page'] . '&action=insert'));
     $contents[] = array('text' => TEXT_INFO_INSERT_INTRO);
     $contents[] = array('text' => '<br>' . TEXT_INFO_ZONES_NAME . '<br>' . zen_draw_input_field('zone_name'));
     $contents[] = array('text' => '<br>' . TEXT_INFO_ZONES_CODE . '<br>' . zen_draw_input_field('zone_code'));
     $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_NAME . '<br>' . zen_draw_pull_down_menu('zone_country_id', zen_get_countries()));
     $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_insert.gif', IMAGE_INSERT) . '&nbsp;<a href="' . zen_href_link(FILENAME_ZONES, 'page=' . $_GET['page']) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
     break;
 case 'edit':
     $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_ZONE . '</b>');
     $contents = array('form' => zen_draw_form('zones', FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->zone_id . '&action=save'));
     $contents[] = array('text' => TEXT_INFO_EDIT_INTRO);
     $contents[] = array('text' => '<br>' . TEXT_INFO_ZONES_NAME . '<br>' . zen_draw_input_field('zone_name', $cInfo->zone_name));
     $contents[] = array('text' => '<br>' . TEXT_INFO_ZONES_CODE . '<br>' . zen_draw_input_field('zone_code', $cInfo->zone_code));
     $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_NAME . '<br>' . zen_draw_pull_down_menu('zone_country_id', zen_get_countries(), $cInfo->countries_id));
     $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_update.gif', IMAGE_UPDATE) . '&nbsp;<a href="' . zen_href_link(FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->zone_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
     break;
 case 'delete':
     $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_ZONE . '</b>');
     $contents = array('form' => zen_draw_form('zones', FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->zone_id . '&action=deleteconfirm'));
     $contents[] = array('text' => TEXT_INFO_DELETE_INTRO);
     $contents[] = array('text' => '<br><b>' . $cInfo->zone_name . '</b>');
     $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . '&nbsp;<a href="' . zen_href_link(FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->zone_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
     break;
 default:
     if (isset($cInfo) && is_object($cInfo)) {
         $heading[] = array('text' => '<b>' . $cInfo->zone_name . '</b>');
         $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->zone_id . '&action=edit') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->zone_id . '&action=delete') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
         $contents[] = array('text' => '<br>' . TEXT_INFO_ZONES_NAME . '<br>' . $cInfo->zone_name . ' (' . $cInfo->zone_code . ')');
         $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_NAME . ' ' . $cInfo->countries_name);
Example #23
0
// Explicit country requested takes priority, even if registered.
if ((isset($_REQUEST['address_id']) && $_REQUEST['address_id'] == 'custom' || empty($_REQUEST['address_id'])) && (!empty($_REQUEST['country_id']) || !$gBitUser->isRegistered())) {
    if (isset($_REQUEST['address_id']) && $_REQUEST['address_id'] == 'custom') {
        $_SESSION['cart_address_id'] = 'custom';
    }
    if (!empty($_REQUEST['country_id'])) {
        if (!empty($_SESSION['cart_country_id']) && $_SESSION['cart_country_id'] != $_REQUEST['country_id']) {
            $_SESSION['cart_zip_code'] = NULL;
            $_REQUEST['zip_code'] = NULL;
        }
        $_SESSION['cart_country_id'] = $_REQUEST['country_id'];
    } elseif (empty($_SESSION['cart_country_id'])) {
        $_SESSION['cart_country_id'] = STORE_COUNTRY;
    }
    // user not logged in, country is selected
    $countryInfo = zen_get_countries($_SESSION['cart_country_id'], true);
    $order->delivery = array('country' => array('countries_id' => $countryInfo['countries_id'], 'title' => $countryInfo['countries_name'], 'countries_iso_code_2' => $countryInfo['countries_iso_code_2'], 'countries_iso_code_3' => $countryInfo['countries_iso_code_3']), 'country_id' => $countryInfo['countries_id'], 'format_id' => $countryInfo['address_format_id']);
    // Check for form zip code
    if (!empty($_REQUEST['zip_code'])) {
        $_SESSION['cart_zip_code'] = $_REQUEST['zip_code'];
    }
    $order->delivery['postcode'] = !empty($_SESSION['cart_zip_code']) ? $_SESSION['cart_zip_code'] : NULL;
    // Check for form state
    if (isset($_REQUEST['zone_id'])) {
        $_SESSION['cart_zone_id'] = $_REQUEST['zone_id'];
    }
    if (!empty($_SESSION['cart_zone_id'])) {
        $order->delivery['zone_id'] = (int) $_SESSION['cart_zone_id'];
    }
    // used as a check below for existence of states
    $stateMenu = zen_get_country_zone_list('zone_id', $order->delivery['country']['countries_id'], !empty($_SESSION['cart_zone_id']) ? $_SESSION['cart_zone_id'] : NULL);
         $country_info = $_SESSION['country_info'];
         $order->delivery = array('postcode' => $zip_code, 'country' => array('id' => $_POST['zone_country_id'], 'title' => $country_info['countries_name'], 'iso_code_2' => $country_info['countries_iso_code_2'], 'iso_code_3' => $country_info['countries_iso_code_3']), 'country_id' => $_POST['zone_country_id'], 'zone_id' => $state_zone_id, 'format_id' => zen_get_address_format_id($_POST['zone_country_id']));
         $_SESSION['cart_country_id'] = $_POST['zone_country_id'];
         // add state zone_id
         $_SESSION['cart_zone'] = $state_zone_id;
         $_SESSION['cart_zip_code'] = $zip_code;
     } elseif ($_SESSION['cart_country_id']) {
         // session is available
         $_SESSION['country_info'] = zen_get_countries($_SESSION['cart_country_id'], true);
         $country_info = $_SESSION['country_info'];
         // fix here - check for error on $cart_country_id
         $order->delivery = array('postcode' => $_SESSION['cart_zip_code'], 'country' => array('id' => $_SESSION['cart_country_id'], 'title' => $country_info['countries_name'], 'iso_code_2' => $country_info['countries_iso_code_2'], 'iso_code_3' => $country_info['countries_iso_code_3']), 'country_id' => $_SESSION['cart_country_id'], 'zone_id' => $state_zone_id, 'format_id' => zen_get_address_format_id($_SESSION['cart_country_id']));
     } else {
         // first timer
         $_SESSION['cart_country_id'] = STORE_COUNTRY;
         $_SESSION['country_info'] = zen_get_countries(STORE_COUNTRY, true);
         $country_info = $_SESSION['country_info'];
         $order->delivery = array('country' => array('id' => STORE_COUNTRY, 'title' => $country_info['countries_name'], 'iso_code_2' => $country_info['countries_iso_code_2'], 'iso_code_3' => $country_info['countries_iso_code_3']), 'country_id' => STORE_COUNTRY, 'zone_id' => $state_zone_id, 'format_id' => zen_get_address_format_id($_POST['zone_country_id']));
     }
     // set the cost to be able to calculate free shipping
     $order->info = array('total' => $_SESSION['cart']->show_total(), 'currency' => $currency, 'currency_value' => $currencies->currencies[$currency]['value']);
 }
 // weight and count needed for shipping !
 $total_weight = $_SESSION['cart']->show_weight();
 $shipping_estimator_display_weight = $total_weight;
 $total_count = $_SESSION['cart']->count_contents();
 require DIR_WS_CLASSES . 'shipping.php';
 $shipping_modules = new shipping();
 $quotes = $shipping_modules->quote();
 // print_r($quotes);
 // die('here');
Example #25
0
    ?>
          <tr>
            <td class="main"><?php 
    echo ENTRY_COUNTRY;
    ?>
</td>
            <td class="main">
<?php 
    if ($error == true) {
        if ($entry_country_error == true) {
            echo zen_draw_pull_down_menu('entry_country_id', zen_get_countries(), $cInfo->entry_country_id) . '&nbsp;' . ENTRY_COUNTRY_ERROR;
        } else {
            echo zen_get_country_name($cInfo->entry_country_id) . zen_draw_hidden_field('entry_country_id');
        }
    } else {
        echo zen_draw_pull_down_menu('entry_country_id', zen_get_countries(), $cInfo->entry_country_id);
    }
    ?>
</td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php 
    echo zen_draw_separator('pixel_trans.gif', '1', '10');
    ?>
</td>
      </tr>
      <tr>
        <td class="formAreaTitle"><?php 
    echo CATEGORY_CONTACT;
 /**
  * Determine the language to use when visiting the PayPal site
  */
 function getLanguageCode()
 {
     $lang_code = '';
     $storeISO = zen_get_countries(STORE_COUNTRY, true);
     if (in_array(strtoupper($storeISO['countries_iso_code_2']), array('US', 'AU', 'DE', 'FR', 'IT', 'GB', 'ES'))) {
         $lang_code = strtoupper($storeISO['countries_iso_code_2']);
     } elseif (in_array(strtoupper($_SESSION['languages_code']), array('EN', 'US', 'AU', 'DE', 'FR', 'IT', 'GB', 'ES'))) {
         $lang_code = $_SESSION['languages_code'];
         if (strtoupper($lang_code) == 'EN') {
             $lang_code = 'US';
         }
     }
     return strtoupper($lang_code);
 }
Example #27
0
 protected function load()
 {
     global $gBitDb, $gBitSystem;
     $ret = FALSE;
     if ($this->isValid()) {
         $selectSql = '';
         $joinSql = '';
         if ($gBitSystem->isPackageActive('stats')) {
             $selectSql .= " , sru.`referer_url` ";
             $joinSql .= " LEFT JOIN `" . BIT_DB_PREFIX . "stats_referer_users_map` srum ON (srum.`user_id`=uu.`user_id`) \n\t\t\t\t\t\t\t  LEFT JOIN `" . BIT_DB_PREFIX . "stats_referer_urls` sru ON (sru.`referer_url_id`=srum.`referer_url_id`) ";
         }
         $order_query = "SELECT co.*, uu.*, cpccl.`ref_id`, cpccl.`trans_result`, cpccl.`trans_auth_code`, cpccl.`trans_message`, cpccl.`trans_amount`, cpccl.`trans_date` {$selectSql}\n\t\t\t\t\t\t\tFROM " . TABLE_ORDERS . " co\n\t\t\t\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "users_users` uu ON(uu.`user_id`=co.`customers_id`)\n\t\t\t\t\t\t\t\t{$joinSql}\n\t\t\t\t\t\t\t\tLEFT JOIN `com_pubs_credit_card_log` cpccl ON(cpccl.`orders_id`=co.`orders_id` AND `trans_result`='0')\n\t\t\t\t\t\t\tWHERE co.`orders_id` = ?";
         $order = $gBitDb->query($order_query, array($this->mOrdersId));
         $totals_query = "SELECT `title`, `text`, `class`, `orders_value` FROM " . TABLE_ORDERS_TOTAL . " where `orders_id`=? ORDER BY `sort_order`";
         $totals = $gBitDb->query($totals_query, array($this->mOrdersId));
         while (!$totals->EOF) {
             $this->totals[] = array('title' => $totals->fields['title'], 'text' => $totals->fields['text'], 'class' => $totals->fields['class'], 'orders_value' => $totals->fields['orders_value']);
             $totals->MoveNext();
         }
         $order_total_query = "SELECT `text`, `orders_value` FROM " . TABLE_ORDERS_TOTAL . " where `orders_id` =? AND class = 'ot_total'";
         $order_total = $gBitDb->query($order_total_query, array($this->mOrdersId));
         $order_status_query = "select `orders_status_name` from " . TABLE_ORDERS_STATUS . " where `orders_status_id` = ? AND `language_id` = ?";
         $order_status = $gBitDb->query($order_status_query, array($order->fields['orders_status'], $_SESSION['languages_id']));
         $this->info = array('currency' => $order->fields['currency'], 'currency_value' => $order->fields['currency_value'], 'payment_method' => $order->fields['payment_method'], 'payment_module_code' => $order->fields['payment_module_code'], 'shipping_method' => $order->fields['shipping_method'], 'shipping_method_code' => $order->fields['shipping_method_code'], 'shipping_module_code' => $order->fields['shipping_module_code'], 'coupon_code' => $order->fields['coupon_code'], 'cc_type' => $order->fields['cc_type'], 'cc_owner' => $order->fields['cc_owner'], 'cc_number' => $order->fields['cc_number'], 'cc_expires' => $order->fields['cc_expires'], 'cc_ref_id' => $order->fields['ref_id'], 'date_purchased' => $order->fields['date_purchased'], 'orders_status_id' => $order->fields['orders_status'], 'orders_status' => $order_status->fields['orders_status_name'], 'last_modified' => $order->fields['last_modified'], 'total' => $order->fields['order_total'], 'tax' => $order->fields['order_tax'], 'ip_address' => $order->fields['ip_address']);
         $this->info['shipping_cost'] = $gBitDb->getOne("SELECT `orders_value` AS `shipping_cost` FROM " . TABLE_ORDERS_TOTAL . " WHERE `orders_id` = ? AND class = 'ot_shipping'", array($this->mOrdersId));
         $this->customer = array('id' => $order->fields['customers_id'], 'user_id' => $order->fields['user_id'], 'name' => $order->fields['customers_name'], 'real_name' => $order->fields['real_name'], 'login' => $order->fields['login'], 'company' => $order->fields['customers_company'], 'street_address' => $order->fields['customers_street_address'], 'suburb' => $order->fields['customers_suburb'], 'city' => $order->fields['customers_city'], 'postcode' => $order->fields['customers_postcode'], 'state' => $order->fields['customers_state'], 'country' => $order->fields['customers_country'], 'format_id' => $order->fields['customers_address_format_id'], 'telephone' => $order->fields['customers_telephone'], 'email_address' => $order->fields['email']);
         // 'email' comes from users_users, which is always most current
         if (!empty($order->fields['referer_url'])) {
             $this->customer['referer_url'] = $order->fields['referer_url'];
         }
         $this->delivery = array('name' => $order->fields['delivery_name'], 'company' => $order->fields['delivery_company'], 'street_address' => $order->fields['delivery_street_address'], 'suburb' => $order->fields['delivery_suburb'], 'city' => $order->fields['delivery_city'], 'postcode' => $order->fields['delivery_postcode'], 'state' => $order->fields['delivery_state'], 'country' => zen_get_countries($order->fields['delivery_country'], TRUE), 'zone_id' => zen_get_zone_id($order->fields['delivery_country'], $order->fields['delivery_state']), 'telephone' => $order->fields['delivery_telephone'], 'format_id' => $order->fields['delivery_address_format_id']);
         if (empty($this->delivery['name']) && empty($this->delivery['street_address'])) {
             $this->delivery = false;
         }
         $this->billing = array('name' => $order->fields['billing_name'], 'company' => $order->fields['billing_company'], 'street_address' => $order->fields['billing_street_address'], 'suburb' => $order->fields['billing_suburb'], 'city' => $order->fields['billing_city'], 'postcode' => $order->fields['billing_postcode'], 'country' => zen_get_countries($order->fields['billing_country'], TRUE), 'state' => $order->fields['billing_state'], 'telephone' => $order->fields['billing_telephone'], 'format_id' => $order->fields['billing_address_format_id']);
         $orders_products_query = "SELECT op.*, pt.*, p.content_id, p.related_content_id, lc.user_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . TABLE_ORDERS_PRODUCTS . " op\n\t\t\t\t\t\t\t\t\tLEFT OUTER JOIN\t" . TABLE_PRODUCTS . " p ON ( op.`products_id`=p.`products_id` )\n\t\t\t\t\t\t\t\t\tLEFT OUTER JOIN\t" . TABLE_PRODUCT_TYPES . " pt ON ( p.`products_type`=pt.`type_id` )\n\t\t\t\t\t\t\t\t\tLEFT OUTER JOIN\t`" . BIT_DB_PREFIX . "liberty_content` lc ON ( lc.`content_id`=p.`content_id` )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `orders_id` = ?\n\t\t\t\t\t\t\t\tORDER BY op.`orders_products_id`";
         $orders_products = $this->mDb->query($orders_products_query, array($this->mOrdersId));
         while (!$orders_products->EOF) {
             // convert quantity to proper decimals - account history
             if (QUANTITY_DECIMALS != 0) {
                 $fix_qty = $orders_products->fields['products_quantity'];
                 switch (true) {
                     case !strstr($fix_qty, '.'):
                         $new_qty = $fix_qty;
                         break;
                     default:
                         $new_qty = preg_replace('/[0]+$/', '', $orders_products->fields['products_quantity']);
                         break;
                 }
             } else {
                 $new_qty = $orders_products->fields['products_quantity'];
             }
             $new_qty = round($new_qty, QUANTITY_DECIMALS);
             if ($new_qty == (int) $new_qty) {
                 $new_qty = (int) $new_qty;
             }
             $productsKey = $orders_products->fields['orders_products_id'];
             $this->contents[$productsKey] = $orders_products->fields;
             $this->contents[$productsKey]['products_quantity'] = $new_qty;
             $this->contents[$productsKey]['id'] = $orders_products->fields['products_id'];
             $this->contents[$productsKey]['name'] = $orders_products->fields['products_name'];
             $this->contents[$productsKey]['model'] = $orders_products->fields['products_model'];
             $this->contents[$productsKey]['tax'] = !empty($orders_products->fields['tax_rate']) ? $orders_products->fields['tax_rate'] : NULL;
             $this->contents[$productsKey]['price'] = $orders_products->fields['products_price'];
             $attributes_query = "SELECT opa.*, `orders_products_attributes_id` AS `products_attributes_id`\n\t\t\t\t\t\t\t\t\t FROM " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " opa\n\t\t\t\t\t\t\t\t\t WHERE `orders_id` = ? AND `orders_products_id` = ?\n\t\t\t\t\t\t\t\t\t ORDER BY `orders_products_id`";
             $attributes = $this->mDb->query($attributes_query, array($this->mOrdersId, $orders_products->fields['orders_products_id']));
             if ($attributes->RecordCount()) {
                 while (!$attributes->EOF) {
                     $this->contents[$productsKey]['attributes'][] = array('options_id' => $attributes->fields['products_options_id'], 'options_values_id' => $attributes->fields['products_options_values_id'], 'option' => $attributes->fields['products_options'], 'value' => $attributes->fields['products_options_values'], 'prefix' => $attributes->fields['price_prefix'], 'final_price' => $this->getOrderAttributePrice($attributes->fields, $this->contents[$productsKey]), 'price' => $attributes->fields['options_values_price'], 'orders_products_attributes_id' => $attributes->fields['orders_products_attributes_id']);
                     $attributes->MoveNext();
                 }
             }
             $this->info['tax_groups']["{$this->contents[$productsKey]['tax']}"] = '1';
             $orders_products->MoveNext();
         }
         $ret = TRUE;
     }
     return $ret;
 }