Ajax Error When Adding Products to the Shopping Cart

  • Posts: 37
  • Thank you received: 4
  • Hikashop Essential
4 years 3 months ago #327225

-- HikaShop version -- : 4.4.0
-- Joomla version -- : 3.9.23
-- PHP version -- : 7.4.13
-- Browser(s) name and version -- : Firefox 83.0
-- Error-message(debug-mod must be tuned on) -- : cart_id was not returned in addToCart AJAX call hikashop.js:1134:13
null hikashop.js:1135:13

I am now receiving this error on one of my sites when trying to place items in the shopping cart:

cart_id was not returned in addToCart AJAX call hikashop.js:1134:13
null hikashop.js:1135:13

The error message is shown in the Console tab of the Web Developer tools in Firefox and Google Chrome browsers.

My problem is similar to:

Ajax error when I add a prouct with options in the cart
and
Erreur Javascript panier

I can't determine from those two threads how to solve my problem. I have a two test sites that both work as expected and do not exhibit the error. One is on a LAMP installation on my own desktop computer. The other is on the fptest subdomain on my client's hosting account. Only the public site has the error.

I have compared the configuration among the sites but can't see the reason for the error. I have reinstalled the HikaShop software but the error persists.

The site was working before as expected. The last successful order was entered three days ago. At about that time I upgraded the PHP version of both the public and the fptest site. They are both at version 7.4.13.

What shall I do to diagnose this error?

By the way, I'm also seeing the following warnings on the problem site in my Firefox browser:
Some cookies are misusing the recommended “SameSite“ attribute 2
Cookie “hikashop_cart_id” will be soon rejected because it has the “SameSite” attribute set to “None” or an invalid value, without the “secure” attribute. To know more about the “SameSite“ attribute, read https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite order
Cookie “hikashop_cart_session_id” will be soon rejected because it has the “SameSite” attribute set to “None” or an invalid value, without the “secure” attribute. To know more about the “SameSite“ attribute, read https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite order
This page uses the non standard property “zoom”. Consider using calc() in the relevant property values, or using “transform” along with “transform-origin: 0 0”. order


Charles
Last edit: 4 years 3 months ago by cmb. Reason: Added [SOLVED] to the subject.

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

  • Posts: 26205
  • Thank you received: 4032
  • MODERATOR
4 years 3 months ago #327237

Hello,

Please do not display PHP errors/warning messages to your users.
Here the content of the ajax call :

{"ret":128,"product_name":"Alba....","quantity":1,"image":"\/images\/com_hikashop\/upload\/thumbnails\/50x50\/alba.....jpg"}
Deprecated: Directive 'allow_url_include' is deprecated in Unknown on line 0
Which make the JSON invalid for the rest of the script.
You can find the exact same content at the end of all of your website pages ; it's not coming from HikaShop but from your PHP configuration itself ( www.php.net/manual/filesystem.configuration.php )

Please note that displaying PHP errors to final users is considered as a security breach since everybody can have some error debug details of your website.
HikaShop do skip external content while processing ajax call pages but it cannot avoid such error messages which comes from your PHP engine itself and which force its display in the output buffer.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: cmb

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

  • Posts: 37
  • Thank you received: 4
  • Hikashop Essential
4 years 3 months ago #327288

Jerome wrote: Please do not display PHP errors/warning messages to your users.


I had blindly trusted the Joomla Administrator > System > PHP Information listing of display_errors that reported it was Off. At your prompting, I examined the php.ini file in the site root. There I found display_errors set to On! That's now edited. Once again customers can place items in the shopping cart

Thank you, Jerome.


Charles

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

Time to create page: 0.067 seconds
Powered by Kunena Forum