Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

FedEx - Web Services v9


greasemonkey

Recommended Posts

@Irin

I've modified my file a lot, but you can try my change below.  I used to receive notice level errors, but never a failure error on this, so you may have something else wrong causing a problem that just shows up here.  Find starting around line 302

      foreach ($response->RateReplyDetails as $rateReply)
      {
        if (array_key_exists($rateReply->ServiceType, $this->types) && ($method == '' || str_replace('_', '', $rateReply->ServiceType) == $method))
        {
          if(MODULE_SHIPPING_FEDEX_WEB_SERVICES_RATES=='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']));
        }
      }

and change it to

            foreach ($response->RateReplyDetails as $rateReply) {
                if (in_array($rateReply->ServiceType, $this->types) && ($method == '' || str_replace('_', '', $rateReply->ServiceType) == $method)) {
                    $cost = $rateReply->RatedShipmentDetails[0]->ShipmentRateDetail->TotalNetCharge->Amount;
                    $cost = (float) round(preg_replace('/[^0-9.]/', '', $cost), 2);
                    $methods[] = array('id' => str_replace('_', '', $rateReply->ServiceType),
                            'title' => ucwords(strtolower(str_replace('_', ' ', $rateReply->ServiceType))),
                            'cost' => $cost + $this->handling_fee);
                }
            }

 

I'm not really a dog.

Link to comment
Share on other sites

1 hour ago, John W said:

@Irin

I've modified my file a lot, but you can try my change below.  I used to receive notice level errors, but never a failure error on this, so you may have something else wrong causing a problem that just shows up here.  Find starting around line 302


      foreach ($response->RateReplyDetails as $rateReply)
      {
        if (array_key_exists($rateReply->ServiceType, $this->types) && ($method == '' || str_replace('_', '', $rateReply->ServiceType) == $method))
        {
          if(MODULE_SHIPPING_FEDEX_WEB_SERVICES_RATES=='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']));
        }
      }

and change it to


            foreach ($response->RateReplyDetails as $rateReply) {
                if (in_array($rateReply->ServiceType, $this->types) && ($method == '' || str_replace('_', '', $rateReply->ServiceType) == $method)) {
                    $cost = $rateReply->RatedShipmentDetails[0]->ShipmentRateDetail->TotalNetCharge->Amount;
                    $cost = (float) round(preg_replace('/[^0-9.]/', '', $cost), 2);
                    $methods[] = array('id' => str_replace('_', '', $rateReply->ServiceType),
                            'title' => ucwords(strtolower(str_replace('_', ' ', $rateReply->ServiceType))),
                            'cost' => $cost + $this->handling_fee);
                }
            }

 

With this change, the error is gone but so are the FedEx rates. It's not showing any rates at all.

Link to comment
Share on other sites

You have a problem somewhere else.  I think you're not getting rates returned. Has this worked for you at all?  Are you working on a test server?  If you are working on a test server you can find this line

        $response = $client->getRates($request);

and change it to this

  var_dump($request['RequestedShipment']['RequestedPackageLineItems']);

        $response = $client->getRates($request);

  var_dump($response);

The first var_dump will show what you're sending and the second one will show you what they return.  I have a bunch of those that I experimented with when I was trying to solve a problem.

I'm not really a dog.

Link to comment
Share on other sites

Something has changed if this just stopped working.  Maybe your host upgraded something.  You can see in recent posts a soap error cause by an OpenSSL change.

You can use the var_dump to output what's being returned so you can see it, but the line that it errors on isn't necessarily where the problem is.  You can Google "Cannot use object of type stdClass" and get a lot of info on it as it's a php error.

I'm not really a dog.

Link to comment
Share on other sites

When I run the two test below after getRates I get  true for is_array and false for is_object

  var_dump(is_array($response->RateReplyDetails));
  var_dump(is_object($response->RateReplyDetails));

You can use soem of these to see what's being returned by uncommenting them.  It's best to have a test server.

