Product Export Undefined Array Key Error

  • Posts: 42
  • Thank you received: 4
  • Hikashop Essential
3 days 9 hours ago #366420

-- HikaShop version -- : 5.1.5
-- Joomla version -- : 4.4.12
-- PHP version -- : 8.2.27
-- Browser(s) name and version -- : Firefox 136.0.4
-- Error-message(debug-mod must be tuned on) -- : No system error messages are displayed.

In Products when I try to Export, I receive these error messages:

Warning: Undefined array key 0 in .../administrator/components/com_hikashop/views/product/tmpl/export.php on line 163
Warning: Attempt to read property "currency_code" on null in .../administrator/components/com_hikashop/views/product/tmpl/export.php on line 163
Warning: Cannot modify header information - headers already sent by (output started at .../administrator/components/com_hikashop/views/product/tmpl/export.php:163) in .../administrator/components/com_hikashop/helpers/spreadsheet.php on line 82
Warning: Cannot modify header information - headers already sent by (output started at .../administrator/components/com_hikashop/views/product/tmpl/export.php:163) in .../administrator/components/com_hikashop/helpers/spreadsheet.php on line 83

How can I repair the Export function and download the spreadsheet?


Charles

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

  • Posts: 83512
  • Thank you received: 13511
  • MODERATOR
3 days 14 minutes ago #366421

Hi,

This error indicates that for at least one price of a product , the currency that was selected when the price was saved does not exist anymore in your HikaShop database.
This should not happen normally.

I've made a patch to avoid the error and instead log a message in the "payment log file" of the HikaShop configuration. That way, you can get your export file without the error, and by looking at the log, you can see which product / price / currency are affected so that you can potentially deal with it.
Download the install package of HikaShop on our website and install it on yours to get the patch.

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

  • Posts: 42
  • Thank you received: 4
  • Hikashop Essential
2 days 16 hours ago #366426

I installed the new version of HikaShop and was again able to Export the spreadsheet.

nicolas wrote: I've made a patch to avoid the error and instead log a message in the "payment log file" of the HikaShop configuration.

Unfortunately there is no indication that a log file was created. It would be beneficial if the Administrator was notified.
Apparently logging is enabled on my site. Is there some page of the documentation that describes how to find the file from the HikaShop Dashboard?
With some guidance from ChatGPT, I located the report_834224664.log in the /media/com_hikashop/upload/safe/logs directory. At the end of that file I found these lines:
<h3>03.29.25 07:55:03 - export</h3>
currency with id 0 not found for price with id 8574 for product with id 181
<h3>03.29.25 07:55:03 - export</h3>
currency with id 0 not found for price with id 8575 for product with id 182

I opened those two products and edited the Prices and Taxes section. Saving the products apparently corrected the errors.


Charles

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

  • Posts: 83512
  • Thank you received: 13511
  • MODERATOR
2 days 39 minutes ago #366437

Hi,

The log file can be accessed under the Files section of the HikaShop configuration:
www.hikashop.com/support/documentation/5...nfig.html#main_files
Whenever HikaShop, or one of its plugins needs to log something, it adds it to that log.

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

  • Posts: 42
  • Thank you received: 4
  • Hikashop Essential
1 day 18 hours ago #366439

Now that the error that is the subject of this thread is no longer shown to the website Administrator but is logged instead, the item that created the error might not be noticed. As a future enhancement I suggest that a flag or notice of some kind be shown to the website Administrator prompting that person to check for a new entry in the Payment Log File.
Perhaps the Administrator should also be given the option of deleting the Payment Log File once it is reviewed.


Charles

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

  • Posts: 83512
  • Thank you received: 13511
  • MODERATOR
23 hours 56 minutes ago #366443

Hi,

Thank you for your feedback.
Adding a message on the screen is not possible.
When an export is done, the file is sent back to the browser for it to trigger the file download process (which opens the dialog box for the user to save the file where he wants on his computer). As far as I know, it is not technically possible to return to the browser something else than the file at the same time in order to display a message.
The only option would be to cancel the export to display the error message. Basically, what was already happening before, but with a nicer message. I think the error is minor enough (the currency column just won't have anything in it for these products in the exported file), and rarer enough (no one else reported the problem in 15 years even though that potential error was always there and clearly blocking as the error couldn't be bypassed. So if someone else would have had the problem, they would have definitely reported it), that it is not that big of a deal to not let the user know directly about the problem and block him from getting his export file.
That's why I decided to log an error and let the export proceed.

Regarding the log files, we don't want to delete anything normally. Sometimes, you want to be able to look at the logs weeks after something happened. And if the administrator really wants to delete them, he can do so via FTP. So I'm not sure if we want to offer that capability. We'll see. Thanks for your input.

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

Time to create page: 0.054 seconds
Powered by Kunena Forum