1
On a site I have a button "more" and "less" to change the amount of an item in the cart, only the item is updated when you click. If the client clicks 10 times in a row, 10 requests are made, and the server takes time to execute all the processes and then gives timeout. I need to be able to click as many times as I want on the button to increase the amount, and then when I stop clicking, after 2 seconds, update the values, making only one request.
How can I do that?
Is it really necessary to request the server only to modify the amount of a product? You cannot get the data for calculation in the html page itself, using javascript?
– Daniel Omine
It couldn’t be a simple mai thing, like this: Example in jsfiddle, after all, why request on the server, if you can limit the amount of items in an input of type number?
– Ivan Ferrer
Daniel Omine and Ivan Ferrer, get in the cart and see and test this feature by clicking several times on the increase and decrease number of these sites Mickey.com.br and vestindoamesa.com.br, tells me in Ql of them your experience as a user is better.. It’s bad the way it is, but it has to be whimsical.. i n store the cart data in the cookie, save in the bank, because my system has a part of purchases in abandonment or withdrawal, where the shopkeeper can send an email to the customer warning about the purchase..
– Gregory Iyama
@Daniel Omine msg d up
– Gregory Iyama
@Ivan Ferrer msg above
– Gregory Iyama
@Gregoryiyama, back in the same question, you do not need to record this in the bank, the experience was better on www.mickey.com.br, much faster, although when you give a refresh, it does not keep the amount, however this could be solved through
setTimeout()
+sessionStorage
orlocalStorage
. orsession
even from PHP. Quitting and quitting can be saved when the session expires.– Ivan Ferrer
You don’t have to record withdrawal every click... record in the session the items he took... every time. And every minute, saved in the bank the list items, you can do it asynchronously, as you can also do it in other ways like cron, etc... it’s better than in the user click experience.
– Ivan Ferrer
@Gregoryiyama, you know you can monitor the page that is being accessed on
realtime
When you have a connected user, that’s how chats work. You can do this on the cart screen too, and when the screen closes, you can also know that the user has abandoned. Just another option.– Ivan Ferrer