Ship In Cart
Error when country is not listed. - Ship In Cart
Error when country is not listed.
1.0.8.0 PHP 7.4 Ship in cart 5.6
Works perfectly until customer selects a country that I do not have listed in Zones based rates. I get on shopping_cart.php The core code correctly shows the "We do not ship...etc"
Notice: Trying to access array offset on value of type bool in D:\Phoenix_1_0_8_0\htdocs\includes\modules\content\shopping_cart\cm_sc_shipping.php on line 227
Notice: Trying to access array offset on value of type bool in D:\Phoenix_1_0_8_0\htdocs\includes\modules\content\shopping_cart\cm_sc_shipping.php on line 228
Notice: Trying to access array offset on value of type bool in D:\Phoenix_1_0_8_0\htdocs\includes\modules\content\shopping_cart\cm_sc_shipping.php on line 229
Notice: Trying to access array offset on value of type bool in D:\Phoenix_1_0_8_0\htdocs\includes\modules\order_total\ot_shipping.php on line 48
Notice: Trying to access array offset on value of type bool in D:\Phoenix_1_0_8_0\htdocs\includes\modules\order_total\ot_shipping.php on line 48
Notice: Trying to access array offset on value of type bool in D:\Phoenix_1_0_8_0\htdocs\includes\modules\content\shopping_cart\templates\tpl_cm_sc_shipping.php on line 8
Works perfectly until customer selects a country that I do not have listed in Zones based rates. I get on shopping_cart.php The core code correctly shows the "We do not ship...etc"
Notice: Trying to access array offset on value of type bool in D:\Phoenix_1_0_8_0\htdocs\includes\modules\content\shopping_cart\cm_sc_shipping.php on line 227
Notice: Trying to access array offset on value of type bool in D:\Phoenix_1_0_8_0\htdocs\includes\modules\content\shopping_cart\cm_sc_shipping.php on line 228
Notice: Trying to access array offset on value of type bool in D:\Phoenix_1_0_8_0\htdocs\includes\modules\content\shopping_cart\cm_sc_shipping.php on line 229
Notice: Trying to access array offset on value of type bool in D:\Phoenix_1_0_8_0\htdocs\includes\modules\order_total\ot_shipping.php on line 48
Notice: Trying to access array offset on value of type bool in D:\Phoenix_1_0_8_0\htdocs\includes\modules\order_total\ot_shipping.php on line 48
Notice: Trying to access array offset on value of type bool in D:\Phoenix_1_0_8_0\htdocs\includes\modules\content\shopping_cart\templates\tpl_cm_sc_shipping.php on line 8
- mhsuffolk
- Contributor
- Posts: 199
- Joined: Sat Oct 26, 2019 9:13 am
- Phoenix Version: v1.1.0.6
- Contact:
Re: Error when country is not listed.
Thanks, I‘ll check it.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
-
raiwa
- Certified Developer
- Posts: 1640
- Joined: Sat Dec 21, 2019 8:08 am
- Phoenix Version: 1.1.0.6
- : Buy Me A Beverage
- Contact:
Re: Error when country is not listed.
Hi @mhsuffolk,
It seems you are using one of the multi zone modules. The core zone module works correct.
Can you please post the complete package you are using, I'll then research.
Anyway the error is strange, $selected_shipping is correct defined as an array.
It seems you are using one of the multi zone modules. The core zone module works correct.
Can you please post the complete package you are using, I'll then research.
Anyway the error is strange, $selected_shipping is correct defined as an array.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
-
raiwa
- Certified Developer
- Posts: 1640
- Joined: Sat Dec 21, 2019 8:08 am
- Phoenix Version: 1.1.0.6
- : Buy Me A Beverage
- Contact:
Re: Error when country is not listed.
Just checked this multi zone module and it works error free:
https://apps.oscommerce.com/osvz6&multi ... ipping&p=2
https://apps.oscommerce.com/osvz6&multi ... ipping&p=2
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
-
raiwa
- Certified Developer
- Posts: 1640
- Joined: Sat Dec 21, 2019 8:08 am
- Phoenix Version: 1.1.0.6
- : Buy Me A Beverage
- Contact:
Re: Error when country is not listed.
Strange, I am not using any addon for zones, just the core one.
Is it because the country that I have not listed in the zones module is still in the countries table, that is I have not deleted them?
I have Tax Class set to none and am using 4 zones. The same set up works OK in my live store on 1.0.5.0 PHP 7.3
Is it because the country that I have not listed in the zones module is still in the countries table, that is I have not deleted them?
I have Tax Class set to none and am using 4 zones. The same set up works OK in my live store on 1.0.5.0 PHP 7.3
- mhsuffolk
- Contributor
- Posts: 199
- Joined: Sat Oct 26, 2019 9:13 am
- Phoenix Version: v1.1.0.6
- Contact:
Re: Error when country is not listed.
O.K. I could recreate it now knowing that it shows when no shipping is available at all.
Even it shows in the shipping estimator, the root of the problem is in the shipping class which returns null instead of an empty array for "$shipping_modules->cheapest()" when no shipping is available.
In the shipping estimator cm_sc_shipping.php it could be catched in line 227-229 like this:
and in the template tpl_cm_sc_shipping.php line 8 like this:
But then there would still show errors in the ot_shipping.php module. This is not covered in core because in checkout_confirmation.php, where the order total modules show in the c ore prcheckout process, it's supposed a valid shipping module is always selected.
So this would need to be fixed in core files.
However, as you say, another aproach would be to leave in the countries table only countries for which shipping is available.
And: These are "only" notice errors.
Even it shows in the shipping estimator, the root of the problem is in the shipping class which returns null instead of an empty array for "$shipping_modules->cheapest()" when no shipping is available.
In the shipping estimator cm_sc_shipping.php it could be catched in line 227-229 like this:
Code: Select all
$order->info['shipping_method'] = $selected_shipping['title'] ?? '';
$order->info['shipping_cost'] = $selected_shipping['cost'] ?? '0';
$order->info['total']+= $selected_shipping['cost'] ?? '0';
Code: Select all
<?= tep_draw_form('estimator', tep_href_link('shopping_cart.php', '', 'NONSSL'), 'post') . tep_draw_hidden_field('sid', $selected_shipping['id'] ?? '') ?>
So this would need to be fixed in core files.
However, as you say, another aproach would be to leave in the countries table only countries for which shipping is available.
And: These are "only" notice errors.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
-
raiwa
- Certified Developer
- Posts: 1640
- Joined: Sat Dec 21, 2019 8:08 am
- Phoenix Version: 1.1.0.6
- : Buy Me A Beverage
- Contact:
Re: Error when country is not listed.
Thank you @raiwa.
I have tried your changes in my 1.0.8.0 test shop and all those error messages have gone, the message in your addon saying we do not ship there is present and correct, however we now have a new error message.
Notice: Trying to access array offset on value of type bool in D:\Phoenix_1_0_8_0\htdocs\includes\modules\order_total\ot_shipping.php on line 48
Notice: Trying to access array offset on value of type bool in D:\Phoenix_1_0_8_0\htdocs\includes\modules\order_total\ot_shipping.php on line 48
Regarding your earlier comments do you think that core should be changed to cope with this scenario?
I have tried your changes in my 1.0.8.0 test shop and all those error messages have gone, the message in your addon saying we do not ship there is present and correct, however we now have a new error message.
Notice: Trying to access array offset on value of type bool in D:\Phoenix_1_0_8_0\htdocs\includes\modules\order_total\ot_shipping.php on line 48
Notice: Trying to access array offset on value of type bool in D:\Phoenix_1_0_8_0\htdocs\includes\modules\order_total\ot_shipping.php on line 48
Regarding your earlier comments do you think that core should be changed to cope with this scenario?
- mhsuffolk
- Contributor
- Posts: 199
- Joined: Sat Oct 26, 2019 9:13 am
- Phoenix Version: v1.1.0.6
- Contact:
Re: Error when country is not listed.
That's a question for the lead developers: @ecartz, @burt ?Regarding your earlier comments do you think that core should be changed to cope with this scenario?
In a clean core scenario the error situation will not be given. However a fix is only possible (as far as I can see) in core files.
As mentioned, the other approach is to leave in the database only countries for which shipping is available. This would also be good for the create account form. It doesn't make sense to allow creating accounts with countries to which you do not ship.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
-
raiwa
- Certified Developer
- Posts: 1640
- Joined: Sat Dec 21, 2019 8:08 am
- Phoenix Version: 1.1.0.6
- : Buy Me A Beverage
- Contact:
Re: Error when country is not listed.
raiwa wrote:Very good point, I will start deleting countries.It doesn't make sense to allow creating accounts with countries to which you do not ship.
- mhsuffolk
- Contributor
- Posts: 199
- Joined: Sat Oct 26, 2019 9:13 am
- Phoenix Version: v1.1.0.6
- Contact: