Jump to content

lyonsperf

Members
  • Content count

    348
  • Joined

  • Last visited

Everything posted by lyonsperf

  1. lyonsperf

    Multi_Vendor_Shipping new thread

    Is anyone else getting this message on their checkout_shipping page? Warning: usort() expects parameter 2 to be a valid callback, class 'upsxml' does not have a method 'rate_sort_func' in /home/protecom/public_html/includes/modules/vendors_shipping/upsxml.php on line 420 I did a seach and came up with nothing
  2. lyonsperf

    Article Manager v1.0

    Hi Jack, How can I adjust the size of the article xsell box? Where are the parameters drawn from in 2.2?
  3. lyonsperf

    Article Manager v1.0

    Hi Jack, includes/modules/article_listing.php is calling for function clean_html_comments and is causing an error. I do not have this file and it is not in the stock osc 2.2. Can this function be removed?
  4. lyonsperf

    Sitemap SEO

    I fixed it by deleting all the javascript calls from the body section and adding one at the end of the index.php file after <!-- footer_eof //-->. On another note, on the sitemap.php page of the website I get this error which I reported earlier this year. This only occurs on this page. So I am assuming there is a conflict between Articles Manager and Sitemap seo. Being that you monitor both, do you have any suggestions? Fatal error: Cannot redeclare getboldtags() (previously declared in /home/xxxx/public_html/includes/boxes/articles.php:42) in /home/xxxx/public_html/includes/boxes/articles.php on line 59
  5. lyonsperf

    Sitemap SEO

    Jack, I noticed that the sitemap_seo.js sript is called several times in index.php. This is causing a delay in page load. Does the mod require the script to be called each time a function is performed?
  6. lyonsperf

    Multi_Vendor_Shipping new thread

    Here is the file attachment. You will also need the wsdl folder from fedex webservices contribution as well as the language/english/modules/shipping/fedexwebservices.php file. fedexwebservices.php
  7. lyonsperf

    Multi_Vendor_Shipping new thread

    Heres the corrected code for fedexwebservices.php After much searching, found the mod in creloaded. I modded it to work with RC2.2a. <?php /* FedEx Webservice Version 9.4.2 for osCommerce 2.2rc2a and later(?) -by Roaddoctor 5/20/2012 New contributed code and the hard work credit to Jeff Lew. Thanks Jeff and Numinex! $Loc: catalog/includes/modules/vendors_shipping/ $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Released under the GNU General Public License */ class fedexwebservices { var $code, $title, $description, $icon, $sort_order, $enabled, $tax_class, $fedex_key, $fedex_pwd, $fedex_act_num, $fedex_meter_num, $country; //Class Constructor function fedexwebservices() { global $order, $customer_id; $this->vendors_id = (isset($_GET['vendors_id']) && !empty($_GET['vendors_id'])) ? (int)$_GET['vendors_id'] : NULL; $this->code = "fedexwebservices"; $this->title = MODULE_SHIPPING_FEDEX_WEB_SERVICES_TEXT_TITLE; $this->handling_fee = MODULE_SHIPPING_FEDEX_WEB_SERVICES_HANDLING_FEE; $this->icon = DIR_WS_ICONS . 'shipping_fedex.gif'; $this->ok_to_install = (@[member='Extension']_loaded('soap')) ? TRUE : FALSE; if ($this->ok_to_install) { $this->description = MODULE_SHIPPING_FEDEX_WEB_SERVICES_TEXT_DESCRIPTION; } else { $this->description = MODULE_SHIPPING_FEDEX_WEB_SERVICES_TEXT_NO_SOAP_DESCRIPTION; } if (defined("SHIPPING_ORIGIN_COUNTRY")) { if ((int)SHIPPING_ORIGIN_COUNTRY > 0) { $countries_array = $this->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; } $this->delivery_country_id = $order->delivery['country']['id']; $this->delivery_zone_id = $order->delivery['zone_id']; } // MVS ADD function sort_order($vendors_id = '1') { $sort_order = @[member='constant'] ('MODULE_SHIPPING_FEDEX_WEB_SERVICES_SORT_ORDER_' . $vendors_id); if (isset ($sort_order)) { $this->sort_order = $sort_order; } else { $this->sort_order = ''; } return $this->sort_order; } function tax_class($vendors_id = '1') { $this->tax_class = constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_TAX_CLASS_' . $vendors_id); return $this->tax_class; } function enabled($vendors_id = '1') { $this->enabled = false; $status = @[member='constant']('MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATUS_' . $vendors_id); if (isset ($status) && $status != '') { $this->enabled = (($status == 'true') ? true : false); } if ( ($this->enabled == true) && ((int)constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_ZONE_' . $vendors_id) > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . (int)constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_ZONE_' . $vendors_id) . "' and zone_country_id = '" . $this->delivery_country_id . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $this->delivery_zone_id) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } return $this->enabled; } function zones($vendors_id = '1') { if ( ($this->enabled == true) && ((int)constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_ZONE_' . $vendors_id) > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . (int)constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_ZONE_' . $vendors_id) . "' and zone_country_id = '" . $this->delivery_country_id . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $this->delivery_zone_id) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } return $this->enabled; } // Get the quote from Fedex API function quote($method = '', $module = '', $vendors_id = '1') { global $shipping_weight, $shipping_num_boxes, $cart, $order; $this->vendors_id = $vendors_id; $this->weight_type = @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_WEIGHT_ . $this->vendors_id); $this->fedex_key = @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_KEY_ . $this->vendors_id); $this->fedex_pwd = @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_PWD_ . $this->vendors_id); $this->fedex_act_num = @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_ACT_NUM_ . $this->vendors_id); $this->fedex_meter_num = @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_METER_NUM_ . $this->vendors_id); @[member='definedmedia']('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INSURE_' . $this->vendors_id, 0); if (defined('MODULE_SHIPPING_FEDEX_WEB_SERVICES_SERVER_' . $this->vendors_id) && @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_SERVER_ . $this->vendors_id) == 'Test') { $path_to_wsdl = DIR_FS_CATALOG . 'includes/wsdl/RateService_v9_test.wsdl'; } else { $path_to_wsdl = DIR_FS_CATALOG . 'includes/wsdl/RateService_v9.wsdl'; } ini_set("soap.wsdl_cache_enabled", "0"); $client = new SoapClient($path_to_wsdl, array('trace' => 1)); $this->types = array(); if (@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_PRIORITY_ . $this->vendors_id) == 'true') { $this->types['INTERNATIONAL_PRIORITY'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); $this->types['EUROPE_FIRST_INTERNATIONAL_PRIORITY'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); } if (@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_ECONOMY_ . $this->vendors_id) == 'true') { $this->types['INTERNATIONAL_ECONOMY'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); } if (@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_STANDARD_OVERNIGHT_ . $this->vendors_id) == 'true') { $this->types['STANDARD_OVERNIGHT'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); } if (@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_FIRST_OVERNIGHT_ . $this->vendors_id) == 'true') { $this->types['FIRST_OVERNIGHT'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); } if (@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_PRIORITY_OVERNIGHT_ . $this->vendors_id) == 'true') { $this->types['PRIORITY_OVERNIGHT'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); } if (@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_2DAY_ . $this->vendors_id) == 'true') { $this->types['FEDEX_2_DAY'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); } // 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 ((@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_GROUND_ . $this->vendors_id) == 'true' && $order->delivery['country']['id'] == STORE_COUNTRY) || (@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_GROUND_ . $this->vendors_id) == 'true' && ($order->delivery['country']['id'] != STORE_COUNTRY) && @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_GROUND_ . $this->vendors_id) == 'true')) { $this->types['FEDEX_GROUND'] = array('icon' => '', 'handling_fee' => ($order->delivery['country']['id'] == STORE_COUNTRY ? @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_HANDLING_FEE_ . $this->vendors_id) : @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_HANDLING_FEE_ . $this->vendors_id))); $this->types['GROUND_HOME_DELIVERY'] = array('icon' => '', 'handling_fee' => ($order->delivery['country']['id'] == STORE_COUNTRY ? @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_HOME_DELIVERY_HANDLING_FEE_ . $this->vendors_id) : @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_HANDLING_FEE_ . $this->vendors_id))); } if (@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_GROUND_ . $this->vendors_id) == 'true') { $this->types['INTERNATIONAL_GROUND'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_HANDLING_FEE_ . $this->vendors_id)); } if (@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_SAVER_ . $this->vendors_id) == 'true') { $this->types['FEDEX_EXPRESS_SAVER'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); } if (@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_FREIGHT_ . $this->vendors_id) == 'true') { $this->types['FEDEX_FREIGHT'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); $this->types['FEDEX_NATIONAL_FREIGHT'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); $this->types['FEDEX_1_DAY_FREIGHT'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); $this->types['FEDEX_2_DAY_FREIGHT'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); $this->types['FEDEX_3_DAY_FREIGHT'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); $this->types['INTERNATIONAL_ECONOMY_FREIGHT'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); $this->types['INTERNATIONAL_PRIORITY_FREIGHT'] = array('icon' => '', 'handling_fee' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE_ . $this->vendors_id)); } // customer details $street_address = $order->delivery['street_address']; $street_address2 = $order->delivery['suburb']; $city = $order->delivery['city']; $state = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], ''); if ($state == "QC") $state = "PQ"; $postcode = str_replace(array(' ', '-'), '', $order->delivery['postcode']); //$country_id = $order->delivery['country']['iso_code_2']; $delivery_country_arr = $this->get_countries($this->delivery_country_id, true); $country_id = $delivery_country_arr['countries_iso_code_2']; $totals = $order->info['subtotal'] = $cart->total; $this->_setInsuranceValue($totals); $request['WebAuthenticationDetail'] = array('UserCredential' => array('Key' => $this->fedex_key, 'Password' => $this->fedex_pwd)); $request['ClientDetail'] = array('AccountNumber' => $this->fedex_act_num, 'MeterNumber' => $this->fedex_meter_num); $request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Rate Request v9 using PHP ***'); $request['Version'] = array('ServiceId' => 'crs', 'Major' => '9', 'Intermediate' => '0', 'Minor' => '0'); $request['ReturnTransitAndCommit'] = true; $request['RequestedShipment']['DropoffType'] = $this->_setDropOff(); // valid values REGULAR_PICKUP, REQUEST_COURIER, ... $request['RequestedShipment']['ShipTimestamp'] = date('c'); $request['RequestedShipment']['PackagingType'] = 'YOUR_PACKAGING'; // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ... $request['RequestedShipment']['TotalInsuredValue']=array('Ammount'=> $this->insurance, 'Currency' => $_SESSION['currency']); $request['WebAuthenticationDetail'] = array('UserCredential' => array('Key' => $this->fedex_key, 'Password' => $this->fedex_pwd)); $request['ClientDetail'] = array('AccountNumber' => $this->fedex_act_num, 'MeterNumber' => $this->fedex_meter_num); $request['RequestedShipment']['Shipper'] = array('Address' => array( 'StreetLines' => array(@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_1_ . $this->vendors_id), utf8_encode(@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_2_ . $this->vendors_id))), // Origin details 'City' => utf8_encode(@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_CITY_ . $this->vendors_id)), 'StateOrProvinceCode' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATE_ . $this->vendors_id), 'PostalCode' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_POSTAL_ . $this->vendors_id), 'CountryCode' => $this->country)); $request['RequestedShipment']['Recipient'] = array('Address' => array ( 'StreetLines' => array(utf8_encode($street_address), utf8_encode($street_address2)), // customer street address 'City' => utf8_encode($city), //customer city 'PostalCode' => $postcode, //customer postcode 'CountryCode' => $country_id, 'Residential' => ($order->delivery['company'] != '' ? false : true))); //customer county code if (in_array($country_id, array('US', 'CA'))) { $request['RequestedShipment']['Recipient']['StateOrProvinceCode'] = $state; } $request['RequestedShipment']['ShippingChargesPayment'] = array('PaymentType' => 'SENDER', 'Payor' => array('AccountNumber' => $this->fedex_act_num, // payor's account number 'CountryCode' => $this->country)); $request['RequestedShipment']['RateRequestTypes'] = 'LIST'; $request['RequestedShipment']['PackageDetail'] = 'INDIVIDUAL_PACKAGES'; $request['RequestedShipment']['RequestedPackageLineItems'] = array(); $dimensions_failed = false; // default method for calculating number of packages if ($shipping_weight == 0) $shipping_weight = 0.1; for ($i=0; $i<$shipping_num_boxes; $i++) { $request['RequestedShipment']['RequestedPackageLineItems'][] = array('Weight' => array('Value' => $shipping_weight, 'Units' => @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_WEIGHT_ . $this->vendors_id))); } $request['RequestedShipment']['PackageCount'] = $shipping_num_boxes; if (@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_SATURDAY_ . $this->vendors_id)== 'true') { $request['RequestedShipment']['ServiceOptionType'] = 'SATURDAY_DELIVERY'; } if (@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_SIGNATURE_OPTION_ . $this->vendors_id) >= 0 && $totals >= @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_SIGNATURE_OPTION_ . $this->vendors_id)) { $request['RequestedShipment']['SpecialServicesRequested'] = 'SIGNATURE_OPTION'; } $response = $client->getRates($request); if ($response->HighestSeverity != 'FAILURE' && $response->HighestSeverity != 'ERROR' && is_array($response->RateReplyDetails) || is_object($response->RateReplyDetails)) { if (is_object($response->RateReplyDetails)) { $response->RateReplyDetails = get_object_vars($response->RateReplyDetails); } $show_box_weight = " (Total items: " . $shipping_num_boxes . ' pcs. Total weight: '.number_format($shipping_weight * $shipping_num_boxes,2).' '.strtolower($this->weight_type).'s)'; $this->quotes = array('id' => $this->code, 'module' => $this->title . $show_box_weight, 'info' => $this->info()); $methods = array(); foreach ($response->RateReplyDetails as $rateReply) { if (array_key_exists($rateReply->ServiceType, $this->types) && ($method == '' || str_replace('_', '', $rateReply->ServiceType) == $method)) { if(@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_RATES_ . $this->vendors_id) == 'LIST') { foreach($rateReply->RatedShipmentDetails as $ShipmentRateDetail) { if($ShipmentRateDetail->ShipmentRateDetail->RateType=='PAYOR_LIST_PACKAGE') { $cost = $ShipmentRateDetail->ShipmentRateDetail->TotalNetCharge->Amount; $cost = (float)round(preg_replace('/[^0-9.]/', '', $cost), 2); } } } else { $cost = $rateReply->RatedShipmentDetails[0]->ShipmentRateDetail->TotalNetCharge->Amount; $cost = (float)round(preg_replace('/[^0-9.]/', '', $cost), 2); } if (in_array($rateReply->ServiceType, array('GROUND_HOME_DELIVERY', 'FEDEX_GROUND', 'INTERNATIONAL_GROUND'))) { $transitTime = ' (' . str_replace(array('_', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteeen'), array(' ', 1,2,3,4,5,6,7,8,9,10,11,12,13,14), strtolower($rateReply->TransitTime)) . ')'; } $methods[] = array('id' => str_replace('_', '', $rateReply->ServiceType), 'title' => ucwords(strtolower(str_replace('_', ' ', $rateReply->ServiceType))) . $transitTime, 'cost' => $cost + (strpos($this->types[$rateReply->ServiceType]['handling_fee'], '%') ? ($cost * (float)$this->types[$rateReply->ServiceType]['handling_fee'] / 100) : (float)$this->types[$rateReply->ServiceType]['handling_fee'])); } } $this->quotes['methods'] = $methods; if ($this->tax_class > 0) { $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); } } else { $message = 'Error in processing transaction.<br /><br />'; foreach ($response -> Notifications as $notification) { if(is_array($response -> Notifications)) { $message .= $notification->Severity; $message .= ': '; $message .= $notification->Message . '<br />'; } else { $message .= $notification->Message . '<br />'; } } $this->quotes = array('module' => $this->title, 'error' => $message); } // Fedex cannot ship to po box if (preg_match("/^P(.+)O(.+)BOX/i", $order->delivery['street_address']) || preg_match("/^PO BOX/i",$order->delivery['street_address']) || preg_match("/^P(.+)O(.+)BOX/i", $order->delivery['suburb']) || preg_match("/^[A-Z]PO/i", $order->delivery['street_address']) || preg_match("/^[A-Z]PO/i",$order->delivery['suburb'])) { $this->quotes = array('module' => $this->title, 'error' => '<font size=+2 color=red><b>Federal Express cannot ship to Post Office Boxes.<b></font><br>Use the Change Address button above to use a FedEx accepted street address.'); } if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title); return $this->quotes; } // Return expanded info in FEAC function info() { return @[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_INFO_ . $this->vendors_id); // add a description here or leave blank to disable } // Internal function to set insurance value function _setInsuranceValue($order_amount){ if ($order_amount > (float)@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_INSURE_ . $this->vendors_id)) { $this->insurance = sprintf("%01.2f", $order_amount); } else { $this->insurance = 0; } } // Set the drop off type function _setDropOff() { switch(@[member='constant'](MODULE_SHIPPING_FEDEX_WEB_SERVICES_DROPOFF_ . $this->vendors_id)) { case '1': return 'REGULAR_PICKUP'; break; case '2': return 'REQUEST_COURIER'; break; case '3': return 'DROP_BOX'; break; case '4': return 'BUSINESS_SERVICE_CENTER'; break; case '5': return 'STATION'; break; } } //Check the module status function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_VENDOR_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATUS_" . $this->vendors_id . "' and vendors_id = '" . $this->vendors_id . "'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } // Install the module function install($vendors_id = '1') { $this->vendors_id = $vendors_id; if ($this->ok_to_install) { tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) VALUES ('Enable FedEx Web Services','MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATUS_" . $this->vendors_id . "','true','Do you want to offer FedEx shipping?','6','0','tep_cfg_select_option(array(\'true\',\'false\'),',now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('FedEx Web Services Key', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_KEY_" . $this->vendors_id . "', '', 'Enter FedEx Web Services Key', '6', '3', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('FedEx Web Services Password', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_PWD_" . $this->vendors_id . "', '', 'Enter FedEx Web Services Password', '6', '3', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('FedEx Account Number', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ACT_NUM_" . $this->vendors_id . "', '', 'Enter FedEx Account Number', '6', '3', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('FedEx Meter Number', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_METER_NUM_" . $this->vendors_id . "', '', 'Enter FedEx Meter Number', '6', '4', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Weight Units', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_WEIGHT_" . $this->vendors_id . "', 'LB', 'Weight Units:', '6', '10', 'tep_cfg_select_option(array(\'LB\', \'KG\'), ', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('First line of street address', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_1_" . $this->vendors_id . "', '', 'Enter the first line of your ship-from street address, required', '6', '20', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Second line of street address', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_2_" . $this->vendors_id . "', '', 'Enter the second line of your ship-from street address, leave blank if you do not need to specify a second line', '6', '21', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('City name', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_CITY_" . $this->vendors_id . "', '', 'Enter the city name for the ship-from street address, required', '6', '22', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('State or Province name', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATE_" . $this->vendors_id . "', '', 'Enter the 2 letter state or province name for the ship-from street address, required for Canada and US', '6', '23', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Postal code', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_POSTAL_" . $this->vendors_id . "', '', 'Enter the postal code for the ship-from street address, required', '6', '24', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Phone number', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_PHONE_" . $this->vendors_id . "', '', 'Enter a contact phone number for your company, required', '6', '25', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Drop off type', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_DROPOFF_" . $this->vendors_id . "', '1', 'Dropoff type (1 = Regular pickup, 2 = request courier, 3 = drop box, 4 = drop at BSC, 5 = drop at station)?', '6', '30', 'tep_cfg_select_option(array(\'1\',\'2\',\'3\',\'4\',\'5\'),', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable Express Saver', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_SAVER_" . $this->vendors_id . "', 'true', 'Enable FedEx Express Saver', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable Standard Overnight', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_STANDARD_OVERNIGHT_" . $this->vendors_id . "', 'true', 'Enable FedEx Express Standard Overnight', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable First Overnight', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_FIRST_OVERNIGHT_" . $this->vendors_id . "', 'true', 'Enable FedEx Express First Overnight', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable Priority Overnight', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_PRIORITY_OVERNIGHT_" . $this->vendors_id . "', 'true', 'Enable FedEx Express Priority Overnight', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable 2 Day', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_2DAY_" . $this->vendors_id . "', 'true', 'Enable FedEx Express 2 Day', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable International Priority', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_PRIORITY_" . $this->vendors_id . "', 'true', 'Enable FedEx Express International Priority', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable International Economy', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_ECONOMY_" . $this->vendors_id . "', 'true', 'Enable FedEx Express International Economy', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable Ground', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_GROUND_" . $this->vendors_id . "', 'true', 'Enable FedEx Ground', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable International Ground', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_GROUND_" . $this->vendors_id . "', 'true', 'Enable FedEx International Ground', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable Freight', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_FREIGHT_" . $this->vendors_id . "', 'true', 'Enable FedEx Freight', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable Saturday Delivery', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SATURDAY_" . $this->vendors_id . "', 'false', 'Enable Saturday Delivery', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Domestic Ground Handling Fee', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_HANDLING_FEE_" . $this->vendors_id . "', '', 'Add a domestic handling fee or leave blank (example: 15 or 15%)', '6', '25', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Home Delivery Handling Fee', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_HOME_DELIVERY_HANDLING_FEE_" . $this->vendors_id . "', '', 'Add a home delivery handling fee or leave blank (example: 15 or 15%)', '6', '25', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Domestic Express Handling Fee', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_" . $this->vendors_id . "', '', 'Add a domestic handling fee or leave blank (example: 15 or 15%)', '6', '25', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('International Ground Handling Fee', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_HANDLING_FEE_" . $this->vendors_id . "', '', 'Add an international handling fee or leave blank (example: 15 or 15%)', '6', '25', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('International Express Handling Fee', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE_" . $this->vendors_id . "', '', 'Add an international handling fee or leave blank (example: 15 or 15%)', '6', '25', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) VALUES ('FedEx Rates','MODULE_SHIPPING_FEDEX_WEB_SERVICES_RATES_" . $this->vendors_id . "','LIST','FedEx Rates','6','0','tep_cfg_select_option(array(\'LIST\',\'ACCOUNT\'),',now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Signature Option', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SIGNATURE_OPTION_" . $this->vendors_id . "', '-1', 'Require a signature on orders greater than or equal to (set to -1 to disable):', '6', '25', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added, vendors_id) values ('Shipping Zone', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ZONE_" . $this->vendors_id . "', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '98', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added, vendors_id) values ('Tax Class', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_TAX_CLASS_" . $this->vendors_id . "', '0', 'Use the following tax class on the shipping fee.', '6', '25', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Web Services Mode', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SERVER_" . $this->vendors_id . "', 'Production', 'For testing using a developer key set to \"Test\". Otherwise set to \"Production\".', '6', '10', 'tep_cfg_select_option(array(\'Test\', \'Production\'), ', now(),'" . $this->vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Sort Order', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SORT_ORDER_" . $this->vendors_id . "', '0', 'Sort order of display.', '6', '99', now(),'" . $this->vendors_id . "')"); } } // Remove the module function remove($vendors_id = '1') { $this->vendors_id = $vendors_id; tep_db_query("delete from " . TABLE_VENDOR_CONFIGURATION . " where vendors_id = '". $this->vendors_id ."' and configuration_key in ('" . implode("', '", $this->keys($this->vendors_id)) . "')"); } // Return the module configuration values function keys($vendors_id = '1') { $this->vendors_id = $vendors_id; return array('MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATUS_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_KEY_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_PWD_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ACT_NUM_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_METER_NUM_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_WEIGHT_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_1_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_2_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_CITY_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATE_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_POSTAL_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_PHONE_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_DROPOFF_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_SAVER_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_STANDARD_OVERNIGHT_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_FIRST_OVERNIGHT_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_PRIORITY_OVERNIGHT_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_2DAY_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_PRIORITY_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_ECONOMY_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_GROUND_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_FREIGHT_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_GROUND_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SATURDAY_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_TAX_CLASS_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_HANDLING_FEE_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_HOME_DELIVERY_HANDLING_FEE_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_HANDLING_FEE_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_RATES_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SIGNATURE_OPTION_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ZONE_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SERVER_' . $this->vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SORT_ORDER_' . $this->vendors_id ); } // Get country info function get_countries($countries_id = '', $with_iso_codes = false) { $countries_array = array(); if (tep_not_null($countries_id)) { if ($with_iso_codes == true) { $countries = tep_db_query("select countries_name, countries_iso_code_2, countries_iso_code_3 from " . TABLE_COUNTRIES . " where countries_id = '" . (int)$countries_id . "' order by countries_name"); $countries_values = tep_db_fetch_array($countries); $countries_array = array('countries_name' => $countries_values['countries_name'], 'countries_iso_code_2' => $countries_values['countries_iso_code_2'], 'countries_iso_code_3' => $countries_values['countries_iso_code_3']); } else { $countries = tep_db_query("select countries_name from " . TABLE_COUNTRIES . " where countries_id = '" . (int)$countries_id . "'"); $countries_values = tep_db_fetch_array($countries); $countries_array = array('countries_name' => $countries_values['countries_name']); } } else { $countries = tep_db_query("select countries_id, countries_name from " . TABLE_COUNTRIES . " order by countries_name"); while ($countries_values = tep_db_fetch_array($countries)) { $countries_array[] = array('countries_id' => $countries_values['countries_id'], 'countries_name' => $countries_values['countries_name']); } } return $countries_array; } }
  8. lyonsperf

    Multi_Vendor_Shipping new thread

    This is getting rediculous. I can't get this file to work. Did a search online and found a company that is selling the code for $185.00! Just one file! So much for open source. I can't believe more people aren't asking for this addon for fedex webservices.
  9. lyonsperf

    Article Manager v1.0

    Nope, that caused a T_FUNCTION error.
  10. lyonsperf

    Article Manager v1.0

    Getting this error on my sitemap.php page Fatal error: Cannot redeclare getboldtags() (previously declared in /home/lyons/public_html/includes/boxes/articles.php:40) in /home/lyons/public_html/includes/boxes/articles.php on line 57
  11. lyonsperf

    Multi_Vendor_Shipping new thread

    Still haven't figured this out. Anyone get it to work?
  12. lyonsperf

    Header Tags SEO

    Hi Jack, It seems that my site repeats the same title bar tag regardless of what product page I am on. I reinstalled the latest version and it still does it. Example:HAN1202 - Tool Organizers - - Post Style Socket Organiser - 1/2" Drive; Metric appears at the top of each page even when I navigate to the shipping page. Any ideas? Here is the site link http://www.protoolzonline.com
  13. lyonsperf

    PayPal Website Payments Pro Hosted Solution (Official)

    Does this module replace the recurring profile modifications required from the previous pro mod? Also, the previous module had many changes to be made to several files to include the fmf and rp changes. I only see one file that requires comparing.
  14. lyonsperf

    Multi_Vendor_Shipping new thread

    Made some more changes but still not working <?php /* FedEx Webservice Version 9.4.2 for osCommerce 2.2rc2a and later(?) -by Roaddoctor 5/20/2012 New contributed code and the hard work credit to Jeff Lew. Thanks Jeff and Numinex! Support: http://forums.oscommerce.com/topic/375063-fedex-web-services-v9/page__view__findpost__p__1636568 */ class fedexwebservices { var $code, $title, $description, $icon, $sort_order, $enabled, $tax_class, $fedex_key, $fedex_pwd, $fedex_act_num, $fedex_meter_num, $country; //Class Constructor function fedexwebservices() { global $order, $vendors_id; @[member='definedmedia']('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INSURE_' . $vendors_id, 0); $this->code = "fedexwebservices"; $this->title = MODULE_SHIPPING_FEDEX_WEB_SERVICES_TEXT_TITLE; $this->description = MODULE_SHIPPING_FEDEX_WEB_SERVICES_TEXT_DESCRIPTION; // $this->sort_order = MODULE_SHIPPING_FEDEX_WEB_SERVICES_SORT_ORDER_ . $vendors_id; // $this->handling_fee = MODULE_SHIPPING_FEDEX_WEB_SERVICES_HANDLING_FEE; $this->icon = DIR_WS_ICONS . 'shipping_fedex.gif'; // $this->enabled = ((MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATUS == 'true') ? true : false); // $this->tax_class = MODULE_SHIPPING_FEDEX_WEB_SERVICES_TAX_CLASS; // $this->fedex_key = MODULE_SHIPPING_FEDEX_WEB_SERVICES_KEY; // $this->fedex_pwd = MODULE_SHIPPING_FEDEX_WEB_SERVICES_PWD; // $this->fedex_act_num = MODULE_SHIPPING_FEDEX_WEB_SERVICES_ACT_NUM; // $this->fedex_meter_num = MODULE_SHIPPING_FEDEX_WEB_SERVICES_METER_NUM; $vendors_data_query = tep_db_query("select handling_charge, handling_per_box, vendor_country, vendors_zipcode from " . TABLE_VENDORS . " where vendors_id = '" . (int)$vendors_id . "'" ); $vendors_data = tep_db_fetch_array($vendors_data_query); $country_name = tep_get_countries($vendors_data['vendor_country'], true); if (isset($vendors_data['vendor_country']) && $vendors_data['vendor_country'] != '') { $countries_array = tep_get_countries($vendors_data['vendor_country'], true); $this->country = $countries_array['countries_iso_code_2']; } else { $countries_array = tep_get_countries(SHIPPING_ORIGIN_COUNTRY, true); $this->country = STORE_ORIGIN_COUNTRY; } if ( ($this->enabled == true) && (int)constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_ZONE_' . $vendors_id > 0) ) { $check_flag = false; $check_query = tep_db_query ("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . (int)constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_ZONE_' . $vendors_id) . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id"); while( $check = tep_db_fetch_array($check_query)) { if ($check ['zone_id'] < 1) { $check_flag = true; break; } elseif ($check ['zone_id'] == $order->delivery['zone_id']) { $check_flag = true; break; } } } if ($check_flag == false) { $this->enabled = false; } } } function handling_fee($vendors_id='1') { $this->handling_fee = constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_HANDLING_FEE_' . $vendors_id); return $this->handling_fee; } function enabled($vendors_id='1') { $this->enabled = false; $status = @[member='constant']('MODULE_SHIPPING_FEDEX_WEB_SERVICES_TABLE_STATUS_' . $vendors_id); if (isset ($status) && $status != '') { $this->enabled = (($status == 'True') ? true : false); } if ( ($this->enabled == true) && ((int)constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_ZONE_' . $vendors_id) > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . (int)constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_ZONE_' . $vendors_id) . "' and zone_country_id = '" . $this->delivery_country_id . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $this->delivery_zone_id) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; }//if }//if return $this->enabled; } function tax_class($vendors_id='1') { $this->tax_class = constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_TABLE_TAX_CLASS_' . $vendors_id); return $this->tax_class; } function fedex_key($vendors_id='1') { $this->fedex_key = constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_KEY_' . $vendors_id); return $this->fedex_key; } function fedex_pwd($vendors_id='1') { $this->fedex_pwd = constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_PWD_' . $vendors_id); return $this->fedex_pwd; } function fedex_act_num($vendors_id='1') { $this->fedex_act_num = constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_ACT_NUM_' . $vendors_id); return $this->fedex_act_num; } function fedex_meter_num($vendors_id='1') { $this->fedex_meter_num = constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_METER_NUM_' . $vendors_id); return $this->fedex_meter_num; } function zones($vendors_id='1') { if ( ($this->enabled == true) && ((int)constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_TABLE_ZONE_' . $vendors_id) > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . (int)constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_TABLE_ZONE_' . $vendors_id) . "' and zone_country_id = '" . $this->delivery_country_id . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; // } elseif ($check['zone_id'] == $order->delivery['zone_id']) { } elseif ($check['zone_id'] == $this->delivery_zone_id) { $check_flag = true; break; } //if }//while if ($check_flag == false) { $this->enabled = false; }//if }//if return $this->enabled; }//function function sort_order($vendors_id='1') { $sort_order = @[member='constant'] ('MODULE_SHIPPING_FEDEX_WEB_SERVICES_TABLE_SORT_ORDER_' . $vendors_id); if (tep_not_null($sort_order)) { $this->sort_order = $sort_order; } else { $this->sort_order = '-'; } return $this->sort_order; } // class methods function quote($method = '', $module = '', $vendors_id = '1') { /* FedEx integration starts */ global $shipping_weight, $shipping_num_boxes, $cart, $order; require_once(DIR_FS_CATALOG . DIR_WS_INCLUDES . 'library/fedex-common.php5'); //if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_SERVER == 'test') { //$request['Version'] = array('ServiceId' => 'crs', 'Major' => '7', 'Intermediate' => '0', 'Minor' => '0'); //$path_to_wsdl = DIR_WS_INCLUDES . "wsdl/RateService_v7_test.wsdl"; //} else { $path_to_wsdl = DIR_FS_CATALOG . DIR_WS_INCLUDES . "wsdl/RateService_v9.wsdl"; //} ini_set("soap.wsdl_cache_enabled", "0"); $client = new SoapClient($path_to_wsdl, array('trace' => 1)); $this->types = array(); if (constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_PRIORITY_' . $vendors_id) == 'true') { $this->types['INTERNATIONAL_PRIORITY'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE_' . $vendors_id)); $this->types['EUROPE_FIRST_INTERNATIONAL_PRIORITY'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE_' . $vendors_id)); } if (constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_ECONOMY_' . $vendors_id) == 'true') { $this->types['INTERNATIONAL_ECONOMY'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE_' . $vendors_id)); } if (constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_STANDARD_OVERNIGHT_' . $vendors_id) == 'true') { $this->types['STANDARD_OVERNIGHT'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_' . $vendors_id)); } if (constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_FIRST_OVERNIGHT_' . $vendors_id) == 'true') { $this->types['FIRST_OVERNIGHT'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_' . $vendors_id)); } if (constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_PRIORITY_OVERNIGHT_' . $vendors_id) == 'true') { $this->types['PRIORITY_OVERNIGHT'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_' . $vendors_id)); } if (constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_2DAY_' . $vendors_id) == 'true') { $this->types['FEDEX_2_DAY'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_' . $vendors_id)); } // 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 (constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_GROUND_' . $vendors_id) == 'true' && ($order->delivery['country']['id'] == STORE_COUNTRY) || constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_GROUND_' . $vendors_id) == 'true' && ($order->delivery['country']['id'] != STORE_COUNTRY) && (constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_GROUND_' . $vendors_id) == 'true')) { $this->types['FEDEX_GROUND'] = array('icon' => '', 'handling_fee' => ($order->delivery['country']['id'] == STORE_COUNTRY ? constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_HANDLING_FEE_' . $vendors_id) : constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_HANDLING_FEE_' . $vendors_id))); $this->types['GROUND_HOME_DELIVERY'] = array('icon' => '', 'handling_fee' => ($order->delivery['country']['id'] == STORE_COUNTRY ? constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_HOME_DELIVERY_HANDLING_FEE_' . $vendors_id) : constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_HANDLING_FEE_' . $vendors_id))); } if (constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_GROUND_' . $vendors_id) == 'true') { $this->types['INTERNATIONAL_GROUND'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_HANDLING_FEE_' . $vendors_id)); } if (constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_SAVER_' . $vendors_id) == 'true') { $this->types['FEDEX_EXPRESS_SAVER'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_' . $vendors_id)); } if (constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_FREIGHT_' . $vendors_id) == 'true') { $this->types['FEDEX_FREIGHT'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_' . $vendors_id)); $this->types['FEDEX_NATIONAL_FREIGHT'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_' . $vendors_id)); $this->types['FEDEX_1_DAY_FREIGHT'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_' . $vendors_id)); $this->types['FEDEX_2_DAY_FREIGHT'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_' . $vendors_id)); $this->types['FEDEX_3_DAY_FREIGHT'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_' . $vendors_id)); $this->types['INTERNATIONAL_ECONOMY_FREIGHT'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE_' . $vendors_id)); $this->types['INTERNATIONAL_PRIORITY_FREIGHT'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE_' . $vendors_id)); } // $this->types[] = 'SMART_POST'; // customer details $street_address = $order->delivery['street_address']; $street_address2 = $order->delivery['suburb']; $city = $order->delivery['city']; $state = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], ''); if ($state == "QC") $state = "PQ"; $postcode = str_replace(array(' ', '-'), '', $order->delivery['postcode']); $country_id = $order->delivery['country']['iso_code_2']; $totals = $cart->show_total(); $totals = $cart->vendor_shipping[$vendors_id]['subtotal']; $this->_setInsuranceValue($totals / $shipping_num_boxes, $vendors_id); $request['WebAuthenticationDetail'] = array('UserCredential' => array('Key' => $this->fedex_key, 'Password' => $this->fedex_pwd)); $request['ClientDetail'] = array('AccountNumber' => $this->fedex_act_num, 'MeterNumber' => $this->fedex_meter_num); $request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Rate Request v9 using PHP ***'); // $request['RequestedShipment']['SmartPostDetail'] = array( // 'Indicia' => 'MEDIA_MAIL', // 'AncillaryEndorsement' => 'CARRIER_LEAVE_IF_NO_RESPONSE', // 'SpecialServices' => 'USPS_DELIVERY_CONFIRMATION', // 'HubId' => '5254', // 'CustomerManifestId' => 1101); // $request['RequestedShipment']['ServiceType'] = 'SMART_POST'; $request['Version'] = array('ServiceId' => 'crs', 'Major' => '9', 'Intermediate' => '0', 'Minor' => '0'); $request['ReturnTransitAndCommit'] = true; $request['RequestedShipment']['DropoffType'] = $this->_setDropOff(); // valid values REGULAR_PICKUP, REQUEST_COURIER, ... $request['RequestedShipment']['ShipTimestamp'] = date('c'); $request['RequestedShipment']['PackagingType'] = 'YOUR_PACKAGING'; // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ... $request['RequestedShipment']['TotalInsuredValue']=array('Ammount'=> $this->insurance, 'Currency' => $_SESSION['currency']); $request['WebAuthenticationDetail'] = array('UserCredential' => array('Key' => $this->fedex_key, 'Password' => $this->fedex_pwd)); $request['ClientDetail'] = array('AccountNumber' => $this->fedex_act_num, 'MeterNumber' => $this->fedex_meter_num); // print_r($request['WebAuthenticationDetail']); // print_r($request['ClientDetail']); // exit; $request['RequestedShipment']['Shipper'] = array('Address' => array( 'StreetLines' => array (constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_1_' . $vendors_id), constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_2_' . $vendors_id))), // Origin details '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($street_address, $street_address2), // customer street address 'City' => $city, //customer city // 'StateOrProvinceCode' => $state, //customer state 'PostalCode' => $postcode, //customer postcode 'CountryCode' => $country_id, 'Residential' => ($order->delivery['company'] != '' ? false : true))); //customer county code if (in_array($country_id, array('US', 'CA'))) { $request['RequestedShipment']['Recipient']['StateOrProvinceCode'] = $state; } // print_r($request['RequestedShipment']['Recipient']) ; // exit; $request['RequestedShipment']['ShippingChargesPayment'] = array('PaymentType' => 'SENDER', 'Payor' => array('AccountNumber' => $this->fedex_act_num, // payor's account number 'CountryCode' => $this->country)); $request['RequestedShipment']['RateRequestTypes'] = 'LIST'; $request['RequestedShipment']['PackageDetail'] = 'INDIVIDUAL_PACKAGES'; $request['RequestedShipment']['RequestedPackageLineItems'] = array(); $dimensions_failed = false; if (count($packages) > 1) { $za_tare_array = preg_split("/[:,]/" , SHIPPING_BOX_WEIGHT); $zc_tare_percent= $za_tare_array[0]; $zc_tare_weight= $za_tare_array[1]; $za_large_array = preg_split("/[:,]/" , SHIPPING_BOX_PADDING); $zc_large_percent= $za_large_array[0]; $zc_large_weight= $za_large_array[1]; } foreach ($packages as $id => $values) { if ($id === 'default') { // divide the weight by the max amount to be shipped (can be done inside loop as this occurance should only ever happen once // note $values is not an array if ($values == 0) continue; $shipping_num_boxes = ceil((float)$values / (float)SHIPPING_MAX_WEIGHT); if ($shipping_num_boxes < 1) $shipping_num_boxes = 1; $shipping_weight = round((float)$values / $shipping_num_boxes, 2); // 2 decimal places max for ($i=0; $i<$shipping_num_boxes; $i++) { $new_shipping_num_boxes++; if (SHIPPING_MAX_WEIGHT <= $shipping_weight) { $shipping_weight = $shipping_weight + ($shipping_weight*($zc_large_percent/100)) + $zc_large_weight; } else { $shipping_weight = $shipping_weight + ($shipping_weight*($zc_tare_percent/100)) + $zc_tare_weight; } if ($shipping_weight <= 0) $shipping_weight = 0.1; $new_shipping_weight += $shipping_weight; $request['RequestedShipment']['RequestedPackageLineItems'][] = array('Weight' => array('Value' => $shipping_weight, 'Units' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_WEIGHT_' . $vendors_id)) ); } } else { // note $values is an array $new_shipping_num_boxes++; if ($values['weight'] <= 0) $values['weight'] = 0.1; $new_shipping_weight += $values['weight']; $request['RequestedShipment']['RequestedPackageLineItems'][] = array('Weight' => array('Value' => $values['weight'], 'Units' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_WEIGHT_' . $vendors_id)) ); } } $shipping_num_boxes = $new_shipping_num_boxes; If (!$shipping_num_boxes || $shipping_num_boxes == 0) { $shipping_num_boxes = 1; } $shipping_weight = round($new_shipping_weight / $shipping_num_boxes, 2); $request['RequestedShipment']['RequestedPackageLineItems'][] = array('Weight' => array('Value' => $shipping_weight, 'Units' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_WEIGHT_' . $vendors_id))); } $request['RequestedShipment']['PackageCount'] = $shipping_num_boxes; if (constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_SATURDAY_' . $vendors_id) == 'true') { $request['RequestedShipment']['ServiceOptionType'] = 'SATURDAY_DELIVERY'; } if (constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_SIGNATURE_OPTION_' . $vendors_id)>= 0 && $totals >= MODULE_SHIPPING_FEDEX_WEB_SERVICES_SIGNATURE_OPTION) { $request['RequestedShipment']['SpecialServicesRequested'] = 'SIGNATURE_OPTION'; } // echo '<!-- shippingWeight: ' . $shipping_weight . ' ' . $shipping_num_boxes . ' -->'; // echo '<!-- '; // echo '<pre>'; // print_r($request); // echo '</pre>'; // echo ' -->'; $response = $client->getRates($request); // echo '<!-- '; // echo '<pre>'; // print_r($response); // echo '</pre>'; // echo ' -->'; if ($response->HighestSeverity != 'FAILURE' && $response->HighestSeverity != 'ERROR' && is_array($response->RateReplyDetails) || is_object($response->RateReplyDetails)) { if (is_object($response->RateReplyDetails)) { $response->RateReplyDetails = get_object_vars($response->RateReplyDetails); } // echo '<pre>'; // print_r($response->RateReplyDetails); // echo '</pre>'; $show_box_weight = " (Total items: " . $shipping_num_boxes . ' pcs. Total weight: '.number_format($shipping_weight * $shipping_num_boxes,2).' '.strtolower ('MODULE_SHIPPING_FEDEX_WEB_SERVICES_WEIGHT_' . $vendors_id).'s.)'; $this->quotes = array('id' => $this->code, 'module' => $this->title . $show_box_weight, 'info' => $this->info($vendors_id)); // echo '<pre>'; // print_r($response->RateReplyDetails); // echo '</pre>'; // EXIT(); $methods = array(); // echo '<pre>'; // print_r($this->types); // echo '</pre>'; foreach ($response->RateReplyDetails as $rateReply) { if (array_key_exists($rateReply->ServiceType, $this->types) && ($method == '' || str_replace('_', '', $rateReply->ServiceType) == $method)) { if (constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_RATES_' . $vendors_id)=='LIST') { foreach($rateReply->RatedShipmentDetails as $ShipmentRateDetail) { if($ShipmentRateDetail->ShipmentRateDetail->RateType=='PAYOR_LIST_PACKAGE') { $cost = $ShipmentRateDetail->ShipmentRateDetail->TotalNetCharge->Amount; $cost = (float)round(preg_replace('/[^0-9.]/', '', $cost), 2); } } } else { $cost = $rateReply->RatedShipmentDetails[0]->ShipmentRateDetail->TotalNetCharge->Amount; $cost = (float)round(preg_replace('/[^0-9.]/', '', $cost), 2); } if (in_array($rateReply->ServiceType, array('GROUND_HOME_DELIVERY', 'FEDEX_GROUND', 'INTERNATIONAL_GROUND'))) { // print_r($rateReply); $transitTime = ' (' . str_replace(array('_', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteeen'), array(' ', 1,2,3,4,5,6,7,8,9,10,11,12,13,14), strtolower($rateReply->TransitTime)) . ')'; } $methods[] = array('id' => str_replace('_', '', $rateReply->ServiceType), 'title' => ucwords(strtolower(str_replace('_', ' ', $rateReply->ServiceType))) . $transitTime, 'cost' => $cost + (strpos($this->types[$rateReply->ServiceType]['handling_fee'], '%') ? ($cost * (float)$this->types[$rateReply->ServiceType]['handling_fee'] / 100) : (float)$this->types[$rateReply->ServiceType]['handling_fee'])); } } // usort($methods, 'cmp'); $this->quotes['methods'] = $methods; if ($this->tax_class($vendors_id) > 0) { $this->quotes['tax'] = tep_get_tax_rate($this->tax_class($vendors_id), $order->delivery['country']['id'], $order->delivery['zone_id']); } } else { $message = 'Error in processing transaction.<br /><br />'; foreach ($response -> Notifications as $notification) { if(is_array($response -> Notifications)) { $message .= $notification->Severity; $message .= ': '; $message .= $notification->Message . '<br />'; } else { $message .= $notification->Message . '<br />'; } } $vendors_data_query = tep_db_query("select handling_charge, handling_per_box, vendor_country, vendors_zipcode from " . TABLE_VENDORS . " where vendors_id = '" . (int)$vendors_id . "'" ); $vendors_data = tep_db_fetch_array($vendors_data_query); $country_name = tep_get_countries($vendors_data['vendor_country'], true); if (isset($vendors_data['vendor_country']) && $vendors_data['vendor_country'] != '') { $countries_array = tep_get_countries($vendors_data['vendor_country'], true); $this->country = $countries_array['countries_iso_code_2']; } else { $countries_array = tep_get_countries(SHIPPING_ORIGIN_COUNTRY, true); $this->country = STORE_ORIGIN_COUNTRY; } // $vendors_data = tep_db_fetch_array($vendors_data_query); $handling_charge = $vendors_data['handling_charge']; $handling_per_box = $vendors_data['handling_per_box']; if ($handling_charge > $handling_per_box * $shipping_num_boxes) { $handling = $handling_charge; } else { $handling = $handling_per_box * $shipping_num_boxes; } $this->quotes = array('module' => $this->title, 'error' => $message); // po box hack by JD if (eregi("^P(.+)O(.+)BOX",$order->delivery['street_address']) ||eregi("^PO BOX",$order->delivery['street_address']) || eregi("^P(.+)O(.+)BOX",$order->delivery['suburb']) || eregi("^[A-Z]PO",$order->delivery['street_address']) || eregi("^[A-Z]PO",$order->delivery['suburb'])) { $this->quotes = array('module' => $this->title, 'error' => '<font size=+2 color=red><b>Federal Express cannot ship to Post Office Boxes.<b></font><br>Use the Change Address button above to use a FedEx accepted street address.'); } // end po box hack by JD if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title); // echo '<!-- Quotes: '; // print_r($this->quotes); // print_r($_SESSION['shipping']); // echo ' -->'; return $this->quotes; } function cmp($a, $b, $vendors_id) { if ($a['cost'] == $b['cost']) { return 0; } return ($a['cost'] < $b['cost']) ? -1 : 1; } // method added for expanded info in FEAC function info($vendors_id) { return MODULE_SHIPPING_FEDEX_WEB_SERVICES_INFO; // add a description here or leave blank to disable } function _setInsuranceValue($order_amount, $vendors_id = '1'){ if ($order_amount > constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INSURE_' . $vendors_id)) { $this->insurance = sprintf("%01.2f", $order_amount); } else { $this->insurance = 0; } } function objectToArray($object, $vendors_id) { if( !is_object( $object ) && !is_array( $object ) ) { return $object; } if( is_object( $object ) ) { $object = get_object_vars( $object ); } return array_map( 'objectToArray', $object ); } function _setDropOff($vendors_id) { switch(MODULE_SHIPPING_FEDEX_WEB_SERVICES_DROPOFF) { case '1': return 'REGULAR_PICKUP'; break; case '2': return 'REQUEST_COURIER'; break; case '3': return 'DROP_BOX'; break; case '4': return 'BUSINESS_SERVICE_CENTER'; break; case '5': return 'STATION'; break; } } //MVS function check($vendors_id='1') { if(!isset($this->_check)){ //multi vendor add "vendors_id = '". $vendors_id ."' and" $check_query = tep_db_query("SELECT configuration_value FROM ". TABLE_VENDOR_CONFIGURATION ." WHERE configuration_key = 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATUS_" . $vendors_id . "' and vendors_id = '" . $vendors_id . "'"); $this->_check = tep_db_num_rows ($check_query); } return $this->_check; } function install($vendors_id='1') { tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) VALUES ('Enable FedEx Web Services','MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATUS_" . $vendors_id . "', 'true','Do you want to offer FedEx shipping?','6','0','tep_cfg_select_option(array(\'true\',\'false\'), ', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('FedEx Web Services Key', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_KEY_" . $vendors_id . "', '', 'Enter FedEx Web Services Key', '6', '3', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('FedEx Web Services Password', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_PWD_" . $vendors_id . "', '', 'Enter FedEx Web Services Password', '6', '3', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('FedEx Account Number', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ACT_NUM_" . $vendors_id . "', '', 'Enter FedEx Account Number', '6', '3', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('FedEx Meter Number', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_METER_NUM_" . $vendors_id . "', '', 'Enter FedEx Meter Number', '6', '4', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Weight Units', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_WEIGHT_" . $vendors_id . "', 'LB', 'Weight Units:', '6', '10', 'tep_cfg_select_option(array(\'LB\', \'KG\'), ', now())"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('First line of street address', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_1_" . $vendors_id . "', '', 'Enter the first line of your ship-from street address, required', '6', '20', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Second line of street address', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_2_" . $vendors_id . "', '', 'Enter the second line of your ship-from street address, leave blank if you do not need to specify a second line', '6', '21', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('City name', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_CITY_" . $vendors_id . "', '', 'Enter the city name for the ship-from street address, required', '6', '22', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('State or Province name', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATE_" . $vendors_id . "', '', 'Enter the 2 letter state or province name for the ship-from street address, required for Canada and US', '6', '23', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Postal code', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_POSTAL_" . $vendors_id . "', '', 'Enter the postal code for the ship-from street address, required', '6', '24', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Phone number', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_PHONE_" . $vendors_id . "', '', 'Enter a contact phone number for your company, required', '6', '25', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Drop off type', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_DROPOFF_" . $vendors_id . "', '1', 'Dropoff type (1 = Regular pickup, 2 = request courier, 3 = drop box, 4 = drop at BSC, 5 = drop at station)?', '6', '30', 'tep_cfg_select_option(array(\'1\',\'2\',\'3\',\'4\',\'5\'),', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable Express Saver', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_SAVER_" . $vendors_id . "', 'true', 'Enable FedEx Express Saver', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable Standard Overnight', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_STANDARD_OVERNIGHT_" . $vendors_id . "', 'true', 'Enable FedEx Express Standard Overnight', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable First Overnight', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_FIRST_OVERNIGHT_" . $vendors_id . "', 'true', 'Enable FedEx Express First Overnight', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable Priority Overnight', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_PRIORITY_OVERNIGHT_" . $vendors_id . "', 'true', 'Enable FedEx Express Priority Overnight', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable 2 Day', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_2DAY_" . $vendors_id . "', 'true', 'Enable FedEx Express 2 Day', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable International Priority', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_PRIORITY_" . $vendors_id . "', 'true', 'Enable FedEx Express International Priority', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable International Economy', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_ECONOMY_" . $vendors_id . "', 'true', 'Enable FedEx Express International Economy', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable Ground', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_GROUND_" . $vendors_id . "', 'true', 'Enable FedEx Ground', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable International Ground', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_GROUND_" . $vendors_id . "', 'true', 'Enable FedEx International Ground', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable Freight', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_FREIGHT_" . $vendors_id . "', 'true', 'Enable FedEx Freight', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable Saturday Delivery', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SATURDAY_" . $vendors_id . "', 'false', 'Enable Saturday Delivery', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Domestic Ground Handling Fee', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_HANDLING_FEE_" . $vendors_id . "', '', 'Add a domestic handling fee or leave blank (example: 15 or 15%)', '6', '25', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Home Delivery Handling Fee', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_HOME_DELIVERY_HANDLING_FEE_" . $vendors_id . "', '', 'Add a home delivery handling fee or leave blank (example: 15 or 15%)', '6', '25', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Domestic Express Handling Fee', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_" . $vendors_id . "', '', 'Add a domestic handling fee or leave blank (example: 15 or 15%)', '6', '25', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('International Ground Handling Fee', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_HANDLING_FEE_" . $vendors_id . "', '', 'Add an international handling fee or leave blank (example: 15 or 15%)', '6', '25', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('International Express Handling Fee', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE_" . $vendors_id . "', '', 'Add an international handling fee or leave blank (example: 15 or 15%)', '6', '25', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) VALUES ('FedEx Rates','MODULE_SHIPPING_FEDEX_WEB_SERVICES_RATES_" . $vendors_id . "','LIST','FedEx Rates','6','0','tep_cfg_select_option(array(\'LIST\',\'ACCOUNT\'),',now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Signature Option', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SIGNATURE_OPTION_" . $vendors_id . "', '-1', 'Require a signature on orders greater than or equal to (set to -1 to disable):', '6', '25', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable Ready to Ship', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_READY_TO_SHIP_" . $vendors_id . "', 'false', 'Enable products_ship_sep or products_ready_to_ship field (required to identify products which ship separately', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added, vendors_id) values ('Shipping Zone', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ZONE_" . $vendors_id . "', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '98', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added, vendors_id) values ('Tax Class', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_TAX_CLASS_" . $vendors_id . "', '0', 'Use the following tax class on the shipping fee.', '6', '25', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Sort Order', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SORT_ORDER_" . $vendors_id . "', '0', 'Sort order of display.', '6', '99', now(), '" . $vendors_id . "')"); } function remove($vendors_id) { tep_db_query("delete from " . TABLE_VENDOR_CONFIGURATION . " where vendors_id = '". $vendors_id ."' and configuration_key in ('" . implode("', '", $this->keys($vendors_id)) . "')"); } function keys($vendors_id) { return array('MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATUS_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_KEY_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_PWD_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ACT_NUM_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_METER_NUM_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_WEIGHT_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_1_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_2_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_CITY_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATE_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_POSTAL_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_PHONE_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_DROPOFF_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_SAVER_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_STANDARD_OVERNIGHT_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_FIRST_OVERNIGHT_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_PRIORITY_OVERNIGHT_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_2DAY_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_PRIORITY_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_ECONOMY_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_GROUND_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_FREIGHT_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_GROUND_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SATURDAY_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_TAX_CLASS_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_HANDLING_FEE_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_HOME_DELIVERY_HANDLING_FEE_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_HANDLING_FEE_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INSURE_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_RATES_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SIGNATURE_OPTION_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_READY_TO_SHIP_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ZONE_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SORT_ORDER_' . $vendors_id); } function get_countries($countries_id = '', $vendors_id, $with_iso_codes = false) { $countries_array = array(); if (tep_not_null($countries_id)) { if ($with_iso_codes == true) { $countries = tep_db_query("select countries_name, countries_iso_code_2, countries_iso_code_3 from " . TABLE_COUNTRIES . " where countries_id = '" . (int)$countries_id . "' order by countries_name"); $countries_values = tep_db_fetch_array($countries); $countries_array = array('countries_name' => $countries_values['countries_name'], 'countries_iso_code_2' => $countries_values['countries_iso_code_2'], 'countries_iso_code_3' => $countries_values['countries_iso_code_3']); } else { $countries = tep_db_query("select countries_name from " . TABLE_COUNTRIES . " where countries_id = '" . (int)$countries_id . "'"); $countries_values = tep_db_fetch_array($countries); $countries_array = array('countries_name' => $countries_values['countries_name']); } } else { $countries = tep_db_query("select countries_id, countries_name from " . TABLE_COUNTRIES . " order by countries_name"); while ($countries_values = tep_db_fetch_array($countries)) { $countries_array[] = array('countries_id' => $countries_values['countries_id'], 'countries_name' => $countries_values['countries_name']); } } return $countries_array; } ?>
  15. lyonsperf

    Multi_Vendor_Shipping new thread

    I've run into a wall and can't get this to work. Here is what I have so far with the includes/modules/vendors_shipping/ <?php /* FedEx Webservice Version 9.4.2 for osCommerce 2.2rc2a and later(?) -by Roaddoctor 5/20/2012 New contributed code and the hard work credit to Jeff Lew. Thanks Jeff and Numinex! Support: http://forums.oscommerce.com/topic/375063-fedex-web-services-v9/page__view__findpost__p__1636568 */ class fedexwebservices { var $code, $title, $description, $icon, $sort_order, $enabled, $tax_class, $fedex_key, $fedex_pwd, $fedex_act_num, $fedex_meter_num, $country; //Class Constructor function fedexwebservices() { global $order, $vendors_id; @[member='definedmedia']('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INSURE_' . $vendors_id, 0); $this->code = "fedexwebservices"; $this->title = MODULE_SHIPPING_FEDEX_WEB_SERVICES_TEXT_TITLE; $this->description = MODULE_SHIPPING_FEDEX_WEB_SERVICES_TEXT_DESCRIPTION; // $this->sort_order = MODULE_SHIPPING_FEDEX_WEB_SERVICES_SORT_ORDER_ . $vendors_id; // $this->handling_fee = MODULE_SHIPPING_FEDEX_WEB_SERVICES_HANDLING_FEE; $this->icon = DIR_WS_ICONS . 'shipping_fedex.gif'; // $this->enabled = ((MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATUS == 'true') ? true : false); // $this->tax_class = MODULE_SHIPPING_FEDEX_WEB_SERVICES_TAX_CLASS; // $this->fedex_key = MODULE_SHIPPING_FEDEX_WEB_SERVICES_KEY; // $this->fedex_pwd = MODULE_SHIPPING_FEDEX_WEB_SERVICES_PWD; // $this->fedex_act_num = MODULE_SHIPPING_FEDEX_WEB_SERVICES_ACT_NUM; // $this->fedex_meter_num = MODULE_SHIPPING_FEDEX_WEB_SERVICES_METER_NUM; $vendors_data_query = tep_db_query("select handling_charge, handling_per_box, vendor_country, vendors_zipcode from " . TABLE_VENDORS . " where vendors_id = '" . (int)$vendors_id . "'" ); $vendors_data = tep_db_fetch_array($vendors_data_query); $country_name = tep_get_countries($vendors_data['vendor_country'], true); if (isset($vendors_data['vendor_country']) && $vendors_data['vendor_country'] != '') { $countries_array = tep_get_countries($vendors_data['vendor_country'], true); $this->country = $countries_array['countries_iso_code_2']; } else { $countries_array = tep_get_countries(SHIPPING_ORIGIN_COUNTRY, true); $this->country = STORE_ORIGIN_COUNTRY; } if ( ($this->enabled == true) && ((int)constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_ZONE_' . $vendors_id > 0) ) { $check_flag = false; $check_query = tep_db_query ("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . (int)constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_ZONE_' . $vendors_id) . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id"); while( $check = tep_db_fetch_array($check_query)) { if ($check ['zone_id'] < 1) { $check_flag = true; break; } elseif ($check ['zone_id'] == $order->delivery['zone_id']) { $check_flag = true; break; } $check->MoveNext(); } if ($check_flag == false) { $this->enabled = false; } } } function sort_order($vendors_id='1') { if (defined (@[member='constant'] ('MODULE_SHIPPING_FEDEX_WEB_SERVICES_TABLE_SORT_ORDER_' . $vendors_id))) { $this->sort_order = @[member='constant']('MODULE_SHIPPING_FEDEX_WEB_SERVICES_TABLE_SORT_ORDER_' . $vendors_id); } else { $this->sort_order = '0'; } return $this->sort_order; } function handling_fee($vendors_id='1') { $this->handling_fee = constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_HANDLING_FEE_' . $vendors_id); return $this->handling_fee; } function tax_class($vendors_id='1') { $this->tax_class = constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_TABLE_TAX_CLASS_' . $vendors_id); return $this->tax_class; } function enabled($vendors_id='1') { $this->enabled = false; $status = @[member='constant']('MODULE_SHIPPING_FEDEX_WEB_SERVICES_TABLE_STATUS_' . $vendors_id); if (isset ($status) && $status != '') { $this->enabled = (($status == 'True') ? true : false); } if ( ($this->enabled == true) && ((int)constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_ZONE_' . $vendors_id) > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . (int)constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_ZONE_' . $vendors_id) . "' and zone_country_id = '" . $this->delivery_country_id . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $this->delivery_zone_id) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; }//if }//if return $this->enabled; } function fedex_key($vendors_id='1') { $this->fedex_key = constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_KEY_' . $vendors_id); return $this->fedex_key; } function fedex_pwd($vendors_id='1') { $this->fedex_pwd = constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_PWD_' . $vendors_id); return $this->fedex_pwd; } function fedex_act_num($vendors_id='1') { $this->fedex_act_num = constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_ACT_NUM_' . $vendors_id); return $this->fedex_act_num; } function fedex_meter_num($vendors_id='1') { $this->fedex_meter_num = constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_METER_NUM_' . $vendors_id); return $this->fedex_meter_num; } function zones($vendors_id='1') { if ( ($this->enabled == true) && ((int)constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_TABLE_ZONE_' . $vendors_id) > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . (int)constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_TABLE_ZONE_' . $vendors_id) . "' and zone_country_id = '" . $this->delivery_country_id . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; // } elseif ($check['zone_id'] == $order->delivery['zone_id']) { } elseif ($check['zone_id'] == $this->delivery_zone_id) { $check_flag = true; break; } //if }//while if ($check_flag == false) { $this->enabled = false; }//if }//if return $this->enabled; }//function // class methods function quote($method = '',$vendors_id = '1') { /* FedEx integration starts */ global $shipping_weight, $shipping_num_boxes, $cart, $order; require_once(DIR_FS_CATALOG . DIR_WS_INCLUDES . 'library/fedex-common.php5'); //if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_SERVER == 'test') { //$request['Version'] = array('ServiceId' => 'crs', 'Major' => '7', 'Intermediate' => '0', 'Minor' => '0'); //$path_to_wsdl = DIR_WS_INCLUDES . "wsdl/RateService_v7_test.wsdl"; //} else { $path_to_wsdl = DIR_FS_CATALOG . DIR_WS_INCLUDES . "wsdl/RateService_v9.wsdl"; //} ini_set("soap.wsdl_cache_enabled", "0"); $client = new SoapClient($path_to_wsdl, array('trace' => 1)); $this->types = array(); if constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_PRIORITY_' . $vendors_id) == 'true') { $this->types['INTERNATIONAL_PRIORITY'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE_' . $vendors_id); $this->types['EUROPE_FIRST_INTERNATIONAL_PRIORITY'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE_' . $vendors_id); } if constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_ECONOMY_' . $vendors_id) == 'true') { $this->types['INTERNATIONAL_ECONOMY'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE_' . $vendors_id); } if constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_STANDARD_OVERNIGHT_' . $vendors_id) == 'true') { $this->types['STANDARD_OVERNIGHT'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_' . $vendors_id); } if constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_FIRST_OVERNIGHT_' . $vendors_id) == 'true') { $this->types['FIRST_OVERNIGHT'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_' . $vendors_id); } if constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_PRIORITY_OVERNIGHT_' . $vendors_id) == 'true') { $this->types['PRIORITY_OVERNIGHT'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_' . $vendors_id); } if constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_2DAY_' . $vendors_id) == 'true') { $this->types['FEDEX_2_DAY'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_' . $vendors_id); } // 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 ((constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_GROUND_' . $vendors_id) == 'true' && $order->delivery['country']['id'] == STORE_COUNTRY) || (constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_GROUND_' . $vendors_id) == 'true') && ($order->delivery['country']['id'] != STORE_COUNTRY) && (constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_GROUND_' . $vendors_id) == 'true')) { $this->types['FEDEX_GROUND'] = array('icon' => '', 'handling_fee' => ($order->delivery['country']['id'] == STORE_COUNTRY ? constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_HANDLING_FEE_' . $vendors_id : constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_HANDLING_FEE_' . $vendors_id)); $this->types['GROUND_HOME_DELIVERY'] = array('icon' => '', 'handling_fee' => ($order->delivery['country']['id'] == STORE_COUNTRY ? constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_HOME_DELIVERY_HANDLING_FEE_' . $vendors_id : constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_HANDLING_FEE_' . $vendors_id)); } if (constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_GROUND_' . $vendors_id) == 'true') { $this->types['INTERNATIONAL_GROUND'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_HANDLING_FEE_' . $vendors_id); } if (constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_SAVER_' . $vendors_id) == 'true') { $this->types['FEDEX_EXPRESS_SAVER'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_' . $vendors_id); } if (constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_FREIGHT_' . $vendors_id) == 'true') { $this->types['FEDEX_FREIGHT'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_' . $vendors_id); $this->types['FEDEX_NATIONAL_FREIGHT'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_' . $vendors_id); $this->types['FEDEX_1_DAY_FREIGHT'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_' . $vendors_id); $this->types['FEDEX_2_DAY_FREIGHT'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_' . $vendors_id); $this->types['FEDEX_3_DAY_FREIGHT'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_' . $vendors_id); $this->types['INTERNATIONAL_ECONOMY_FREIGHT'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE_' . $vendors_id); $this->types['INTERNATIONAL_PRIORITY_FREIGHT'] = array('icon' => '', 'handling_fee' => constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE_' . $vendors_id); } // $this->types[] = 'SMART_POST'; // customer details $street_address = $order->delivery['street_address']; $street_address2 = $order->delivery['suburb']; $city = $order->delivery['city']; $state = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], ''); if ($state == "QC") $state = "PQ"; $postcode = str_replace(array(' ', '-'), '', $order->delivery['postcode']); $country_id = $order->delivery['country']['iso_code_2']; $totals = $cart->vendor_shipping[$vendors_id]['subtotal']; $this->_setInsuranceValue($totals / $shipping_num_boxes, $vendors_id); $request['WebAuthenticationDetail'] = array('UserCredential' => array('Key' => $this->fedex_key, 'Password' => $this->fedex_pwd)); $request['ClientDetail'] = array('AccountNumber' => $this->fedex_act_num, 'MeterNumber' => $this->fedex_meter_num); $request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Rate Request v9 using PHP ***'); // $request['RequestedShipment']['SmartPostDetail'] = array( // 'Indicia' => 'MEDIA_MAIL', // 'AncillaryEndorsement' => 'CARRIER_LEAVE_IF_NO_RESPONSE', // 'SpecialServices' => 'USPS_DELIVERY_CONFIRMATION', // 'HubId' => '5254', // 'CustomerManifestId' => 1101); // $request['RequestedShipment']['ServiceType'] = 'SMART_POST'; $request['Version'] = array('ServiceId' => 'crs', 'Major' => '9', 'Intermediate' => '0', 'Minor' => '0'); $request['ReturnTransitAndCommit'] = true; $request['RequestedShipment']['DropoffType'] = $this->_setDropOff(); // valid values REGULAR_PICKUP, REQUEST_COURIER, ... $request['RequestedShipment']['ShipTimestamp'] = date('c'); $request['RequestedShipment']['PackagingType'] = 'YOUR_PACKAGING'; // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ... $request['RequestedShipment']['TotalInsuredValue']=array('Ammount'=> $this->insurance, 'Currency' => $_SESSION['currency']); $request['WebAuthenticationDetail'] = array('UserCredential' => array('Key' => $this->fedex_key, 'Password' => $this->fedex_pwd)); $request['ClientDetail'] = array('AccountNumber' => $this->fedex_act_num, 'MeterNumber' => $this->fedex_meter_num); // print_r($request['WebAuthenticationDetail']); // print_r($request['ClientDetail']); // exit; $request['RequestedShipment']['Shipper'] = array('Address' => array( 'StreetLines' => array constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_1, constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_2), // Origin details '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($street_address, $street_address2), // customer street address 'City' => $city, //customer city // 'StateOrProvinceCode' => $state, //customer state 'PostalCode' => $postcode, //customer postcode 'CountryCode' => $country_id, 'Residential' => ($order->delivery['company'] != '' ? false : true))); //customer county code if (in_array($country_id, array('US', 'CA'))) { $request['RequestedShipment']['Recipient']['StateOrProvinceCode'] = $state; } // print_r($request['RequestedShipment']['Recipient']) ; // exit; $request['RequestedShipment']['ShippingChargesPayment'] = array('PaymentType' => 'SENDER', 'Payor' => array('AccountNumber' => $this->fedex_act_num, // payor's account number '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 (constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_READY_TO_SHIP_' . $vendors_id) == 'true') { $products = $_SESSION['cart']->get_products(); $packages = array('default' => 0); $product_dim_type = 'in'; $new_shipping_num_boxes = 0; foreach ($products as $product) { $dimensions_query = "SELECT products_ready_to_ship, products_ship_sep FROM " . TABLE_PRODUCTS . " WHERE products_id = " . (int)$product['id'] . " LIMIT 1;"; $dimensions = tep_db_query($dimensions_query); if ($product_dimensions = tep_db_fetch_array($dimensions)) { if ($product_dimensions['products_ready_to_ship'] == 1 || $product_dimensions['products_ship_sep'] == 1) { for ($i = 1; $i <= $product['quantity']; $i++) { $packages[] = array('weight' => $product['weight']); } } else { $packages['default'] += $product['weight'] * $product['quantity']; } } } if (count($packages) > 1) { $za_tare_array = preg_split("/[:,]/" , SHIPPING_BOX_WEIGHT); $zc_tare_percent= $za_tare_array[0]; $zc_tare_weight= $za_tare_array[1]; $za_large_array = preg_split("/[:,]/" , SHIPPING_BOX_PADDING); $zc_large_percent= $za_large_array[0]; $zc_large_weight= $za_large_array[1]; } foreach ($packages as $id => $values) { if ($id === 'default') { // divide the weight by the max amount to be shipped (can be done inside loop as this occurance should only ever happen once // note $values is not an array if ($values == 0) continue; $shipping_num_boxes = ceil((float)$values / (float)SHIPPING_MAX_WEIGHT); if ($shipping_num_boxes < 1) $shipping_num_boxes = 1; $shipping_weight = round((float)$values / $shipping_num_boxes, 2); // 2 decimal places max for ($i=0; $i<$shipping_num_boxes; $i++) { $new_shipping_num_boxes++; if (SHIPPING_MAX_WEIGHT <= $shipping_weight) { $shipping_weight = $shipping_weight + ($shipping_weight*($zc_large_percent/100)) + $zc_large_weight; } else { $shipping_weight = $shipping_weight + ($shipping_weight*($zc_tare_percent/100)) + $zc_tare_weight; } if ($shipping_weight <= 0) $shipping_weight = 0.1; $new_shipping_weight += $shipping_weight; $request['RequestedShipment']['RequestedPackageLineItems'][] = array('Weight' => array('Value' => $shipping_weight, 'Units' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_WEIGHT ) ); } } else { // note $values is an array $new_shipping_num_boxes++; if ($values['weight'] <= 0) $values['weight'] = 0.1; $new_shipping_weight += $values['weight']; $request['RequestedShipment']['RequestedPackageLineItems'][] = array('Weight' => array('Value' => $values['weight'], 'Units' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_WEIGHT) ); } } $shipping_num_boxes = $new_shipping_num_boxes; If (!$shipping_num_boxes || $shipping_num_boxes == 0) { $shipping_num_boxes = 1; } $shipping_weight = round($new_shipping_weight / $shipping_num_boxes, 2); } else { // Zen Cart default method for calculating number of packages if ($shipping_weight == 0) $shipping_weight = 0.1; for ($i=0; $i<$shipping_num_boxes; $i++) { $request['RequestedShipment']['RequestedPackageLineItems'][] = array('Weight' => array('Value' => $shipping_weight, 'Units' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_WEIGHT)); } } $request['RequestedShipment']['PackageCount'] = $shipping_num_boxes; if (constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_SATURDAY_' . $vendors_id) == 'true') { $request['RequestedShipment']['ServiceOptionType'] = 'SATURDAY_DELIVERY'; } if (constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_SIGNATURE_OPTION _' . $vendors_id)>= 0 && $totals >= MODULE_SHIPPING_FEDEX_WEB_SERVICES_SIGNATURE_OPTION) { $request['RequestedShipment']['SpecialServicesRequested'] = 'SIGNATURE_OPTION'; } // echo '<!-- shippingWeight: ' . $shipping_weight . ' ' . $shipping_num_boxes . ' -->'; // echo '<!-- '; // echo '<pre>'; // print_r($request); // echo '</pre>'; // echo ' -->'; $response = $client->getRates($request); // echo '<!-- '; // echo '<pre>'; // print_r($response); // echo '</pre>'; // echo ' -->'; if ($response->HighestSeverity != 'FAILURE' && $response->HighestSeverity != 'ERROR' && is_array($response->RateReplyDetails) || is_object($response->RateReplyDetails)) { if (is_object($response->RateReplyDetails)) { $response->RateReplyDetails = get_object_vars($response->RateReplyDetails); } // echo '<pre>'; // print_r($response->RateReplyDetails); // echo '</pre>'; $show_box_weight = " (Total items: " . $shipping_num_boxes . ' pcs. Total weight: '.number_format($shipping_weight * $shipping_num_boxes,2).' '.strtolower(MODULE_SHIPPING_FEDEX_WEB_SERVICES_WEIGHT).'s.)'; $this->quotes = array('id' => $this->code, 'module' => $this->title . $show_box_weight, 'info' => $this->info()); // echo '<pre>'; // print_r($response->RateReplyDetails); // echo '</pre>'; // EXIT(); $methods = array(); // echo '<pre>'; // print_r($this->types); // echo '</pre>'; foreach ($response->RateReplyDetails as $rateReply) { if (array_key_exists($rateReply->ServiceType, $this->types) && ($method == '' || str_replace('_', '', $rateReply->ServiceType) == $method)) { if (constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_RATES_' . $vendors_id)=='LIST') { foreach($rateReply->RatedShipmentDetails as $ShipmentRateDetail) { if($ShipmentRateDetail->ShipmentRateDetail->RateType=='PAYOR_LIST_PACKAGE') { $cost = $ShipmentRateDetail->ShipmentRateDetail->TotalNetCharge->Amount; $cost = (float)round(preg_replace('/[^0-9.]/', '', $cost), 2); } } } else { $cost = $rateReply->RatedShipmentDetails[0]->ShipmentRateDetail->TotalNetCharge->Amount; $cost = (float)round(preg_replace('/[^0-9.]/', '', $cost), 2); } if (in_array($rateReply->ServiceType, array('GROUND_HOME_DELIVERY', 'FEDEX_GROUND', 'INTERNATIONAL_GROUND'))) { // print_r($rateReply); $transitTime = ' (' . str_replace(array('_', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteeen'), array(' ', 1,2,3,4,5,6,7,8,9,10,11,12,13,14), strtolower($rateReply->TransitTime)) . ')'; } $methods[] = array('id' => str_replace('_', '', $rateReply->ServiceType), 'title' => ucwords(strtolower(str_replace('_', ' ', $rateReply->ServiceType))) . $transitTime, 'cost' => $cost + (strpos($this->types[$rateReply->ServiceType]['handling_fee'], '%') ? ($cost * (float)$this->types[$rateReply->ServiceType]['handling_fee'] / 100) : (float)$this->types[$rateReply->ServiceType]['handling_fee'])); } } // usort($methods, 'cmp'); $this->quotes['methods'] = $methods; if ($this->tax_class($vendors_id) > 0) { $this->quotes['tax'] = tep_get_tax_rate($this->tax_class($vendors_id), $order->delivery['country']['id'], $order->delivery['zone_id']); } } else { $message = 'Error in processing transaction.<br /><br />'; foreach ($response -> Notifications as $notification) { if(is_array($response -> Notifications)) { $message .= $notification->Severity; $message .= ': '; $message .= $notification->Message . '<br />'; } else { $message .= $notification->Message . '<br />'; } } $vendors_data_query = tep_db_query("select handling_charge, handling_per_box, vendor_country, vendors_zipcode from " . TABLE_VENDORS . " where vendors_id = '" . (int)$vendors_id . "'" ); $vendors_data = tep_db_fetch_array($vendors_data_query); $country_name = tep_get_countries($vendors_data['vendor_country'], true); if (isset($vendors_data['vendor_country']) && $vendors_data['vendor_country'] != '') { $countries_array = tep_get_countries($vendors_data['vendor_country'], true); $this->country = $countries_array['countries_iso_code_2']; } else { $countries_array = tep_get_countries(SHIPPING_ORIGIN_COUNTRY, true); $this->country = STORE_ORIGIN_COUNTRY; } // $vendors_data = tep_db_fetch_array($vendors_data_query); $handling_charge = $vendors_data['handling_charge']; $handling_per_box = $vendors_data['handling_per_box']; if ($handling_charge > $handling_per_box * $shipping_num_boxes) { $handling = $handling_charge; } else { $handling = $handling_per_box * $shipping_num_boxes; } $this->quotes = array('module' => $this->title, 'error' => $message); } // po box hack by JD if (eregi("^P(.+)O(.+)BOX",$order->delivery['street_address']) ||eregi("^PO BOX",$order->delivery['street_address']) || eregi("^P(.+)O(.+)BOX",$order->delivery['suburb']) || eregi("^[A-Z]PO",$order->delivery['street_address']) || eregi("^[A-Z]PO",$order->delivery['suburb'])) { $this->quotes = array('module' => $this->title, 'error' => '<font size=+2 color=red><b>Federal Express cannot ship to Post Office Boxes.<b></font><br>Use the Change Address button above to use a FedEx accepted street address.'); } // end po box hack by JD if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title); // echo '<!-- Quotes: '; // print_r($this->quotes); // print_r($_SESSION['shipping']); // echo ' -->'; return $this->quotes; } function cmp($a, $b, $vendors_id) { if ($a['cost'] == $b['cost']) { return 0; } return ($a['cost'] < $b['cost']) ? -1 : 1; } // method added for expanded info in FEAC function info($vendors_id) { return MODULE_SHIPPING_FEDEX_WEB_SERVICES_INFO; // add a description here or leave blank to disable } function _setInsuranceValue($order_amount, $vendors_id = '1') { } if ($order_amount > constant('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INSURE_' . $vendors_id)) { $this->insurance = sprintf("%01.2f", $order_amount); } else { $this->insurance = 0; } } function objectToArray($object, $vendors_id) { if( !is_object( $object ) && !is_array( $object ) ) { return $object; } if( is_object( $object ) ) { $object = get_object_vars( $object ); } return array_map( 'objectToArray', $object ); } function _setDropOff($vendors_id) { switch(MODULE_SHIPPING_FEDEX_WEB_SERVICES_DROPOFF) { case '1': return 'REGULAR_PICKUP'; break; case '2': return 'REQUEST_COURIER'; break; case '3': return 'DROP_BOX'; break; case '4': return 'BUSINESS_SERVICE_CENTER'; break; case '5': return 'STATION'; break; } } //MVS function check($vendors_id='1') { if (!isset($this->_check)) { //multi vendor add "vendors_id = '". $vendors_id ."' and" $check_query = tep_db_query("select configuration_value from " . TABLE_VENDOR_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATUS_" . $vendors_id . "' and vendors_id = '" . $vendors_id . "'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } function install($vendors_id='1') { tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) VALUES ('Enable FedEx Web Services','MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATUS_" . $vendors_id . "', 'True', 'Do you want to offer Fedex shipping?', '6', '10', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('FedEx Web Services Key', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_KEY_" . $vendors_id . "', '', 'Enter FedEx Web Services Key', '6', '3', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('FedEx Web Services Password', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_PWD_" . $vendors_id . "', '', 'Enter FedEx Web Services Password', '6', '3', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('FedEx Account Number', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ACT_NUM_" . $vendors_id . "', '', 'Enter FedEx Account Number', '6', '3', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('FedEx Meter Number', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_METER_NUM_" . $vendors_id . "', '', 'Enter FedEx Meter Number', '6', '4', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Weight Units', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_WEIGHT_" . $vendors_id . "', 'LB', 'Weight Units:', '6', '10', 'tep_cfg_select_option(array(\'LB\', \'KG\'), ', now())"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('First line of street address', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_1_" . $vendors_id . "', '', 'Enter the first line of your ship-from street address, required', '6', '20', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Second line of street address', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_2_" . $vendors_id . "', '', 'Enter the second line of your ship-from street address, leave blank if you do not need to specify a second line', '6', '21', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('City name', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_CITY_" . $vendors_id . "', '', 'Enter the city name for the ship-from street address, required', '6', '22', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('State or Province name', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATE_" . $vendors_id . "', '', 'Enter the 2 letter state or province name for the ship-from street address, required for Canada and US', '6', '23', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Postal code', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_POSTAL_" . $vendors_id . "', '', 'Enter the postal code for the ship-from street address, required', '6', '24', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Phone number', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_PHONE_" . $vendors_id . "', '', 'Enter a contact phone number for your company, required', '6', '25', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Drop off type', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_DROPOFF_" . $vendors_id . "', '1', 'Dropoff type (1 = Regular pickup, 2 = request courier, 3 = drop box, 4 = drop at BSC, 5 = drop at station)?', '6', '30', 'tep_cfg_select_option(array(\'1\',\'2\',\'3\',\'4\',\'5\'),', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable Express Saver', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_SAVER_" . $vendors_id . "', 'true', 'Enable FedEx Express Saver', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable Standard Overnight', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_STANDARD_OVERNIGHT_" . $vendors_id . "', 'true', 'Enable FedEx Express Standard Overnight', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable First Overnight', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_FIRST_OVERNIGHT_" . $vendors_id . "', 'true', 'Enable FedEx Express First Overnight', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable Priority Overnight', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_PRIORITY_OVERNIGHT_" . $vendors_id . "', 'true', 'Enable FedEx Express Priority Overnight', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable 2 Day', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_2DAY_" . $vendors_id . "', 'true', 'Enable FedEx Express 2 Day', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), '" . $vendors_id . "')"); tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Insurance?', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INSURE_" . $vendors_id . "', 'NONE', 'Insure packages over what dollar amount?', '6', '22', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable International Priority', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_PRIORITY_" . $vendors_id . "', 'true', 'Enable FedEx Express International Priority', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable International Economy', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_ECONOMY_" . $vendors_id . "', 'true', 'Enable FedEx Express International Economy', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable Ground', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_GROUND_" . $vendors_id . "', 'true', 'Enable FedEx Ground', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable International Ground', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_GROUND_" . $vendors_id . "', 'true', 'Enable FedEx International Ground', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable Freight', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_FREIGHT_" . $vendors_id . "', 'true', 'Enable FedEx Freight', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable Saturday Delivery', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SATURDAY_" . $vendors_id . "', 'false', 'Enable Saturday Delivery', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Domestic Ground Handling Fee', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_HANDLING_FEE_" . $vendors_id . "', '', 'Add a domestic handling fee or leave blank (example: 15 or 15%)', '6', '25', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Home Delivery Handling Fee', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_HOME_DELIVERY_HANDLING_FEE_" . $vendors_id . "', '', 'Add a home delivery handling fee or leave blank (example: 15 or 15%)', '6', '25', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Domestic Express Handling Fee', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_" . $vendors_id . "', '', 'Add a domestic handling fee or leave blank (example: 15 or 15%)', '6', '25', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('International Ground Handling Fee', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_HANDLING_FEE_" . $vendors_id . "', '', 'Add an international handling fee or leave blank (example: 15 or 15%)', '6', '25', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('International Express Handling Fee', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE_" . $vendors_id . "', '', 'Add an international handling fee or leave blank (example: 15 or 15%)', '6', '25', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) VALUES ('FedEx Rates','MODULE_SHIPPING_FEDEX_WEB_SERVICES_RATES_" . $vendors_id . "','LIST','FedEx Rates','6','0','tep_cfg_select_option(array(\'LIST\',\'ACCOUNT\'),',now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Signature Option', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SIGNATURE_OPTION_" . $vendors_id . "', '-1', 'Require a signature on orders greater than or equal to (set to -1 to disable):', '6', '25', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id) values ('Enable Ready to Ship', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_READY_TO_SHIP_" . $vendors_id . "', 'false', 'Enable products_ship_sep or products_ready_to_ship field (required to identify products which ship separately', '6', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added, vendors_id) values ('Shipping Zone', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ZONE_" . $vendors_id . "', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '98', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added, vendors_id) values ('Tax Class', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_TAX_CLASS_" . $vendors_id . "', '0', 'Use the following tax class on the shipping fee.', '6', '25', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now(), '" . $vendors_id . "')"); tep_db_query ("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Sort Order', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SORT_ORDER_" . $vendors_id . "', '0', 'Sort order of display.', '6', '99', now(), '" . $vendors_id . "')"); } function remove($vendors_id) { tep_db_query("delete from " . TABLE_VENDOR_CONFIGURATION . " where vendors_id = '". $vendors_id ."' and configuration_key in ('" . implode("', '", $this->keys($vendors_id)) . "')"); } function keys($vendors_id) { return array('MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATUS_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_KEY_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_PWD_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ACT_NUM_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_METER_NUM_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_WEIGHT_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_1_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_2_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_CITY_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATE_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_POSTAL_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_PHONE_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_DROPOFF_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_SAVER_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_STANDARD_OVERNIGHT_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_FIRST_OVERNIGHT_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_PRIORITY_OVERNIGHT_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_2DAY_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_PRIORITY_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_ECONOMY_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_GROUND_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_FREIGHT_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_GROUND_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SATURDAY_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_TAX_CLASS_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_HANDLING_FEE_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_HOME_DELIVERY_HANDLING_FEE_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_HANDLING_FEE_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INSURE_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_RATES_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SIGNATURE_OPTION_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_READY_TO_SHIP_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ZONE_' . $vendors_id, 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SORT_ORDER_' . $vendors_id); } function get_countries($countries_id = '', $vendors_id, $with_iso_codes = false) { $countries_array = array(); if (tep_not_null($countries_id)) { if ($with_iso_codes == true) { $countries = tep_db_query("select countries_name, countries_iso_code_2, countries_iso_code_3 from " . TABLE_COUNTRIES . " where countries_id = '" . (int)$countries_id . "' order by countries_name"); $countries_values = tep_db_fetch_array($countries); $countries_array = array('countries_name' => $countries_values['countries_name'], 'countries_iso_code_2' => $countries_values['countries_iso_code_2'], 'countries_iso_code_3' => $countries_values['countries_iso_code_3']); } else { $countries = tep_db_query("select countries_name from " . TABLE_COUNTRIES . " where countries_id = '" . (int)$countries_id . "'"); $countries_values = tep_db_fetch_array($countries); $countries_array = array('countries_name' => $countries_values['countries_name']); } } else { $countries = tep_db_query("select countries_id, countries_name from " . TABLE_COUNTRIES . " order by countries_name"); while ($countries_values = tep_db_fetch_array($countries)) { $countries_array[] = array('countries_id' => $countries_values['countries_id'], 'countries_name' => $countries_values['countries_name']); } } return $countries_array; } } Any help most appreciated
  16. lyonsperf

    Multi_Vendor_Shipping new thread

    Hi Jim, I followed the directions in the module text to port the new FEDEX webservices for MVS. I got the module file done but ran into an issue in the admin. I get an error Fatal error: Call to undefined method fedexwebservices::zones() in /home/xxxx/public_html/admin/vendor_modules.php on line 144 I searched and compared the new module shipping file to the old fedex file and cannot find the error. Can I comment out the zone coding since I don't use it?
  17. lyonsperf

    Google XML Sitemap SEO

    Hi Jack, I received notice from google that they plan to change the way product feeds are handled via upload files starting July 1. Have you had a chance to look into this? I believe they are moving away from the free product feed for the merchant center and are now focusing on adwords for submission to their shopping section. Will there be an update for this mod and the google product feed mod? If you need a copy of the email, I can post it here. Thanks, Matt
  18. lyonsperf

    Social Login Add On for v2.3

    Just to let everyone know. I installed this in my 2.2rc2 site and it caused massive issues with google. It made the site throw a 301 error for all the links on the page and I could not get the HTML validator tool to recognize the site.
  19. lyonsperf

    USPS Rates not working?

    Did you upgrade to the latest USPS version? The parse error means there is a typo in the modules.php file. Use a compare program to check your file against a known good file.
  20. lyonsperf

    USPS Rate V4, Intl Rate V2 (official support thread)

    I have it running on my rc 2.2 shop. But I also have the MVS mod. I suggest downloading the MVS mod and then compare each file using winmerge or beyond compare to sort out the changes. Just ignore anything that has vendor in it.
  21. lyonsperf

    USPS Rate V4, Intl Rate V2 (official support thread)

    Do not change your checkout_shipping.php file in 2.2. Make the required changes to usps.php in the includes/modules/shipping folder. Also add the changes to includes/application.top. If you follow the readme manual instructions, do everything except the checkout_shipping changes. Also make sure you remove the module in admin BEFORE changing the rest of the files. You also need to edit your locaton in the change in application_top. The new api only uses your user name. The password has been discarded.
  22. lyonsperf

    Multi_Vendor_Shipping new thread

    Thanks to the generous help from Cylone99, we have compiled the required files to get MVS to work with the new USPS api. This is for RC2.2 only. It can be found here:http://addons.oscommerce.com/info/4129
  23. lyonsperf

    USPS Rate V4, Intl Rate V2 (official support thread)

    I am having the same issue as rwest. I have everything installed and working on the admin side, but the USPS pricing does not show up in checkout_shipping.php. I am running rc2.2.
  24. lyonsperf

    Multi_Vendor_Shipping new thread

    OK. I ported the MVS files for the USPS new version using the files from USPS Methods. I haven't had time to test it as I don't have a test site. Anyone interested in trying it on a 2.2 system pm me and I will send you the zip.
  25. lyonsperf

    Header Tags SEO

    Jack, I stand corrected. When I downloaded the latest version it blended it with previous versions I had saved on my drive. Sorry for any confusion.
×