PHP Warning: Undefined array key col.xs4.sm3.md3 in items_grid.php (Phoca Cart 6.1.1)

Phoca Cart - complex e-commerce extension
getulio
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 04 Jan 2024, 01:54

PHP Warning: Undefined array key col.xs4.sm3.md3 in items_grid.php (Phoca Cart 6.1.1)

Post by getulio »

Hello Jan and Phoca Team,
I would like to report a minor PHP Warning found in Phoca Cart version 6.1.1 running on Joomla 5.
Error message:
Warning: Undefined array key col.xs4.sm3.md3 in /components/com_phocacart/layouts/items_grid.php on line 31

With afraid upgrade to joomla 6, despite o S.O. to be with php, mysql,... all upgraded. As well there are others extensions.
I'm analising carefully.

In this moment, I change:
(Error Reporting) do Joomla, of "Máximum" to "System Default".
The error isn't to be diplayed more, but maybe can to be corrected.

Thank you for your amazing work on this extension!
getulio
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 04 Jan 2024, 01:54

Re: PHP Warning: Undefined array key col.xs4.sm3.md3 in items_grid.php (Phoca Cart 6.1.1)

Post by getulio »

Hello, newly
The AI suggest

Replace the null coalescence operator call (??) of PHP, OR for a verification with isset(),
warrant that a default value to be assumed, if the key not exist

// Replace the problem slice for:
$coluna = isset($seuArray['col.xs4.sm3.md3']) ? $seuArray['col.xs4.sm3.md3'] : '';
// OR using the form shorter (Null Coalescing):
$coluna = $seuArray['col.xs4.sm3.md3'] ?? '';
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49490
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: PHP Warning: Undefined array key col.xs4.sm3.md3 in items_grid.php (Phoca Cart 6.1.1)

Post by Jan »

Hi, thank you for the info, there was wrongly set default value on one place, it will be fixed in next version.

For now, go to Phoca Cart Options and just save them, it should help as right value will be set.

Jan
If you find Phoca extensions useful, please support the project
Post Reply