Undefined Array Key Errors in a Mass Action

  • Posts: 34
  • Thank you received: 4
  • Hikashop Essential
1 month 4 days ago #359992

-- url of the page with the problem -- : Not available online yet.
-- HikaShop version -- : 5.0.3
-- Joomla version -- : 4.4.3
-- PHP version -- : 8.2.16
-- Browser(s) name and version -- : Firefox 124.0.1
-- Error-message(debug-mod must be tuned on) -- : See the thread herein.

I was seeing some unusual results in a Mass Action that I created so in Global Configuration I set System > Debug System > Yes and Server > Error Reporting > Maximum. In some configurations of the Mass Action, the warnings shown below appear.

In nutshell, the Product Mass Action Displays the Results of:
Filters - Characteristics > Alcantara Fabric and Stitching Combinations Contains "with black stitching".

There are four characteristics in the HikaShop database:

  1. Alcantara Fabric and Stitching Combinations (All of the products in this Mass Action have this Characteristic.)
  2. Center Stripe Color (Some but not all of the products in this Mass Action have this Characteristic.)
  3. Leather Fabric and Stitching Combinations (None of the products in this Mass Action have this Characteristic.)
  4. Fabric and Leather Options (None of the products in this Mass Action have this Characteristic.)

Scenario A: Actions > Alcantara Fabric and Stitching Combinations only checked. (Three of four Characteristics not selected.)
Warning: Undefined array key "Center Stripe Color" in /administrator/components/com_hikashop/classes/massaction.php on line 747

Scenario B: Actions > Center Stripe Color only checked. (Three of four Characteristics not selected.)
Warning: Undefined array key "Alcantara Fabric and Stitching Combinations" in /administrator/components/com_hikashop/classes/massaction.php on line 747

Scenario C: Actions > None of the four Characteristics selected.
No Warnings displayed.

It appears that if I choose to display a characteristic for a product I must display all characteristics that might be included. Otherwise a warning is generated and the results might be undefined.

Unless Error Reporting is enabled, the failure is silent.

I would like to have the option to disable the display of some Characteristics. Can these errors be repaired?


Charles

Please Log in or Create an account to join the conversation.

  • Posts: 81563
  • Thank you received: 13071
  • MODERATOR
1 month 4 days ago #359997

Hi,

Thanks for your feedback.
Change the line:

if(!is_object($params->types[$var_name])) $params->types[$var_name] = new stdClass();
to:
if(!isset($params->types[$var_name]) || !is_object($params->types[$var_name])) $params->types[$var_name] = new stdClass();
in the file /administrator/components/com_hikashop/classes/massaction.php and it will remove this warning.
We'll include the change on our end.

Please Log in or Create an account to join the conversation.

Time to create page: 0.060 seconds
Powered by Kunena Forum