Disable enter on checkout page

  • Posts: 12
  • Thank you received: 0
4 years 4 days ago #326153

-- HikaShop version -- : 4.4
-- Joomla version -- : 3.9.22
-- PHP version -- : 7.3

I create custom shipping method.
It contains form which show on checkout page.
After filled field and then press a key 'enter' the filled value is cleared.
How to disable update on enter for shipping method block?
The shipping value will be updated after trigger click on radio button only.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
4 years 4 days ago #326155

Hi,

In the file media/com_hikashop/js/checkout.js you have the function handleEnter which does that.
In the view file checkout / show.php that you can edit via the menu Display>Views, you can see that this handleEnter function is called for each block displayed on the checkout.
So you could add a condition there to remove the call to handleEnter so that it is not initialized on the fields of the shipping block.
Now, in the refreshBlock and submitBlock functions of the checkout.js you also have a call to handleEnter in order to reattach the listener to the inputs when a block of the checkout is refreshed in AJAX.
So I think a simpler approach would be to edit checkout / show.php and keep the calls to handleEnter and add additional javascript to redefine the handleEnter function like that:

<script>
window.checkout.handleEnter = function(task, step, pos) {
  ... copy / paste the code from the original handleEnter function and adapt it to skip when the block is the shipping block...
}
</script>

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

Time to create page: 0.056 seconds
Powered by Kunena Forum