Impossible to add a product to the cart if quantity is the same

  • Posts: 33
  • Thank you received: 2
2 years 3 weeks ago #340456

-- HikaShop version -- : 4.5.0
-- Joomla version -- : 3.10.6
-- PHP version -- : 7.4.28

In previous version of Hikashop a user could 'add' to his cart, now we can only 'change' the qty in the cart.
Previously when a user want to add a product to the cart for a product which he added already in the cart, the system was adding to the quantity.

Example:
The user placed product 123 in his cart for a quantity of 10.
When he added again another 10 in his cart, the cart would show a total qty of 20.

Current behaviour:
If he wants to add another 10 in his cart, the system is saying: 'product not added to the cart'
If he selects a different amount, example 25, the system will change the cart qty to 25. (and he can no longer add an additional qty of 25)

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

  • Posts: 81509
  • Thank you received: 13064
  • MODERATOR
2 years 3 weeks ago #340461

Hi,

In the latest version of HikaShop, we've added a setting "Synchronized add to cart" in the HikaShop configuration page.
That setting changes the behavior of the add to cart to what you describe if turned on.
So make sure that it's turned off, as it should be by default, and it will work like you want.

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

  • Posts: 33
  • Thank you received: 2
2 years 3 weeks ago #340484

My "Synchronized add to cart" is set to NO

The behavior is not as expected. With the latest version it went from a 'ADD to cart' to a 'CHANGE the cart QTY' concept.

Can you please have a validation from your side.

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

  • Posts: 33
  • Thank you received: 2
2 years 3 weeks ago #340530

userID and passw provided through private message

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

  • Posts: 81509
  • Thank you received: 13064
  • MODERATOR
2 years 3 weeks ago #340547

Hi,

Thanks for the accesses.
I think I know what is the issue.
It must come from the line:

<input type="hidden" name="add" value="<?php !$this->config->get('synchronized_add_to_cart', 1); ?>"/>
which should be:
<input type="hidden" name="add" value="<?php !$this->config->get('synchronized_add_to_cart', 0); ?>"/>
in the file components/com_hikashop/views/product/tmpl/add_to_cart_listing.php
Because of that, as long as you don't save once the configuration page with that setting "Synchronized add to cart" turned off, this piece of the code will think that the setting is activated and thus the add to cart on listings will try to replace the quantity of the product in the cart instead of adding to it.
So you have three solutions:
- save the HikaShop configuration once
- change that line of code
- download HikaShop's latest version install package on our website and install it on yours to get the patch.

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

  • Posts: 33
  • Thank you received: 2
2 years 2 weeks ago #340569

Hi Nicolas. Thanks for looking into this.
I could try two of your offered solutions but they are not successful.
1.
I already had done a configuration save.
2.
I could not find the code in add_to_cart_listing.php, I did find it in add_to_cart_ajax.php
After changing the code as instructed, the issue still remains.

3.
I can not install the patch for the moment. Need to wait for the weekend. Anyway, not sure if it will bring a fix based on the above.

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

  • Posts: 81509
  • Thank you received: 13064
  • MODERATOR
2 years 2 weeks ago #340574

Hi,

Thanks for the feedback. I had forgotten a piece of code !
This line should be:

<input type="hidden" name="add" value="<?php echo !$this->config->get('synchronized_add_to_cart', 0); ?>"/>

And yes, it should be in add_to_cart_ajax

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

  • Posts: 33
  • Thank you received: 2
2 years 2 weeks ago #340588

Ok. Thanks Nicolas.
Works now as expected.

The following user(s) said Thank You: nicolas

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

Time to create page: 0.068 seconds
Powered by Kunena Forum