Forums / Addon Shipping Modules / FedEx Shipping using REST API

FedEx Shipping using REST API

Sticky

Views: 34,276

Results 1 to 20 of 100
3 Jul 2023, 9:25 PM
#2
swguy avatar

swguy

Administrator

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

Re: FedEx Shipping using REST API

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.

7 Jul 2023, 6:31 PM
#3
njcyx avatar

njcyx

Zen Follower

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

Re: FedEx Shipping using REST API

swguy:

Install instructions:
https://github.com/scottcwilson/zencart_fedexrest/wiki/Installation-Instructions

This FedEx developer portal is extremely hard to use. It will always show error page somehow and ask you contact FedEx support. Refresh the page sometimes works but sometimes doesn't. I also tried to log out and log in again. Very frustrated.

Here are the steps:

  1. Go to manage organization page, create an organization there.

  2. Then go the my projects page, create a new project. It seems I cannot enter a shipping location there, or it doesn't allow me to submit.

  3. Under your new project page, go to production key tab. You need to add a shipping account there by your FedEx account number. You need to see the agreement and confirm there. If you failed to confirm, it will not work. You can go to manage organization, shipping accounts. You can view the agreement there. After you confirm the agreement successfully, license agreement status need to be "Completed". Then you can go back to the project page, then create a production key there.

10 Jul 2023, 6:27 PM
#4
njcyx avatar

njcyx

Zen Follower

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

Re: FedEx Shipping using REST API

One more update. I just generally tested this plug-in (v0.9) and it worked great. One suggestion: I noticed that there is no option to resort the result. So by default, the highest quote shows at the top and the lowest quote shows at the bottom. It could be more customer friendly if the display can be reversed, so the lowest quote shows at the top. The code in the following post still works.

https://www.zen-cart.com/showthread.php?194803-FedEx-sort-order&p=1117683#post1117683

11 Jul 2023, 9:27 AM
#5
swguy avatar

swguy

Administrator

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

Re: FedEx Shipping using REST API

Sounds good, will add to the next update. Thanks for reporting your success.

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 Jul 2023, 7:54 PM
#6
njcyx avatar

njcyx

Zen Follower

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

Re: FedEx Shipping using REST API

njcyx:

One more update. I just generally tested this plug-in (v0.9) and it worked great. One suggestion: I noticed that there is no option to resort the result. So by default, the highest quote shows at the top and the lowest quote shows at the bottom. It could be more customer friendly if the display can be reversed, so the lowest quote shows at the top. The code in the following post still works.

https://www.zen-cart.com/showthread.php?194803-FedEx-sort-order&p=1117683#post1117683

I just checked the latest USPS module (k11i), and the sorting function looks more professional (thanks @lat9 ). You may refer to it for this function:

Near line 885

        // sort results
        if (MODULE_SHIPPING_USPS_QUOTE_SORT !== 'Unsorted') {
            if (count($methods) !== 0) {
                if (strpos(MODULE_SHIPPING_USPS_QUOTE_SORT, 'Price') === 0) {
                    foreach ($methods as $c => $key) {
                        $sort_cost[] = $key['cost'];
                        $sort_id[] = $key['id'];
                    }
                    array_multisort($sort_cost, (MODULE_SHIPPING_USPS_QUOTE_SORT === 'Price-LowToHigh' ? SORT_ASC : SORT_DESC), $sort_id, SORT_ASC, $methods);
                } else {
                    foreach ($methods as $c => $key) {
                        $sort_key[] = $key['title'];
                        $sort_id[] = $key['id'];
                    }
                    array_multisort($sort_key, (MODULE_SHIPPING_USPS_QUOTE_SORT === 'Alphabetical' ? SORT_ASC : SORT_DESC), $sort_id, SORT_ASC, $methods);
                }
            }
        }
13 Jul 2023, 2:24 PM
#7
njcyx avatar

njcyx

Zen Follower

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

Re: FedEx Shipping using REST API

Hi @swguy, can you please try and see if FedEx 2day Saturday delivery is displayed properly? My testing site didn't show it up today (Thursday), but only the regular FedEx 2day. Saturday Delivery option is enabled in the option. Also, there is no shipping cutoff time option...

To clarify, Saturday delivery option should be only available for 2day shipping on Thursday, and for overnight shippings on Friday.

I checked the debug file, there is no 2day saturday delivery option neither... Only regular 2day and 2day am.

14 Jul 2023, 2:07 PM
#8
njcyx avatar

njcyx

Zen Follower

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

Re: FedEx Shipping using REST API

njcyx:

Hi @swguy, can you please try and see if FedEx 2day Saturday delivery is displayed properly? My testing site didn't show it up today (Thursday), but only the regular FedEx 2day. Saturday Delivery option is enabled in the option. Also, there is no shipping cutoff time option...

To clarify, Saturday delivery option should be only available for 2day shipping on Thursday, and for overnight shippings on Friday.

I checked the debug file, there is no 2day saturday delivery option neither... Only regular 2day and 2day am.

One more update. I just tried to get a quote today (Friday). Overnight with saturday delivery options didn't show up neither...

14 Jul 2023, 2:35 PM
#9
swguy avatar

swguy

Administrator

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

Re: FedEx Shipping using REST API

I will investigate. Please be patient.

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.

14 Jul 2023, 7:48 PM
#10
njcyx avatar

njcyx

Zen Follower

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

Re: FedEx Shipping using REST API

