Riparian Posted November 24, 2011 Share Posted November 24, 2011 Hi... have looked far and wide without success. Can someone point me in the right direction to learn how to dynamically display a price as the client adds/subtracts items from a shopping cart without refreshing the page ? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/251708-dynamic-display-price/ Share on other sites More sharing options...
btellez Posted November 24, 2011 Share Posted November 24, 2011 Sounds like you want to use some Asynchronous Page Requests. (Ajax) Quote Link to comment https://forums.phpfreaks.com/topic/251708-dynamic-display-price/#findComment-1290880 Share on other sites More sharing options...
ManiacDan Posted November 24, 2011 Share Posted November 24, 2011 Or just plain old javascript, if your product catalog is relatively small. One question though: How are they altering the cart without reloading the page? Quote Link to comment https://forums.phpfreaks.com/topic/251708-dynamic-display-price/#findComment-1290884 Share on other sites More sharing options...
pocetong Posted November 24, 2011 Share Posted November 24, 2011 use Ajax Quote Link to comment https://forums.phpfreaks.com/topic/251708-dynamic-display-price/#findComment-1290885 Share on other sites More sharing options...
Riparian Posted November 24, 2011 Author Share Posted November 24, 2011 Thanks for the advice... I have started looking into ajax but I would have thought javascript would have handled it (not that I know js very well at all). To answer ManiacDan I think I may have mislead things. I was hoping to have one field for quantity. The user inputs the quantity and on mouseout the total price is updated on the screen without re-loading. On moving to checkout the database is updated. Cheers Quote Link to comment https://forums.phpfreaks.com/topic/251708-dynamic-display-price/#findComment-1290891 Share on other sites More sharing options...
ManiacDan Posted November 25, 2011 Share Posted November 25, 2011 Updating the quantity and having that update your subtotal is very simple javascript, just register a function to onchange that recalculates the total from the form and updates the span (or whatever). A normal form post can submit to the database when they move on to checkout. AJAX is unnecessary here. -Dan Quote Link to comment https://forums.phpfreaks.com/topic/251708-dynamic-display-price/#findComment-1291049 Share on other sites More sharing options...
Riparian Posted November 25, 2011 Author Share Posted November 25, 2011 Thank for the insight. It wiuld be greatly appreciated if anyone knows where I could find an example of what ManiacDan is suggesting ? Scale 1-10 on js I am about 0.9 Cheers Quote Link to comment https://forums.phpfreaks.com/topic/251708-dynamic-display-price/#findComment-1291242 Share on other sites More sharing options...
PFMaBiSmAd Posted November 26, 2011 Share Posted November 26, 2011 Examples can be found posted all over the Internet. Search for - javascript calculate form fields Quote Link to comment https://forums.phpfreaks.com/topic/251708-dynamic-display-price/#findComment-1291261 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.