Version 1.1 is now available with the fixes from @njcyx for International Shipping.
Printable View
Version 1.1 is now available with the fixes from @njcyx for International Shipping.
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?
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-u...ransit%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.
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');
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
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.Code:[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.
Fix it just like the line below it. Use ?? ''
$street_address = $order->delivery['street_address'] ?? '';
Version 1.2 is now out with some improvements from community members @retched and @njcyx.
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?