Forums / Addon Shipping Modules / FedEx Shipping using REST API

FedEx Shipping using REST API

Sticky

Views: 34,277

Results 41 to 60 of 100
14 Nov 2023, 9:42 PM
#41
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,729
Plugin Contributions:
56

FedEx Shipping using REST API

Version 1.1 is now available with the fixes from @njcyx for International Shipping.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

30 Nov 2023, 5:10 PM
#42
wtfbbq avatar

wtfbbq

New Zenner

Join Date:
Aug 2012
Posts:
45
Plugin Contributions:
0

Re: FedEx Shipping using REST API

On fedexrest.php file under modules, if I wanted to permanently reorder them a certain way like ground at the top, I would mess with lines 165 -210 of the code, correct?

30 Nov 2023, 5:53 PM
#43
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,729
Plugin Contributions:
56

Re: FedEx Shipping using REST API

A better approach would be to read the documentation and see how rateSortOrder works, and submit a PR that allowed people to set it. (I assume you want to sort by price lowest to highest.)

https://developer.fedex.com/api/en-us/catalog/rate/v1/docs.html#operation/Rate%20and%20Transit%20times

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

30 Nov 2023, 7:27 PM
#44
wtfbbq avatar

wtfbbq

New Zenner

Join Date:
Aug 2012
Posts:
45
Plugin Contributions:
0

Re: FedEx Shipping using REST API

swguy:

A better approach would be to read the documentation and see how rateSortOrder works, and submit a PR that allowed people to set it. (I assume you want to sort by price lowest to highest.)

https://developer.fedex.com/api/en-us/catalog/rate/v1/docs.html#operation/Rate%20and%20Transit%20times

Noted.

I just don't like how it is out of order as far as the speeds go, which coincides with the cost.

Right now the list is: next day at the top, ground in the middle, 2day, then express saver.
Ground, express saver, 2 day, then next day makes more sense to me as a customer on the site.

Also, I renamed the heading to remove the "REST API" to just "Fedex" so the REST API heading doesn't show to the customer. Looks cleaner to me this way.

30 Nov 2023, 7:58 PM
#45
njcyx avatar

njcyx

Zen Follower

Join Date:
Apr 2019
Posts:
376
Plugin Contributions:
0

Re: FedEx Shipping using REST API

I did some studies regarding the element rateSortOrder. Here are the available values:

SERVICENAMETRADITIONAL - data in order of highest to lowest service (Default)
COMMITASCENDING - data in order of ascending delivery committment
COMMITDESCENDING - data in order of descending delivery committment.

The last two sorting options are both based on the shipping speed, not by the quoted price. You may need to change the code for your special needs.

You can probably try my code as the following (Bubble Sort). So the ground will be the first, then the rest will be sorted ascending by price.

Please put the following code on the top of the file.

if (!function_exists('fedex_sort')) {
function fedex_sort ($a, $b) {
$c = (float)$a['cost'];
$d = (float)$b['cost'];
$e = 'Ground';
if ($c==$d) return 0;
if (strpos($a['title'], $e) !== false) return -1;
if (strpos($b['title'], $e) !== false) return 1;
return ($c>$d?1:-1);
}
}

Then put the following line before "$quotes['methods'] = $methods;"

usort($methods,'fedex_sort');

8 Dec 2023, 2:20 AM
#46
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: FedEx Shipping using REST API

Hi. Running ZC 1.5.8a with the version that's listed and I'm running into the following (warning) error message while trying to run the Shopping Cart Estimator

[07-Dec-2023 20:56:11 America/New_York] Request URI: /justuptown/index.php?main_page=shopping_cart, IP address: 127.0.0.1, Language id 1#0 E:\xampp\htdocs\justuptown\includes\modules\shipping\fedexrest.php(309): zen_debug_error_handler()
#1 E:\xampp\htdocs\justuptown\includes\modules\shipping\fedexrest.php(219): fedexrest->getRates()
#2 E:\xampp\htdocs\justuptown\includes\classes\shipping.php(201): fedexrest->quote()
#3 E:\xampp\htdocs\justuptown\includes\modules\shipping_estimator.php(151): shipping->quote()
#4 E:\xampp\htdocs\justuptown\includes\templates\bootstrap\templates\tpl_shopping_cart_default.php(223): require('E:\\xampp\\htdocs...')
#5 E:\xampp\htdocs\justuptown\includes\templates\bootstrap\common\tpl_main_page.php(216): require('E:\\xampp\\htdocs...')
#6 E:\xampp\htdocs\justuptown\index.php(94): require('E:\\xampp\\htdocs...')
--> PHP Warning: Undefined array key "street_address" in E:\xampp\htdocs\justuptown\includes\modules\shipping\fedexrest.php on line 309.

I tried to define the $street_address in fedexrest but I'm still getting that error. It's not breaking anything but it's just generating log file after log file when I refresh the shopping code.

8 Dec 2023, 12:27 PM
#47
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,729
Plugin Contributions:
56

Re: FedEx Shipping using REST API

Fix it just like the line below it. Use ?? ''

     $street_address = $order->delivery['street_address'] ?? '';

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

9 Feb 2024, 1:11 PM
#48
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,729
Plugin Contributions:
56

Re: FedEx Shipping using REST API

Version 1.2 is now out with some improvements from community members @retched and @njcyx.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

9 Feb 2024, 3:44 PM
#49
bubbadood avatar

bubbadood

New Zenner

Join Date:
Mar 2012
Location:
NJ
Posts:
49
Plugin Contributions:
0

Re: FedEx Shipping using REST API

Installed 1.2, status shows yellow without any warnings posted on the right-hand side. Should I be looking somewhere else for an issue or can the yellow status be ignored?