//  var_dump(property_exists('fedexwebservices','RateReplyDetails'));
//  var_dump(null !== ('RateReplyDetails'));
//  var_dump(!empty($RateReplyDetails));
//  var_dump(isset($response->RateReplyDetails));
//  var_dump(is_array($response->RateReplyDetails));
//  var_dump(is_object($response->RateReplyDetails));
//  var_dump($response);

 

I'm not really a dog.

Link to comment
Share on other sites

3 hours ago, John W said:

When I run the two test below after getRates I get  true for is_array and false for is_object


  var_dump(is_array($response->RateReplyDetails));
  var_dump(is_object($response->RateReplyDetails));

You can use soem of these to see what's being returned by uncommenting them.  It's best to have a test server.


//  var_dump(property_exists('fedexwebservices','RateReplyDetails'));
//  var_dump(null !== ('RateReplyDetails'));
//  var_dump(!empty($RateReplyDetails));
//  var_dump(isset($response->RateReplyDetails));
//  var_dump(is_array($response->RateReplyDetails));
//  var_dump(is_object($response->RateReplyDetails));
//  var_dump($response);

 

The two tests returned the following:

Quote

array(1) { [0]=> array(1) { ["Weight"]=> array(2) { ["Value"]=> float(0.5) ["Units"]=> string(2) "LB" } } } bool(true) bool(false)
Fatal error: Uncaught Error: Cannot use object of type stdClass as array in /public_html/site/includes/modules/shipping/fedexwebservices.php:318 Stack trace: #0 /public_html/site/includes/classes/shipping.php(81): fedexwebservices->quote('') #1 /public_html/site/checkout_shipping.php(185): shipping->quote() #2 {main} thrown in /public_html/site/includes/modules/shipping/fedexwebservices.php on line 318

 

Link to comment
Share on other sites

3 hours ago, John W said:

Something has changed if this just stopped working.  Maybe your host upgraded something.  You can see in recent posts a soap error cause by an OpenSSL change.

You can use the var_dump to output what's being returned so you can see it, but the line that it errors on isn't necessarily where the problem is.  You can Google "Cannot use object of type stdClass" and get a lot of info on it as it's a php error.

I did google a lot about this error, but unfortunately, I couldn't find a solution. That's why I decided to post here in hopes that maybe someone else, smarter than me in php, could help me.

Link to comment
Share on other sites

I changed the rate to List, and the error is gone. I'm getting the fedex rates now. So, the problem is somewhere in the code for the account rates:

else // For ACCOUNT Discounted Rates, calculate the cost as below
          {
            $cost = ($rateReply->RatedShipmentDetails[0]->ShipmentRateDetail->TotalNetCharge->Amount)/MODULE_SHIPPING_FEDEX_WEB_SERVICES_CURRENCY;
            $cost = (float)round(preg_replace('/[^0-9.]/', '',  $cost), 2);
          } // For ACCOUNT Discounted Rates, END

    $transitTime = ''; // 9.4.6
          if (in_array($rateReply->ServiceType, array('GROUND_HOME_DELIVERY', 'FEDEX_GROUND', 'INTERNATIONAL_GROUND'))) {
            $transitTime = ' (' . str_replace(array('_', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteeen'), array(' ', 1,2,3,4,5,6,7,8,9,10,11,12,13,14), strtolower($rateReply->TransitTime)) . ')';
          }

          if (isset($rateReply->DeliveryTimestamp)) {
         // $transitTime = ' (Estimated Delivery on: ' . date('l, F jS Y \a\t g:ia', strtotime($rateReply->DeliveryTimestamp)) . ') ';
          $transitTime = ' (Estimated Delivery Date: ' . date('l, F jS Y', strtotime($rateReply->DeliveryTimestamp)) . ') ';
          }

                           	 $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']));
                      //     }

        }
      }

 

Link to comment
Share on other sites

  • 6 months later...

Irin, this worked for me, i removed the code, and it fixed my OSCMAX checkout - i was getting a blank checkout with PHP 5.4 upgrade from PHP 5.3

