Hikabtn/cart won't work on products with options

  • Posts: 1027
  • Thank you received: 11
  • Hikashop Business
3 years 3 months ago #328023

Hi.If you go to the link I provided and click on the product button (shown in the picture), it doesn't redirect me to the product page as it should. The button works with products that don't have characteristics. The products, in that case, are directly added to the cart. Any idea what could be wrong?

We've temporarily fixed the issue with a script, but I've disabled it so you can see the issue we're facing as well.

Here's the script:

This message contains confidential information


This message contains confidential information

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

  • Posts: 81484
  • Thank you received: 13062
  • MODERATOR
3 years 3 months ago #328029

Hi,

When I click on that button and look at the developer's network tool, I can see this:
monosnap.com/file/De65tt9pJDdFX6zcUw9lgQOV6pCpyJ
So first there is a request to the product page initiated by the click on the button.
However, while the product page is being loaded by the browser, there is a second request to the listing page which cancels the first request to the product page. This second request originates from a setTimeout function call binded on a event on the button.
And the setTimeout is not in an external javascript file but directly inline.
So I looked at the HTML on that page and I can see this code:
monosnap.com/file/PyTjBxi2v7zdTIP0Tjd2K0WIGxgxtk
This code does exactly what you don't want the button to do. It refreshes the current page when a button with the class hikacart is clicked on (and the button you're talking about has that class).
So I don't know why that javascript was added on the page (it's not in HikaShop by default), but that code needs to be adapted.

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

  • Posts: 1027
  • Thank you received: 11
  • Hikashop Business
3 years 3 months ago #328099

The script you're seeing there was written by our programmer because we were facing another issue. I've disabled it now so it fixed the button, but when adding a product to cart, the number of products in the cart (if you look at the little icon number above) doesn't change to display the number of products. Do you think we can find a solution to that?

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

  • Posts: 81484
  • Thank you received: 13062
  • MODERATOR
3 years 3 months ago #328103

Hi,

Sure. The issue comes from the customization of the cart module that you have.
If you rename the file templates/YOUR_TEMPLATE/html/com_hikashop/product/cart.php it will deactivate your view override of the cart module, and you'll see the cart module being refreshed.
In your view override, you're missing HTML and javascript code to plug the module to the add to cart system.
Either you've based yourself on an old version of the view file which didn't support the AJAX add to cart system, or the way the customization was done removed the necessary HTML / js in there.

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

Time to create page: 0.064 seconds
Powered by Kunena Forum