I was a shy, quiet kid. I was happiest playing by myself with my toys, rather than hanging around people.
-- Christian Slater

9 Feb 2024, 3:53 PM
#50
bubbadood avatar

bubbadood

New Zenner

Join Date:
Mar 2012
Location:
NJ
Posts:
49
Plugin Contributions:
0

Re: FedEx Shipping using REST API

Bubbadood:

Installed 1.2, status shows yellow without any warnings posted on the right-hand side. Should I be looking somewhere else for an issue or can the yellow status be ignored?

Disregard, I went in and regenerated my secret key and reapplied. Working as intended, issue was clearly on my end.

I was a shy, quiet kid. I was happiest playing by myself with my toys, rather than hanging around people.
-- Christian Slater

21 Mar 2024, 1:59 PM
#51
njcyx avatar

njcyx

Zen Follower

Join Date:
Apr 2019
Posts:
376
Plugin Contributions:
0

Re: FedEx Shipping using REST API

php7.4. zc 1.57d

I just updated my site to one page checkout v1.5.0. The legacy fedex plug-in works fine. But fedex rest (v1.2) may have some issues for the Saturday delivery.

So under the checkout page, FedEx 2 day and Fedex 2 Day (Saturday Delivery) quotes shown under the shipping method section properly. If I selected FedEx 2day option, on the page bottom, below Sub-Total, it would show FedEx 2 day and its quote properly. But if I clicked on Fedex 2 Day (Saturday Delivery) under the shipping method section, there is no change under the sub-total section. It still shown "FedEx 2 day" with the "FedEx 2 day" quote.

If I selected FedEx ground at first then select FedEx 2day saturday later, the sub-total section still shows Fedex 2day and its quote.

All the other shipping methods are updated properly, such as Fedex ground, USPS and UPS. But Fedex 2 day and Fedex 2day saturday delivery both show FedEx 2day and its quote.

21 Mar 2024, 2:06 PM
#52
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,729
Plugin Contributions:
56

Re: FedEx Shipping using REST API

Thanks for reporting. I will have a look.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

6 Apr 2024, 12:50 PM
#53
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,729
Plugin Contributions:
56

Re: FedEx Shipping using REST API

You have to set the "Show Estimated Transit Time" setting in the config to "True" to see this data.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

9 Apr 2024, 5:25 PM
#54
njcyx avatar

njcyx

Zen Follower

Join Date:
Apr 2019
Posts:
376
Plugin Contributions:
0

Re: FedEx Shipping using REST API

njcyx:

php7.4. zc 1.57d

I just updated my site to one page checkout v1.5.0. The legacy fedex plug-in works fine. But fedex rest (v1.2) may have some issues for the Saturday delivery.

So under the checkout page, FedEx 2 day and Fedex 2 Day (Saturday Delivery) quotes shown under the shipping method section properly. If I selected FedEx 2day option, on the page bottom, below Sub-Total, it would show FedEx 2 day and its quote properly. But if I clicked on Fedex 2 Day (Saturday Delivery) under the shipping method section, there is no change under the sub-total section. It still shown "FedEx 2 day" with the "FedEx 2 day" quote.

If I selected FedEx ground at first then select FedEx 2day saturday later, the sub-total section still shows Fedex 2day and its quote.

All the other shipping methods are updated properly, such as Fedex ground, USPS and UPS. But Fedex 2 day and Fedex 2day saturday delivery both show FedEx 2day and its quote.

Github discussion link regarding this issue.

https://github.com/scottcwilson/zencart_fedexrest/issues/6#issue-2215956989

If you have the same issue as mine, you can try my "band-aid" solution in the link above.

Or maybe I'm the only one who offer FedEx Saturday delivery service...

11 Apr 2024, 9:58 AM
#55
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,729
Plugin Contributions:
56

Re: FedEx Shipping using REST API

Version 1.3 released; fixes Saturday delivery issue.
Note that you must have "Show Estimated Transit Time" setting in the config to "True" to do Saturday Delivery.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

11 Apr 2024, 5:20 PM
#56
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,729
Plugin Contributions:
56

Re: FedEx Shipping using REST API

version 1.3.1 released - version 1.3 was accidentally built from the wrong files; please re-download if you downloaded it this morning.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

10 May 2024, 3:08 PM
#57
jeff_mash avatar

jeff_mash

Totally Zenned

Join Date:
Aug 2004
Posts:
732
Plugin Contributions:
0

Re: FedEx Shipping using REST API

I am testing this on a ZC 1.5.8.a running PHP 8.3 and OPC plugin 2.4.6.

I am getting this error in the logs even though the plugin seems to be displaying prices just fine:

--> PHP Warning: Attempt to read property "delivery" on null in /home/domain/public_html/store/includes/modules/shipping/fedexrest.php on line 123.

--> PHP Warning: Trying to access array offset on value of type null in /home/domain/public_html/store/includes/modules/shipping/fedexrest.php on line 123.

  • Jeff
10 May 2024, 6:13 PM
#58
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,729
Plugin Contributions:
56

Re: FedEx Shipping using REST API

Grab the latest update; this issue is fixed.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

13 May 2024, 6:44 PM
#59
jeff_mash avatar

jeff_mash

Totally Zenned

Join Date:
Aug 2004
Posts:
732
Plugin Contributions:
0

Re: FedEx Shipping using REST API

swguy:

Grab the latest update; this issue is fixed.

Is there a later version than 1.3.1, because that is what I was running when experiencing the error.

  • Jeff
13 May 2024, 7:34 PM
#60
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,729
Plugin Contributions:
56

Re: FedEx Shipping using REST API

Why yes there is. Take a look in the plugins library and you'll see it.

https://www.zen-cart.com/downloads.php?do=file&id=2375

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.