using your code works great, no more blank page !!!

 

            foreach ($response->RateReplyDetails as $rateReply) {
                if (in_array($rateReply->ServiceType, $this->types) && ($method == '' || str_replace('_', '', $rateReply->ServiceType) == $method)) {
                    $cost = $rateReply->RatedShipmentDetails[0]->ShipmentRateDetail->TotalNetCharge->Amount;
                    $cost = (float) round(preg_replace('/[^0-9.]/', '', $cost), 2);
                    $methods[] = array('id' => str_replace('_', '', $rateReply->ServiceType),
                            'title' => ucwords(strtolower(str_replace('_', ' ', $rateReply->ServiceType))),
                            'cost' => $cost + $this->handling_fee);
                }
            }

fedexwebservices.php

Link to comment
Share on other sites

  • 7 months later...
 tep_db_query ("вставить в". TABLE_CONFIGURATION . "(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) значения ('название штата или провинции', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATE',",", "введите 2-буквенное название штата или провинции для адреса отправителя, необходимого для Канады и США', '6', '23', теперь())");
 tep_db_query ("вставить в". TABLE_CONFIGURATION . "(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) значения ('Почтовый индекс', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_POSTAL',",", "введите Почтовый индекс для адреса отправления, требуемый', '6', '24', теперь())");
 tep_db_query ("вставить в". TABLE_CONFIGURATION . "(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) значения ('Phone number', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_PHONE',",", "введите контактный номер телефона для Вашей компании, обязательно', '6', '25', теперь())");
 tep_db_query ("вставить в". TABLE_CONFIGURATION . "(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) значения ('Drop off type', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_DROPOFF', '1', ' Dropoff type (1 = Regular picking, 2 = запрос courier, 3 = drop box, 4 = drop на BSC, 5 = drop at?)', '6', '30', 'tep_cfg_select_option (массив(\'1\',\'2\',\'3\',\'4\',\'5\'),', теперь())");
 tep_db_query ("вставить в". TABLE_CONFIGURATION . "(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) значения ('Enable Express Saver', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_SAVER', 'true', 'Enable FedEx Express Saver', '6', '10', 'tep_cfg_select_option (массив (\'true\', \ ' false\'),', сейчас())");
 tep_db_query ("вставить в". TABLE_CONFIGURATION . "(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) значения ('Enable Standard Overnight', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_STANDARD_OVERNIGHT', 'true', 'Enable FedEx Express Standard Overnight', '6', '10', 'tep_cfg_select_option (массив (\'true\', \'false\'),', сейчас())");
 tep_db_query ("вставить в". TABLE_CONFIGURATION . "(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) значения ('Enable First Overnight', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_FIRST_OVERNIGHT', 'true', 'Enable FedEx Express First Overnight', '6', '10', 'tep_cfg_select_option (массив (\'true\', \'false\'),', сейчас())");
 tep_db_query ("вставить в". TABLE_CONFIGURATION . "(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) значения ('Enable Priority Overnight', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_PRIORITY_OVERNIGHT', 'true', 'включить FedEx Express Priority Overnight', '6', '10', 'tep_cfg_select_option (массив (\'true\', \'false\'),', сейчас())");
 tep_db_query ("вставить в". TABLE_CONFIGURATION . "(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) значения ('Enable 2 Day', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_2DAY', 'true', 'Enable FedEx Express 2 Day', '6', '10', 'tep_cfg_select_option (массив (\'true\', \ ' false\'),', сейчас())");
 tep_db_query ("вставить в". TABLE_CONFIGURATION . "(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) значения ('Enable International Priority', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_PRIORITY', 'true', 'Enable FedEx Express International Priority', '6', '10', 'tep_cfg_select_option (массив (\'true\', \'false\'),', сейчас())");
 tep_db_query ("вставить в". TABLE_CONFIGURATION . "(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) значения ('Enable International Economy', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_ECONOMY', 'true', 'Enable FedEx Express International Economy', '6', '10', 'tep_cfg_select_option (массив (\'true\', \'false\'),', сейчас())");
 tep_db_query ("вставить в". TABLE_CONFIGURATION . "(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) значения ('Enable Ground', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_GROUND', 'true', 'Enable FedEx Ground', '6', '10', 'tep_cfg_select_option (массив (\'true\', \ ' false\'),', сейчас())");
 tep_db_query ("вставить в". TABLE_CONFIGURATION . "(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) значения ('Enable International Ground', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_GROUND', 'true', 'Enable FedEx International Ground', '6', '10', 'tep_cfg_select_option (массив (\'true\', \'false\'),', сейчас())");
 tep_db_query ("вставить в". TABLE_CONFIGURATION . "(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) значения ('Enable Freight', 'MODULE_SHIPPING_FEDEX_WEB_SERVICFREES_IGHT', 'true', 'Enable FedEx Freight', '6', '10', 'tep_cfg_select_option (массив (\'true\', \ ' false\'),', сейчас())");
 tep_db_query ("вставить в". TABLE_CONFIGURATION . "(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) значения ('стоимость обработки', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_HANDLING_FEE',",", "Добавить сбор за обработку или оставить пустым', '6', '25', теперь())");
 tep_db_query ("вставить в". TABLE_CONFIGURATION . "(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) значения ('Shipping Zone', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ZONE',', '0', 'Если выбрана зона, включите только этот метод доставки для этой зоны.', '6', '98', 'tep_get_zone_class_title',' tep_cfg_pull_down_zone_classes ( ' , сейчас())");
 tep_db_query ("вставить в". TABLE_CONFIGURATION . "(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) значения ('Tax Class', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_TAX_CLASS', '0', ' используйте следующий налоговый класс на стоимость доставки.', '6', '25', 'tep_get_tax_class_title',' tep_cfg_pull_down_tax_classes ( ' , сейчас())");
 tep_db_query ("вставить в". TABLE_CONFIGURATION . "(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) значения ('Порядок сортировки', 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SORT_ORDER', '0', ' порядок сортировки отображения.', '6', '99', теперь())"); 
 }

 функция remove() {
 tep_db_query ("Удалить из". TABLE_CONFIGURATION ."Where configuration_key in ('". implode ( " ','",$this - > keys ()). "')");
 }

 функциональная клавиша() {
 возвращаемый массив('MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATUS',
 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_KEY',
 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_PWD',
 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ACT_NUM',
 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_METER_NUM',
 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_WEIGHT',
 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_1',
 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_2',
 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_CITY',
 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATE',
 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_POSTAL',
 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_PHONE',
 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_DROPOFF',
 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_SAVER',
 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_STANDARD_OVERNIGHT',
 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_FIRST_OVERNIGHT',
 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_PRIORITY_OVERNIGHT',
 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_2DAY',
 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_PRIORITY',
 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_ECONOMY',
 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_GROUND',
 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_GROUND',
 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_FREIGHT',
 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_TAX_CLASS',
 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_HANDLING_FEE',
 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_ZONE',
 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_SORT_ORDER'
 );
 }

 функция get_countries ($countries_id =", $with_iso_codes = false) {
 $countries_array = массив();
 if (tep_not_null ($countries_id)) {
 if ($with_iso_codes == true) {
 $countries = tep_db_query ("выбрать имя_критари, имя_каталога_2, имя_каталога_картри_"). TABLE_COUNTRIES . "Where countries_id ='". (int)$countries_id . "'order by countries_name");
 $ countries_values = tep_db_fetch_array ($страны);
 $countries_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']);
 } еще {
 $countries = tep_db_query ("выбрать имя_счета от". TABLE_COUNTRIES . "Where countries_id ='". (int)$countries_id . "'");
 $ countries_values = tep_db_fetch_array ($страны);
 $countries_array = массив ('countries_name' = > $countries_values ['countries_name']);


Im still recieveing:

Fatal error: Class 'SoapClient' not found in /hermes/bosweb25b/b600/ipg.theholydivercom/includes/modules/shipping/fedexwebservices.php on line 67


 }
Link to comment
Share on other sites

Line 67 probably starts with $path_to_wsdl  and the path you specify doesn't have the RateService_v9.wsdl in it.  Note, the version you have may be different.  9 still works for my needs.

I'm not really a dog.

Link to comment
Share on other sites

Quote

Fatal error: Class 'SoapClient' not found in /hermes/bosweb25b/b600/ipg.theholydivercom/includes/modules/shipping/fedexwebservices.php on line 67

This generally means the SOAP library is not installed on the server.  This library is needed for the module to communicate with fedex.  You may want to contact your hosting provider and ask them about it.

cheers

Peter

Peter McGrath

-----------------------------

See my Profile (click here) for more information and to contact me for professional osCommerce support that includes SEO development, custom development and security implementation

Link to comment
Share on other sites

  • 11 months later...

Has anyone integrated FedEx Web Services with something like Canada Post sellonline (or UPS packing - which I haven't figured out)? i ask because sellonline does the packing for you and then returns the recommended box size (based on your list of boxes available) and the total weight. It would be great to integrate that into FedEx and/or UPS to get a more accurate box size rather than the system appearing to go just one weight. So large, but light objects are undercharged.

I've tried searching for 'packing & Fedex Wed Services' but no real obvious results.

Suggestions? I should just read the code but I'm hoping someone else who has more free time and is interested will look into this.

Thanks!

Link to comment
Share on other sites

I am using FedexWeb services and it works well for the most part. We wanted to add ground to Canada so I set Enable Intl Ground to true, but I don't see results. I called Fed-Ex and talked to tech support. We ran a test and he said that they returned a ground rate, but only the international economy and priority rates showed up.

Link to comment
Share on other sites

  • 1 month later...

I have FedEx Web services  working on Phoenix 1.0.4.0 and PHP 7.1.

The attached two files from the 9.5 FedEx Web Services were edited to remove the old references "TABLE_", "DIR_FS_" and "DIR_WS_."  Lower case table names without the "TABLE_" prefix were used to replace; full, lower-case path strings were used to replace the "DIR_" references.

fedex-common.php5 is placed in catalog/includes/library/ (you create the "library" folder on a new install)

fedexwebservices.php is placed in catalog/includes/modules/shipping/

These have been far from completely vetted, but everything seems to be working fine on my Phoenix build.

fedex-common.php5

fedexwebservices.php

Link to comment
Share on other sites

  • 2 months later...

I am trying to set this up for just Canada Shipping. I am getting Active red X. I went to Tax Zones added Canada All Zones, I entered Canada into fedex shipping zone module. Is this correct approach? I am using Phoenix CE.

I also edited fedexwebservices.php

Original code:

function fedexwebservices() {
//Class Constructor
  function __construct() {

 

Link to comment
Share on other sites

I figured it out. I am guessing Phoenix version took out

define('STORE_ORIGIN_COUNTRY', 'US');


I added that in my english.php and now it works. I wonder though why this is the case? Isn't the MyStore Country supposed to fix this? I think I am going to edit this module anyway it's old and using fedex v9 of wsdl and Fedex is v26 newest of wsdl. Not sure what that actually makes a difference though.

Link to comment
Share on other sites

  • 1 month later...

I'm having a similar issue to @Irin a few posts back.

I discovered today that for International FedEx services, it was only using the percentage handling fee as the $ rate.  In other words, completely ignoring the rate amount, taking 15% for the International Handling Fee (set in Admin), and converting that to $15 USD as the total rate (should've been around $117).

I found that by changing the Admin settings from "LIST" to "ACCOUNT" rates, it worked for International.  Just to be sure, I logged in with a domestic account for a checkout with domestic shipping, and I get this:

Quote

Fatal error: Uncaught Error: Cannot use object of type stdClass as array in catalog/includes/modules/shipping/fedexwebservices.php:313 Stack trace: #0 catalog/includes/classes/shipping.php(79): fedexwebservices->quote('') #1 catalog/checkout_shipping.php(155): shipping->quote() #2 {main} thrown in catalog/includes/modules/shipping/fedexwebservices.php on line 313

The FedEx code in that area (fedexwebservices.php) in that area looks like this:

Quote

////////////          
          if(MODULE_SHIPPING_FEDEX_WEB_SERVICES_RATES == 'LIST') // For LIST/FULL Rates, calculate the cost as below
          {
            foreach($rateReply->RatedShipmentDetails as $ShipmentRateDetail)
            {
              if($ShipmentRateDetail->ShipmentRateDetail->RateType=='PAYOR_LIST_PACKAGE')
//                if($ShipmentRateDetail->ShipmentRateDetail->RateType==('PAYOR_LIST_PACKAGE' || 'PAYOR_LIST_SHIPMENT')) // try this if having international quoting errors
              {
                $cost = ($ShipmentRateDetail->ShipmentRateDetail->TotalNetCharge->Amount)/MODULE_SHIPPING_FEDEX_WEB_SERVICES_CURRENCY;
                $cost = (float)round(preg_replace('/[^0-9.]/', '',  $cost), 2);
              }
            }
          } // For LIST/FULL Rates, END
          
////////////
          
          
          else // For ACCOUNT Discounted Rates, calculate the cost as below
          { 
            $cost = ($rateReply->RatedShipmentDetails[0]->ShipmentRateDetail->TotalNetCharge->Amount)/MODULE_SHIPPING_FEDEX_WEB_SERVICES_CURRENCY;
            $cost = (float)round(preg_replace('/[^0-9.]/', '',  $cost), 2);
          } // For ACCOUNT Discounted Rates, END
          
    $transitTime = ''; // 9.4.6 
          if (in_array($rateReply->ServiceType, array('GROUND_HOME_DELIVERY', 'FEDEX_GROUND', 'INTERNATIONAL_GROUND'))) {
            $transitTime = ' (' . str_replace(array('_', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteeen'), array(' ', 1,2,3,4,5,6,7,8,9,10,11,12,13,14), strtolower($rateReply->TransitTime)) . ')';
          }
          
          if (isset($rateReply->DeliveryTimestamp)) {
         // $transitTime = ' (Estimated Delivery on: ' . date('l, F jS Y \a\t g:ia', strtotime($rateReply->DeliveryTimestamp)) . ') ';
          $transitTime = ' (Estimated Delivery Date: ' . date('l, F jS Y', strtotime($rateReply->DeliveryTimestamp)) . ') ';
          }
  
                                $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']));
                      //     }
                           
        }
      }

If I go back and change to "LIST," then rates work for domestic, but International is back to charging just the Handling Fee percentage in USD.

Any ideas?

Link to comment
Share on other sites

Which line is 313? 

Perhaps try changing

          if(MODULE_SHIPPING_FEDEX_WEB_SERVICES_RATES == 'LIST') // For LIST/FULL Rates, calculate the cost as below
          {

to

          if (('LIST' === MODULE_SHIPPING_FEDEX_WEB_SERVICES_RATES) && (is_countable($rateReply->RatedShipmentDetails))) {
           // For LIST/FULL Rates, calculate the cost as below

 

Always back up before making changes.

Link to comment
Share on other sites

5 hours ago, TomB01 said:

$cost = ($rateReply->RatedShipmentDetails[0]->ShipmentRateDetail->TotalNetCharge->Amount)/MODULE_SHIPPING_FEDEX_WEB_SERVICES_CURRENCY;

@ecartz,

I am so sorry.  I realized my oversight later on, but had to feed the family.

Line 313 is quoted above.  It seems not to like the [0] array reference for RatedShipmentDetails[0], but I don't know why.  I tried it after taking out "[0]" but it goes back to $15 USD for every International Rate (what I have defined as International handling - 15%).  Domestic works fine with that change, though.

Maybe it will help if I put it back in context:

Quote

////////////          
          if(MODULE_SHIPPING_FEDEX_WEB_SERVICES_RATES == 'LIST') // For LIST/FULL Rates, calculate the cost as below
          {
            foreach($rateReply->RatedShipmentDetails as $ShipmentRateDetail)
            {
              if($ShipmentRateDetail->ShipmentRateDetail->RateType=='PAYOR_LIST_PACKAGE')
//                if($ShipmentRateDetail->ShipmentRateDetail->RateType==('PAYOR_LIST_PACKAGE' || 'PAYOR_LIST_SHIPMENT')) // try this if having international quoting errors
              {
                $cost = ($ShipmentRateDetail->ShipmentRateDetail->TotalNetCharge->Amount)/MODULE_SHIPPING_FEDEX_WEB_SERVICES_CURRENCY;
                $cost = (float)round(preg_replace('/[^0-9.]/', '',  $cost), 2);
              }
            }
          } // For LIST/FULL Rates, END
          
////////////
          
          
          else // For ACCOUNT Discounted Rates, calculate the cost as below
          { 
            $cost = ($rateReply->RatedShipmentDetails[0]->ShipmentRateDetail->TotalNetCharge->Amount)/MODULE_SHIPPING_FEDEX_WEB_SERVICES_CURRENCY;
            $cost = (float)round(preg_replace('/[^0-9.]/', '',  $cost), 2);
          } // For ACCOUNT Discounted Rates, END
          
    $transitTime = ''; // 9.4.6 
          if (in_array($rateReply->ServiceType, array('GROUND_HOME_DELIVERY', 'FEDEX_GROUND', 'INTERNATIONAL_GROUND'))) {
            $transitTime = ' (' . str_replace(array('_', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteeen'), array(' ', 1,2,3,4,5,6,7,8,9,10,11,12,13,14), strtolower($rateReply->TransitTime)) . ')';
          }
          
          if (isset($rateReply->DeliveryTimestamp)) {
         // $transitTime = ' (Estimated Delivery on: ' . date('l, F jS Y \a\t g:ia', strtotime($rateReply->DeliveryTimestamp)) . ') ';
          $transitTime = ' (Estimated Delivery Date: ' . date('l, F jS Y', strtotime($rateReply->DeliveryTimestamp)) . ') ';
          }
  
                                $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']));
                      //     }
                           
        }

The bolded line is 313.

Edited by TomB01
Link to comment
Share on other sites

If it is traversable, then replacing line 313 with

$cost = (reset($rateReply->RatedShipmentDetails)->ShipmentRateDetail->TotalNetCharge->Amount)/MODULE_SHIPPING_FEDEX_WEB_SERVICES_CURRENCY;

might work. 

Setting it to List and explicitly casting to array might work. 

             foreach ((array)$rateReply->RatedShipmentDetails as $ShipmentRateDetail)

I'm not sure what line that is, but it is before 313 and I just added (array) to it. 

In a test store (not a live store, as it would break it), you could add

var_dump($rateReply->RatedShipmentDetails);
exit();

just before line 313 and see what it says.  Try twice, once each for domestic and international. 

 

Always back up before making changes.

Link to comment
Share on other sites

11 hours ago, ecartz said:

If it is traversable, then replacing line 313 with


$cost = (reset($rateReply->RatedShipmentDetails)->ShipmentRateDetail->TotalNetCharge->Amount)/MODULE_SHIPPING_FEDEX_WEB_SERVICES_CURRENCY;

might work. 

Setting it to List and explicitly casting to array might work. 


             foreach ((array)$rateReply->RatedShipmentDetails as $ShipmentRateDetail)

I'm not sure what line that is, but it is before 313 and I just added (array) to it. 

In a test store (not a live store, as it would break it), you could add


var_dump($rateReply->RatedShipmentDetails);
exit();

just before line 313 and see what it says.  Try twice, once each for domestic and international. 

 

Brilliant!  Your very first suggestion worked!  Both Domestic and International pricing appear to be working!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...