hikashop - automatic update of the total amount of the shopping cart at checkout

  • Posts: 127
  • Thank you received: 3
3 years 2 months ago #328824

-- url of the page with the problem -- : www.abierto.uy/
-- HikaShop version -- : 4.4.0
-- Joomla version -- : 3.9.24
-- PHP version -- : 7.3

Hello

Is it possible that the purchase checkout automatically updates the total amount of the purchase when the number of units of the product is modified, without having to click on the update button?
Reviewing the code, I see that the quantity textbox has a scheduled onclick event, but it seems that they do not have the functionality to update the purchase amount.

Many thanks, greetings!

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

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
3 years 2 months ago #328828

Hi,

In the file show_block_cart.php, that you can edit via the menu Display>Views, you'll find this piece of javascript code:
window.hikashop.checkQuantity(this);
That's what you have in the "onchange" attribute of the quantity input field in the cart view of the checkout.
So you can add after it such code:

if (this.value != \''.$product->cart_product_quantity.'\'){'.$input.'return window.checkout.submitCart('.$this->step.','.$this->module_position.'); }
That will refresh the cart view.
Note however that it is in an onchange event.
So after you changed the value, you need to click elsewhere to validate the change. Otherwise, if we were submitting the data as you type, you wouldn't be able to enter numbers higher than 9 in it as it would submit the data right after you pressed the first digit.
Or it would require a waiting time, but it could be different from one person to another.
So it's better to have it on "onchange" I believe.
In fact, the code modification I'm proposing above is what will be in the next version of HikaShop.

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

Time to create page: 0.063 seconds
Powered by Kunena Forum