Thanks. Take time.

I'm not sure if there is a way to test this feature other than Thursday and Friday...

21 Jul 2023, 6:43 AM
#11
swguy avatar

swguy

Administrator

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

Re: FedEx Shipping using REST API

Saturday shipping does work, it was just hard to see because it wasn't specifically called out. I have updated Github to show when a method is priced for Saturday delivery.

Attachment 20342

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.

21 Jul 2023, 1:49 PM
#12
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,973
Plugin Contributions:
8

Re: FedEx Shipping using REST API

njcyx:

Thanks. Take time.

I'm not sure if there is a way to test this feature other than Thursday and Friday...

look at this line:

https://github.com/scottcwilson/zencart_fedexrest/blob/722907eea7c97b80027e92dfad61cc316e2c2917/includes/modules/shipping/fedexrest.php#L402

this is where the ship date gets set for rates.

if you want to test for saturday delivery, before this line:

https://github.com/scottcwilson/zencart_fedexrest/blob/722907eea7c97b80027e92dfad61cc316e2c2917/includes/modules/shipping/fedexrest.php#L375

you can add:

    $shipDate = new DateTime();
    // choose one of the following.  only use 1, else you will get 2 weeks out for a date.  which should still work...
    $shipDate->modify('next friday');
    $shipDate->modify('next thursday');

then change line 402 to

'shipDateStamp' => $shipDate->('Y-m-d'),

best.

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

21 Jul 2023, 7:27 PM
#13
njcyx avatar

njcyx

Zen Follower

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

Re: FedEx Shipping using REST API

swguy:

Saturday shipping does work, it was just hard to see because it wasn't specifically called out. I have updated Github to show when a method is priced for Saturday delivery.

Attachment 20342

Hi @swguy, thanks. I have a new finding here.

Attachment 20343

Attachment 20344

If I set "Show Estimated Transit Time" to false, there is no Saturday delivery option. But if I set it to true, I can get the similar quote as your screenshot (Saturday options show up properly).

21 Jul 2023, 7:49 PM
#14
njcyx avatar

njcyx

Zen Follower

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

Re: FedEx Shipping using REST API

carlwhat:

look at this line:

https://github.com/scottcwilson/zencart_fedexrest/blob/722907eea7c97b80027e92dfad61cc316e2c2917/includes/modules/shipping/fedexrest.php#L402

this is where the ship date gets set for rates.

if you want to test for saturday delivery, before this line:

https://github.com/scottcwilson/zencart_fedexrest/blob/722907eea7c97b80027e92dfad61cc316e2c2917/includes/modules/shipping/fedexrest.php#L375

you can add:

$shipDate = new DateTime();
// choose one of the following.  only use 1, else you will get 2 weeks out for a date.  which should still work...
$shipDate->modify('next friday');
$shipDate->modify('next thursday');
> 
> then change line 402 to 
> 
> ```php
'shipDateStamp' => $shipDate->('Y-m-d'),

best.

That is so smart! Thanks!

21 Jul 2023, 7:51 PM
#15
swguy avatar

swguy

Administrator

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

Re: FedEx Shipping using REST API

Yep, that seems to be how it works.

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.

21 Jul 2023, 7:55 PM
#16
njcyx avatar

njcyx

Zen Follower

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

Re: FedEx Shipping using REST API

swguy:

Saturday shipping does work, it was just hard to see because it wasn't specifically called out. I have updated Github to show when a method is priced for Saturday delivery.

Attachment 20342

My 2nd thought. This screenshot looks strange. Only two Saturday delivery options and ground show the estimate delivery date. All the other options (such as 2day, saver, regular overnight) don't show the estimate delivery date.

21 Jul 2023, 9:10 PM
#17
swguy avatar

swguy

Administrator

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

Re: FedEx Shipping using REST API

Please look at the configuration description for this option:

Show Estimated Transit Time
Display the transit time for ground methods?

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.

24 Jul 2023, 3:18 PM
#18
njcyx avatar

njcyx

Zen Follower

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

Re: FedEx Shipping using REST API

swguy:

Please look at the configuration description for this option:

Show Estimated Transit Time
Display the transit time for ground methods?

I see. Thanks for pointing me out. I haven't paid attention to the 2nd line under this option...

So if this option is set to true, transit time for ground and Saturday delivery options are all displayed.

If this option is set to false, transit time for ground and Saturday delivery options are all hidden.

It might be better to split this option into two options instead?

24 Jul 2023, 3:50 PM
#19
njcyx avatar

njcyx

Zen Follower

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

Re: FedEx Shipping using REST API

njcyx:

That is so smart! Thanks!

Hi @carlwhat, I just tested your suggested code. Unfortunately, I received the following error:

PHP Parse error: syntax error, unexpected '(', expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$'

I did some study and test. If I changed the last line as your suggested into:

'shipDateStamp' => $shipDate->format('Y-m-d'),

Then it works.

24 Jul 2023, 6:50 PM
#20
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,973
Plugin Contributions:
8

Re: FedEx Shipping using REST API

njcyx:

Hi @carlwhat, I just tested your suggested code. Unfortunately, I received the following error:

PHP Parse error: syntax error, unexpected '(', expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$'

I did some study and test. If I changed the last line as your suggested into:

'shipDateStamp' => $shipDate->format('Y-m-d'),

Then it works.

sorry about that. but yes that is the way to do it. not sure how i screwed that up. but glad you got that working.

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.