QTpro

Fatal Error Uncaught Type Error array_key_exists - QTpro

Fatal Error Uncaught Type Error array_key_exists

by artfulweb » Tue Sep 27, 2022 10:19 am

Hello,
Using QTPro v 7.4.5 with Phoenix 1.0.8.18 I am getting the following error (note that the order is registered in admin but the email does not generate as the customer's checkout process page goes blank upon paying when there are several options chosen. Products with one option only do not generate the error and the email is sent).
===========
PHP Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, null given in /xx/xx/xx/catalog/templates/override/includes/hooks/shop/siteWide/qtPro.php:85
Stack trace:
#0 /xx/xx/xx/catalog/includes/system/versioned/1.0.8.1/hooks.php(150): hook_shop_siteWide_qtPro->listen_update_stock_qtpro(Array)
#1 /xx/xx/xx/catalg/includes/system/versioned/1.0.8.1/hooks.php(133): hooks->cat('afterStart', Array)
#2 /xx/xx/xx/catalog/includes/classes/magic/pipeline_surface.php(16): hooks->register_pipeline('after', Array)
#3 /xx/xx/xx/catalog/includes/system/versioned/1.0.8.1/hooks.php(160): pipeline_surface->__call('after', Array)
#4 /xx/xx/xx/catalog/includes/system/segments/checkout/pipeline.php(14): hooks->generate('startCheckout')
#5 /xx/xx/xx/catalog/checkout_process.php(15): require('/homepages/35/d...')
#6 {main}
thrown in /xx/xx/xx/catalog/templates/override/includes/hooks/shop/siteWide/qtPro.php on line 85
artfulweb
VIP Member
VIP Member
Posts: 119
Joined: Thu Oct 29, 2020 12:34 pm
Contact:

Re: Fatal Error Uncaught Type Error array_key_exists

by raiwa » Wed Sep 28, 2022 6:53 am

Hi,

I suppose this happens when the product has a non stocked attribute.
Please try changing in templates\override\includes\hooks\shop\siteWide\qtPro.php line 85 to:

Code: Select all

            if ( is_array($attributes_stock_array) && array_key_exists($attribute_comb, $attributes_stock_array) ) {
and report back. I'll then update the package.

Best wishes
Rainer
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
raiwa
PhoenixCart Developer
PhoenixCart Developer
Posts: 1184
Joined: Sat Dec 21, 2019 8:08 am
Contact:

Re: Fatal Error Uncaught Type Error array_key_exists

by artfulweb » Wed Sep 28, 2022 10:50 am

raiwa wrote:Hi,

I suppose this happens when the product has a non stocked attribute.
Please try changing in templates\override\includes\hooks\shop\siteWide\qtPro.php line 85 to:

Code: Select all

            if ( is_array($attributes_stock_array) && array_key_exists($attribute_comb, $attributes_stock_array) ) {
and report back. I'll then update the package.

Best wishes
Rainer

Hi Rainer,
That worked! Thanks so much. Have a great day.
artfulweb
VIP Member
VIP Member
Posts: 119
Joined: Thu Oct 29, 2020 12:34 pm
Contact:

Re: Fatal Error Uncaught Type Error array_key_exists

by raiwa » Wed Sep 28, 2022 3:48 pm

Thank You.
Uploaded update 7.4.6. with the above and some other fixes.
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
raiwa
PhoenixCart Developer
PhoenixCart Developer
Posts: 1184
Joined: Sat Dec 21, 2019 8:08 am
Contact: