Will Posted October 27, 2007 Share Posted October 27, 2007 This is just a small bit of javascript so when users buy something from the shop it works out the total cost there to save the user working it out. Also when you click on the form it removes the default value and if they don't type anything puts it back when they remove focus. NOTE: The money format function isn't mine it was free from some site. Firstly put this (you must keep the ?> <? because it is not php): You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Put it after: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Secondly, put: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. After: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Which replaces: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. It's tested and works so any problems are likly to be yours. You can see it in action on my site, Heres a screen shot: Quote Link to comment Share on other sites More sharing options...
gurpreet Posted October 27, 2007 Share Posted October 27, 2007 Re: [mccode][v1]Automatic total cost calculation in shop buy. Will it work for v2 with the same codes? The only converting from v1-v2 is just the editing stuff and changing to globals... Quote Link to comment Share on other sites More sharing options...
Will Posted October 27, 2007 Author Share Posted October 27, 2007 Re: [mccode][v1]Automatic total cost calculation in shop buy. Yeah. FOR V2: Put the first bit of code under: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. And the second is the same as first. :-D Quote Link to comment Share on other sites More sharing options...
YoungGold Posted October 27, 2007 Share Posted October 27, 2007 Re: [mccode][v1]+[v2]Automatic total cost calculation in shop buy. man this is quite an awesome mod....at first it doesnt seem like much but it would be very helpfulll... nice idea bro.. Quote Link to comment Share on other sites More sharing options...
Will Posted October 27, 2007 Author Share Posted October 27, 2007 Re: [mccode][v1]+[v2]Automatic total cost calculation in shop buy. Thanks. :-D Quote Link to comment Share on other sites More sharing options...
Z?v?? Posted October 27, 2007 Share Posted October 27, 2007 Re: [mccode][v1]+[v2]Automatic total cost calculation in shop buy. This is very nice. The only part I seen that you left out in the instructions for V2 is that you need to delete this part... You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Otherwise you will have duplicates in your shop items list. Quote Link to comment Share on other sites More sharing options...
Will Posted October 28, 2007 Author Share Posted October 28, 2007 Re: [mccode][v1]+[v2]Automatic total cost calculation in shop buy. Good point. I forgot that because I made it then I had to try and remember what it was before to post on here. I have edited the first post because it applies to both versions. Quote Link to comment Share on other sites More sharing options...
Klikoka Posted October 28, 2007 Share Posted October 28, 2007 Re: [mccode][v1]+[v2]Automatic total cost calculation in shop buy. Nice +1 :-D Quote Link to comment Share on other sites More sharing options...
Magictallguy Posted February 7, 2008 Share Posted February 7, 2008 Re: [mccode][v1]+[v2]Automatic total cost calculation in shop buy. And for those who don't understand what to do: The entire shops.php script (for v2) You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Quote Link to comment Share on other sites More sharing options...
Will Posted February 7, 2008 Author Share Posted February 7, 2008 Re: [mccode][v1]+[v2]Automatic total cost calculation in shop buy. That looks right. Quote Link to comment Share on other sites More sharing options...
$$ ?????? $$ Posted February 8, 2008 Share Posted February 8, 2008 Re: [mccode][v1]+[v2]Automatic total cost calculation in shop buy. nice little script will Quote Link to comment Share on other sites More sharing options...
Strats Posted April 12, 2008 Share Posted April 12, 2008 Re: [mccode][v1]+[v2]Automatic total cost calculation in shop buy. I know this is an old post but as I'm gonna use this mod i just have to say thanks Brilliant idea! Quote Link to comment Share on other sites More sharing options...
-Matt- Posted April 12, 2008 Share Posted April 12, 2008 Re: [mccode][v1]+[v2]Automatic total cost calculation in shop buy. Thanks it will be a nice addition to the game :) Quote Link to comment Share on other sites More sharing options...
Spudinski Posted April 12, 2008 Share Posted April 12, 2008 Re: [mccode][v1]+[v2]Automatic total cost calculation in shop buy. Very nice to see that people begin to make use of javascript in websites. (: Keep it going Will... Quote Link to comment Share on other sites More sharing options...
Will Posted April 12, 2008 Author Share Posted April 12, 2008 Re: [mccode][v1]+[v2]Automatic total cost calculation in shop buy. Maybe I'll post me AJAX for viewuser :-D; though it shouldn't be too difficult for someone who knows what they are doing to take. The only problem with JavaScript is that some people don't have it turned on; so any JavaScript has to be done without as well. However is it acceptable to not bother and just use JavaScript for some things? Quote Link to comment Share on other sites More sharing options...
Spudinski Posted April 12, 2008 Share Posted April 12, 2008 Re: [mccode][v1]+[v2]Automatic total cost calculation in shop buy. Not really, a web developer should always take into account the fact that some people do not have javascript enabled. But the average gamer has javascript enabled, and doesn't know of better. I'm not saying to take advantage of that, but it does help with game developing, I have seen a fair share of games that uses javascript for just about everything, and they are doing quite well in doing so. So my verdict on this would be, for games, sure go ahead, equip your game with ajax, and join the realm of web 2.0 websites. Quote Link to comment Share on other sites More sharing options...
John1 Posted May 13, 2008 Share Posted May 13, 2008 Re: [mccode][v1]+[v2]Automatic total cost calculation in shop buy. Changed it so it says Total price under the Qty box just so ppl don't get confused can be seen working on www.real-criminals.info You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Quote Link to comment Share on other sites More sharing options...
~Destiny-Gaming~ Posted May 13, 2008 Share Posted May 13, 2008 Re: [mccode][v1]+[v2]Automatic total cost calculation in shop buy. Very Usefull And Nice Mod Great Thinking Too Put This In An Mccodes Game Keep Up The Work It's A Nice MOD! Quote Link to comment Share on other sites More sharing options...
Joel Posted May 13, 2008 Share Posted May 13, 2008 Re: [mccode][v1]+[v2]Automatic total cost calculation in shop buy. Looks Really good, Ill try it out :) Quote Link to comment Share on other sites More sharing options...
chaoswar4u Posted May 15, 2008 Share Posted May 15, 2008 Re: [mccode][v1]+[v2]Automatic total cost calculation in shop buy. Hi. Ive had this trouble with a few scripts and this one included. Im getting a $end error even when using fully working code people use. Is there a php module that I need to have enabled. This is the only thing I can think of. Before I mess around does anyone have any idea. Many thx in advance for any help anyone can give. Quote Link to comment Share on other sites More sharing options...
Will Posted May 16, 2008 Author Share Posted May 16, 2008 Re: [mccode][v1]+[v2]Automatic total cost calculation in shop buy. Nope, no php module needed as it is not php. The $end error is usually due to not closing all the open brackets. Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted May 16, 2008 Share Posted May 16, 2008 Re: [mccode][v1]+[v2]Automatic total cost calculation in shop buy. Hi. Ive had this trouble with a few scripts and this one included. Im getting a $end error even when using fully working code people use. Is there a php module that I need to have enabled. This is the only thing I can think of. Before I mess around does anyone have any idea. Many thx in advance for any help anyone can give. As for your situation, i would suggest downloading notepad++ opening the file as a .php file then go through all { and wich ever one does not go red, there's your situation. Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted August 30, 2016 Share Posted August 30, 2016 Ok, js, or ajax, or whatever, is far not my strong suit. So, I've used this in replacement to fit mine (js not changed any) You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Button displays the price, but does not update to the new price after input. Quote Link to comment Share on other sites More sharing options...
sniko Posted August 31, 2016 Share Posted August 31, 2016 Ok, js, or ajax, or whatever, is far not my strong suit. So, I've used this in replacement to fit mine (js not changed any) You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Button displays the price, but does not update to the new price after input. Why not do something like this: https://jsfiddle.net/zf7rbqaL/ You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. (Put the oninput stuff in a function for easier readability, this was a quick hack to show you.) Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted September 5, 2016 Share Posted September 5, 2016 That changed the layout a bit, but still the same as the previous. The automatic total will not adjust within the submit button for purchase. But since I'm wanting to turn this into more of a shopping cart, allowing more than 1 item purchase at a time, I don't think I'mma worry about this mod for now, anyways. But ty! Quote Link to comment 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.