Product Not Added to the Cart

  • Posts: 75
  • Thank you received: 7
  • Hikashop Business
3 years 1 month ago #330359

-- HikaShop version -- : 4.4.1
-- Joomla version -- : 3.9.25
-- PHP version -- : 7.3.27
-- Browser(s) name and version -- : Firefox

I've got a similar issue to this thread:

www.hikashop.com/forum/checkout/902071-p...to-cart-cookies.html

where we try to add to the cart and it says "Product not added to the cart" with a tan error message instead of the blue success pop-up message.

I do notice that if I use the Moonsoft Calc Builder to get the quantity then it will add the product to the cart successfully.

If I type in the quantity or use the plus/minus buttons then I will get the tan error message.

My error says nothing about cookies, but could this be the same thing?

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

  • Posts: 81478
  • Thank you received: 13062
  • MODERATOR
3 years 1 month ago #330373

Hi,

It's not the same issue.
Now I'm not sure what is your issue.
I'm not able to access your URL. I always get redirected to your homepage when I try to access it. And thus I can't check the situation. Could you provide precise instructions to reproduce the problem ?
Also, it would be great if you could provide a screenshot of the settings of the corresponding product.

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

  • Posts: 75
  • Thank you received: 7
  • Hikashop Business
3 years 1 month ago #330386

Ok this will get you into the site:

This message contains confidential information


you can actually try it with any product, they all behave the same, but I've included the screenshot of the product settings of the url I provided.

Attachments:

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

  • Posts: 75
  • Thank you received: 7
  • Hikashop Business
3 years 1 month ago #330388

I should also mention that this website is routinely copied back and forth between a staging server, which has it's own domain supplied by the web host.

Not sure if that might have something to do with it either, although we've been doing that for years now with no problem.

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

  • Posts: 81478
  • Thank you received: 13062
  • MODERATOR
3 years 1 month ago #330398

Hi,

I don't see any plus or minus buttons on your page.
And when I click on the "get quantity" button before clicking on the "add to cart" button, it works fine too.
It's only when I directly enter the quantity in the quantity input field that the add to cart button displays the error.
And I think it actually is caused by custom code (or Moonsoft Calc Builder ?).
First, when I click on the "add to cart" button after I entered the quantity myself, I get two AJAX requests.
The first one is sent to calc builder with the correct quantity (10 here):
i.imgur.com/O3RHGZC.png
The second one goes to HikaShop with the quantity set to 0:
i.imgur.com/kFOX9R8.png
However, if I just click on the "add to cart" button, the first AJAX request should not be sent as the calc builder doesn't need to do anything.
So I thing there is some kind of bug in the javascript. If I look at the javascript of the "sendcalculation" function which is called by the "get quantity" button, I can see this:
i.imgur.com/8g7H1C2.png
There, the normal quantity input field is duplicated to the calc builder form, the value from the hiddencalculatedqty hidden input field is set to both fields, and finally the duplicated input field in calc builder is destroyed after being used.
So I suppose that the issue comes from this function being called when pressing the "add to cart" button when it should not. This thus leads in this function updating the quantity input field of HikaShop to 0 and then HikaShop submitting the add to cart AJAX request with that 0 quantity.
Now this is a crude analysis of the situation as I'm not famaliar with that javascript code and I don't have calc builder on my end nor your settings of it and thus can't replicate the situation and add debug code all around that javascript to understand what's going on (without talking about the fact that it's not something we're supposed to look at and I should just direct you back to calc builder's support).

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

  • Posts: 75
  • Thank you received: 7
  • Hikashop Business
3 years 1 month ago #330407

Ok, I will investigate more into calc builder, thanks for all your help.

The following user(s) said Thank You: Philip

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

Time to create page: 0.063 seconds
Powered by Kunena Forum