Jump to content

lyonsperf

Members
  • Content count

    341
  • Joined

  • Last visited

Everything posted by lyonsperf

  1. 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.
  2. lyonsperf

    Article Manager v1.0

    Nope, that caused a T_FUNCTION error.
  3. 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
  4. lyonsperf

    Multi_Vendor_Shipping new thread

    Still haven't figured this out. Anyone get it to work?
  5. 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
  6. 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.
  7. 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; } ?>
  8. 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
  9. 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?
  10. 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
  11. 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.
  12. 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.
  13. 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.
  14. 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.
  15. 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
  16. 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.
  17. 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.
  18. 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.
  19. lyonsperf

    Header Tags SEO

    Jack, I am running into confusion over the files in this mod. In the folder catalog_for_new_shop_only_RC2 there is a different coded includes/function/header_tags.php than the one in the catalog/includes/functions folder. If I am updating from version 3.26 rc2 which files should be replaced? Also is there a write up on what the extra field boxes in admin/categories.php do?
  20. lyonsperf

    Header Tags SEO

    Hi Jack, I upgraded and now have this shown on each category page. Fatal error : Call to undefined function stripsid() in /home/lyons/public_html/includes/modules/header_tags_social_bookmarks.php on line 20 I went through the entire install and compared files but cannot get this error to correct.
  21. lyonsperf

    Header Tags SEO

    Once again Obiwan, you are correct. I merged the files located in the rc2 folder, but didn't check the catalog folder for updated files. That file was updated in the catalog folder but not rc2.
  22. lyonsperf

    Header Tags SEO

    Hi Jack, Updating my site with the new version and I get this error at the bottom of the admin/categories page Fatal error: Call to undefined function tep_get_products_head_listing_text() in /home/xxxxxxxx/public_html/xxxxx/categories.php on line 1064 I double checked the install and all seems to be correct. I have rc2.2
  23. lyonsperf

    Multi_Vendor_Shipping new thread

    Is anyone working on porting the current Usps module to work with the new version? I tried to mod it, but I am not a coder. Here is what I have so far. <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2010 osCommerce Released under the GNU General Public License */ class usps { var $code, $title, $description, $icon, $enabled, $countries; function usps() { global $order; $this->code = 'usps'; $this->title = MODULE_SHIPPING_USPS_TEXT_TITLE; $this->description = MODULE_SHIPPING_USPS_TEXT_DESCRIPTION; $this->icon = DIR_WS_ICONS . 'shipping_usps.gif'; $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 = @ constant('MODULE_SHIPPING_USPS_SORT_ORDER_' . $vendors_id); if (isset ($sort_order)) { $this->sort_order = $sort_order; } else { $this->sort_order = '0'; } return $this->sort_order; } function tax_class($vendors_id = '1') { $this->tax_class = constant('MODULE_SHIPPING_USPS_TAX_CLASS_' . $vendors_id); return $this->tax_class; } function enabled($vendors_id = '1') { $this->enabled = false; $status = @ constant('MODULE_SHIPPING_USPS_STATUS_' . $vendors_id); if (isset ($status) && $status != '') { $this->enabled = (($status == 'True') ? true : false); } if (($this->enabled == true) && ((int) constant('MODULE_SHIPPING_USPS_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_USPS_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 zones($vendors_id = '1') { if (($this->enabled == true) && ((int) constant('MODULE_SHIPPING_USPS_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_USPS_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 } //while if ($check_flag == false) { $this->enabled = false; } //if } //if return $this->enabled; } //function // EOADD MVS // class methods // Changed MVS // function quote($method = '') { function quote($method = '', $module = '', $vendors_id = '1') { // EOCHANGE global $order, $shipping_weight, $shipping_num_boxes; $shipping_weight = ($shipping_weight < 0.0625 ? 0.0625 : $shipping_weight); $this->pounds = (int)$shipping_weight; $this->ounces = ceil(round(16 * ($shipping_weight - $shipping_pounds))); $uspsQuote = $this->_getQuote($vendors_id); if (isset($uspsQuote['error']) || !is_array($uspsQuote)) $this->quotes = array( 'module' => $this->title, 'error' => $uspsQuote['error']); else { // Added MVS $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); $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; } // EOADD MVS $size = sizeof($uspsQuote); for ($i=0; $i<$size; $i++) { list($type, $cost) = each($uspsQuote[$i]); if (($method == '' && in_array($type, explode(', ', MODULE_SHIPPING_USPS_TYPES_ . $vendors_id))) || $method == $type) $methods[] = array( 'id' => $type, 'title' => str_replace(array('RM', 'TM'), array('®', '™'), $type), 'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING_) * $shipping_num_boxes); } $this->quotes = array( 'id' => $this->code, 'module' => $this->short_title . ' ' . $this->pounds . ' lbs, ' . $this->ounces . ' oz', 'methods' => $methods, 'tax' => $this->tax_class > 0 ? tep_get_tax_rate($this->tax_class($vendors_id), $order->delivery['country']['id'], $order->delivery['zone_id']) : null, 'icon' => tep_not_null($this->icon) ? tep_image($this->icon, $this->title) : null); } return $this->quotes; } function _getQuote($vendors_id) { // MVS Added $vendors_data_query = tep_db_query("select vendor_country, vendors_zipcode from " . TABLE_VENDORS . " where vendors_id = '" . (int) $vendors_id . "'"); $vendors_data = tep_db_fetch_array($vendors_data_query); // MVS End global $order; if ($order->delivery['country']['iso_code_2'] == 'US') $vendors_data['vendor_country']) { $dest_zip = substr(str_replace(' ', '', $order->delivery['postcode']), 0, 5); $request = '<RateV4Request USERID="' . MODULE_SHIPPING_USPS_USERID_ . $vendors_id '">' . '<Package ID="0">' . '<Service>ALL</Service>' . '<ZipOrigination>' . SHIPPING_ORIGIN_ZIP_ . '</ZipOrigination>' . '<ZipDestination>' . $dest_zip . '</ZipDestination>' . '<Pounds>' . $this->pounds . '</Pounds>' . '<Ounces>' . $this->ounces . '</Ounces>' . '<Container/>' . '<Size>REGULAR</Size>' . '<Machinable>TRUE</Machinable>' . '</Package>' . '</RateV4Request>'; $request = 'API=RateV4&XML=' . urlencode($request); } else { $request = '<IntlRateV2Request USERID="' . MODULE_SHIPPING_USPS_USERID_ . $vendors_id '">' . '<Revision>2</Revision>' . '<Package ID="0">' . '<Pounds>' . $this->pounds . '</Pounds>' . '<Ounces>' . $this->ounces . '</Ounces>' . '<Machinable>True</Machinable>' . '<MailType>All</MailType>' . '<GXG>' . '<POBoxFlag>N</POBoxFlag>' . '<GiftFlag>N</GiftFlag>' . '</GXG>' . '<ValueOfContents>' . ($order->info['subtotal'] + $order->info['tax']) . '</ValueOfContents>' . '<Country>' . tep_get_country_name($order->delivery['country']['id']) . '</Country>' . '<Container>RECTANGULAR</Container>' . '<Size>REGULAR</Size>' . '<Width>12</Width>' . '<Length>12</Length>' . '<Height>12</Height>' . '<Girth>0</Girth>' . '<OriginZip>' . SHIPPING_ORIGIN_ZIP . '</OriginZip>' . '<CommercialFlag>Y</CommercialFlag>' . '</Package>' . '</IntlRateV2Request>'; $request = 'API=IntlRateV2&XML=' . urlencode($request); } $body = ''; $http = new httpClient(); if ($http->Connect('production.shippingapis.com', 80)) { $http->addHeader('Host', 'production.shippingapis.com'); $http->addHeader('User-Agent', 'osCommerce'); $http->addHeader('Connection', 'Close'); if ($http->Get('/shippingapi.dll?' . $request)) $body = preg_replace(array('/\<sup\>\&reg;\<\/sup\>/', '/\<sup\>\&trade;\<\/sup\>/', '/\" /', '/\",/', '/\"<br>/', '/<br>/'), array('RM', 'TM', '",', '" ', '"<br>', 'BREAK'), htmlspecialchars_decode($http->getBody())); $http->Disconnect(); $uspsResponse = simplexml_load_string($body); if (isset($uspsResponse->Number)) return array('error' => $uspsResponse->Number . ' - ' . $uspsResponse->Description); } else return false; if ($order->delivery['country']['iso_code_2'] == 'US') { $rates = array(); $size = sizeof($uspsResponse->Package->Postage); for ($i=0, $n=$size; $i<$n; $i++) { $MailService = (string)$uspsResponse->Package->Postage->$i->MailService; $Rate = (string)$uspsResponse->Package->Postage->$i->Rate; $rates[] = array($MailService => $Rate); } } else { $rates = array(); $size = sizeof($uspsResponse->Package->Service); for ($i=0, $n=$size; $i<$n; $i++) { $SvcDescription = (string)$uspsResponse->Package->Service[$i]->SvcDescription; $Postage = (string)$uspsResponse->Package->Service[$i]->Postage; $rates[] = array($SvcDescription => $Postage); } } return ((sizeof($rates) > 0) ? $rates : false); } // MVS Added/Changed function install($vendors_id = '1') { tep_db_query("ALTER TABLE `configuration` CHANGE `configuration_value` `configuration_value` TEXT NOT NULL, CHANGE `set_function` `set_function` TEXT NULL DEFAULT NULL"); tep_db_query("update " . TABLE_VENDOR_CONFIGURATION . " SET configuration_value = 'true' where configuration_key = 'EMAIL_USE_HTML'"); 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 USPS Shipping', 'MODULE_SHIPPING_USPS_STATUS_' . $vendors_id . "', 'True', 'Do you want to offer USPS shipping?', '6', '0','tep_cfg_select_option(array(\'True\', \'False\'), ', 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 ('Enter the USPS User ID', 'MODULE_SHIPPING_USPS_USERID_'. $vendors_id . "', 'NONE', 'Enter the USPS USERID assigned to you.', '6', '0', 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_USPS_TAX_CLASS_'. $vendors_id . "', '0', 'Use the following tax class on the shipping fee.', '6', '0', '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, use_function, set_function, date_added, vendors_id) values ('Shipping Zone', 'MODULE_SHIPPING_USPS_ZONE_'. $vendors_id . "', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', '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, date_added, vendors_id) values ('Sort Order', 'MODULE_SHIPPING_USPS_SORT_ORDER_'. $vendors_id . "', '0', 'Sort order of display.', '6', '0', 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 ('Domestic Shipping Methods', 'MODULE_SHIPPING_USPS_TYPES_'. $vendors_id , '', 'Select the services to be offered:', '6', '4', 'tep_cfg_select_multioption(array(\'First-Class MailRM Large Envelope\', \'First-Class MailRM Parcel\', \'Media MailRM\', \'Parcel PostRM\', \'Priority MailRM\', \'Priority MailRM Flat Rate Envelope\', \'Priority MailRM Legal Flat Rate Envelope\', \'Priority MailRM Padded Flat Rate Envelope\', \'Priority MailRM Small Flat Rate Box\', \'Priority MailRM Medium Flat Rate Box\', \'Priority MailRM Large Flat Rate Box\', \'Priority MailRM Regional Rate Box A\', \'Priority MailRM Regional Rate Box B\', \'Priority MailRM Regional Rate Box C\', \'Express MailRM\', \'Express MailRM Flat Rate Envelope\', \'Express MailRM Legal Flat Rate Envelope\', \'Express MailRM Flat Rate Boxes\', \'First-Class MailRM International Large Envelope\', \'First-Class MailRM International Parcel\', \'Priority MailRM International\', \'Priority MailRM International Flat Rate Envelope\', \'Priority MailRM International Small Flat Rate Box\', \'Priority MailRM International Medium Flat Rate Box\', \'Priority MailRM International Large Flat Rate Box\', \'Express MailRM International\', \'Express MailRM International Flat Rate Envelope\', \'Express MailRM International Legal Flat Rate Envelope\', \'Express MailRM International Flat Rate Boxes\', \'USPS GXGTM Envelopes\', \'Global Express GuaranteedRM (GXG)\'), ', 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 ('Handling Fee', 'MODULE_SHIPPING_USPS_HANDLING_'. $vendors_id . "', 'Handling fee for this shipping method.', '6', '0', now(), '" . $vendors_id . "')"); } // MVS Added/Changed function keys($vendors_id) { // BOF: UPS USPS return array ( 'MODULE_SHIPPING_USPS_STATUS_' . $vendors_id, 'MODULE_SHIPPING_USPS_USERID_' . $vendors_id, 'MODULE_SHIPPING_USPS_PASSWORD_' . $vendors_id, 'MODULE_SHIPPING_USPS_SERVER_' . $vendors_id, 'MODULE_SHIPPING_USPS_HANDLING_' . $vendors_id, 'MODULE_SHIPPING_USPS_TAX_CLASS_' . $vendors_id, 'MODULE_SHIPPING_USPS_ZONE_' . $vendors_id, 'MODULE_SHIPPING_USPS_SORT_ORDER_' . $vendors_id, 'MODULE_SHIPPING_USPS_OPTIONS_' . $vendors_id, 'MODULE_SHIPPING_USPS_TYPES_' . $vendors_id, 'MODULE_SHIPPING_USPS_TYPES_INTL_' . $vendors_id ); // EOF: UPS USPS } // EOADD MVS // MVS Added/Changed /* function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } */ 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)) . "')"); } // EOADD // MVS Added/Changed // function check() { function check($vendors_id = '1') { //EOMVS if (!isset ($this->_check)) { // MVS Added/Changed $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_USPS_STATUS'"); $check_query = tep_db_query("select configuration_value from " . TABLE_VENDOR_CONFIGURATION . " where vendors_id = '" . $vendors_id . "' and configuration_key = 'MODULE_SHIPPING_USPS_STATUS_" . $vendors_id . "'"); // EOMVS $this->_check = tep_db_num_rows($check_query); } return $this->_check; } } ?>
  24. lyonsperf

    USPS METHODS NOT WORKING?

    Got this today: Web Tools integrator; On January 22, 2012, USPS will update domestic shipping services and international pricing and product features. For detailed information on prices and new product features, please reference the Federal Register Notices viewable at http://pe.usps.com/. Price Change updates will be available in the Web Tools testing environment for integrator access on or around January 6, 2012. The test environment can be accessed, using your production UserID, via the following URL scheme, host and path: Secure APIs: https://stg-secure.shippingapis.com/ShippingApi.dll Non-secure APIs: http://stg-production.shippingapis.com/ShippingApi.dll Please note that the changes below are intended to be backwards compatible, however, may not be depending on how individual programs are integrated with the APIs. Web Tools APIs will be affected in the following manner: · All Web Tools APIs with postage prices incorporated will be updated to reflect the price changes; · Domestic Rate Calculator API Changes: o New <Container> request enumerations added to RateV4 to support the USPS product offerings and prices listed in the Federal Register Notice:§ FLAT RATE BOX (Express Mail Flat Rate Box),§ REGIONALRATEBOXC (Priority Mail Regional Rate Box C);o New <FirstClassMailType> request enumeration added to RateV4:§ PACKAGE SERVICE;o Optional <ReturnServiceInfo> tag added to RateV4 to return “Loss Guarantee Only” commitment information when an Express Mail Commitment is requested to certain destinationso First-Class Mail Package <MailService> response values updated in RateV3 and RateV4 as follows:§ Postage CLASSID="0" - Retail Pricing<MailService>First-Class Mail® Package</MailService> will become:<MailService>First-Class Mail® Parcel</MailService>,§ Postage CLASSID="61" - Commercial Pricing<MailService>First-Class Mail® Package</MailService> will become:<MailService>First-Class Mail® Package Service</MailService>;o New response nodes in RateV3 and RateV4 to support the USPS product offerings and prices listed in the Federal Register Notice (Express Mail Flat Rate Box and Priority Mail Regional Rate Box C, specifically);o Rate and RateV2 responses will be modified to:§ Return trademarked product names,§ Enforce dimensional requirements through error messaging for large, oversize and S-restricted destinations. · All Rate Calculator API integrators are encouraged to migrate to the latest API versions (RateV4, IntlRateV2): o Rate and RateV2 versions of the domestic Rate Calculator will be retired on March 31, 2012, requiring all integrators to migrate to the latest versions; · International Rate Calculator API: o New response nodes in IntlRate and IntlRateV2 to support the USPS product offerings and prices listed in the Federal Register Notice (Express Mail Flat Rate Box, specifically); · Express Mail Label and Hold For Pickup Express APIs: o New <Container> request data tags to support the Express Mail Flat Rate Box;§ FLAT RATE BOX · Delivery Confirmation and Signature Confirmation APIs: o New <Container> request data tags to support the Priority Mail Regional Rate Box C;§ REGIONALRATEBOXC · Express Mail International API: o New <Container> request data tags to support the Express Mail Flat Rate Box:§ FLATRATEBOX. Please contact the USPS Internet Customer Care Center with any questions or concerns at 1-800-344-7779 or uspstechsupport@esecurecare.net. - Web Tools Program Office
×