radio_active Posted January 1, 2009 Share Posted January 1, 2009 Well Joss someone requested this so i decided to whip something up, but note i have not tested it. Files to edit and or replace: itembuy.php && shops.php SQL: 1 Alter SQL Cron 1 cron edit. itembuy.php you can either replace with this: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Or add these to your own (probably safer). You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Now shops.php Im not posting all the edits because they are annoying so you can just have this one which is not tested also, lol You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. That has a little add on aswell, person in forums posted ages back, just a javascript total amount quantifer. SQL You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. CRON: Add to whatever cron you see fit. Id do the day or week cron. You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. And thats it. Post all errors, do not post the same error twice though. (If you use it that is) I will test it all out tomorrow and maybe even add it to my site. Enjoy :-) EDIT: Forgot to add the quantity to the tables when viewing items in shops, oops Quote Link to comment Share on other sites More sharing options...
ishmell Posted January 1, 2009 Share Posted January 1, 2009 Re: [MCcode v2] Item Stock as requestsed (Not Tested) From what I can already see your going to want to change the staff_shops.php page. Its going to give an error when adding new items to shops. Something along the lines of Column count doesn't match as the error. Edit:// You can always find $db->query("INSERT INTO shopitems VALUES('',{$_POST['shop']},{$_POST['item']})"); in staff_shops.php and replace with $db->query("INSERT INTO shopitems VALUES('',{$_POST['shop']},{$_POST['item'], ''})"); then put in a quantity manually. or in staff_shops.php find $db->query("INSERT INTO shopitems VALUES('',{$_POST['shop']},{$_POST['item']})"); and replace with $db->query("INSERT INTO shopitems VALUES('',{$_POST['shop']},{$_POST['item']},{$_POST['qty']})"); then find Item: ".item_dropdown($c,"item")." and underneath add <input type='text' size='5' name='qty' value='0' id='qty' /> so you can place in a quantity and not have to do it manually. Quote Link to comment Share on other sites More sharing options...
radio_active Posted January 2, 2009 Author Share Posted January 2, 2009 Re: [MCcode v2] Shops item stock - as requested (Not Tested) ishmell, if your selecting only the fields needed in your queries eg $g = $db->query("insert into shops (shopname,shopdesc) values ($_POST['name'],$_POST['desc']"); It wont spill and error, the SQL has a default which if you wish you can set to 100 meaning when you add an item, the stock will be 100 when added, or you can add it and wait for it to be updated, however... If your using SELECT * then it will spill out the Column count Doesn't match blah blah.... =) BUt thanks for pointing it out for other people who use SELECT * You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. You would want to replace that with what you said if it has a default, if it has no default then you would want to put '0' in that last part... :-) EDIT: Gave a better example Quote Link to comment Share on other sites More sharing options...
ishmell Posted January 2, 2009 Share Posted January 2, 2009 Re: [MCcode v2] Shops item stock - as requested (Not Tested) Ok well I decided to try out the mod. In shops.php when trying to click a shop it does not show the shops id in the end of the url so the url looks liek this when the shop is clicked... http://streetsrising.iiistudios.com/shops.php?shop= <<< shop id missing. Then if I put in an id and go to the shop I get this error o.o QUERY ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.itmtypename FROM shopitems si ' at line 4 Query was SELECT si.sitemID,sitemSHOP,sitemITEMID,sitemQTY, i.itmid,itmname,itmdesc,itmbuyprice,itmsellprice,itmtype it.itmtypename FROM shopitems si LEFT JOIN items i ON si.sitemITEMID = i.itmid LEFT JOIN itemtypes it ON i.itmtype = it.itmtypeid WHERE si.sitemSHOP = ('1') ORDER BY i.itmtype ASC, i.itmbuyprice ASC, i.itmname ASC Not trying to be a pest, just testing the mod out for you. Quote Link to comment Share on other sites More sharing options...
radio_active Posted January 2, 2009 Author Share Posted January 2, 2009 Re: [MCcode v2] Shops item stock - as requested (Not Tested) Thanks, i need a test... in shops.php put this in it replacing the current one (about 10 lines down) You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. If it still doesnt show, just put this there You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. and then replace the $qtwo query with this, was missing a , on the selects. You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Then report back xD Quote Link to comment Share on other sites More sharing options...
ishmell Posted January 2, 2009 Share Posted January 2, 2009 Re: [MCcode v2] Shops item stock - as requested (Not Tested) ok well I got this on shops.php Parse error: syntax error, unexpected T_INT_CAST in /home/blackshe/public_html/streetsrising/shops.php on line 9 line 9: $_GET['shop'] = abs(int)$_GET['shop']); ^^ neither of ur methods worked for the shop ID because i just got that same error o.o Quote Link to comment Share on other sites More sharing options...
radio_active Posted January 2, 2009 Author Share Posted January 2, 2009 Re: [MCcode v2] Shops item stock - as requested (Not Tested) my bad, you have to put one more ( before the int.. SO this $_GET['shop'] = abs((int) $_GET['shop']); Quote Link to comment Share on other sites More sharing options...
radio_active Posted January 2, 2009 Author Share Posted January 2, 2009 Re: [MCcode v2] Shops item stock - as requested (Not Tested) See's luke viewing, says, noooo USE THIS INSTEAD You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. lol Quote Link to comment Share on other sites More sharing options...
ishmell Posted January 2, 2009 Share Posted January 2, 2009 Re: [MCcode v2] Shops item stock - as requested (Not Tested) lol weird it still wont show shop id. But this time when I place in shop id in the url...it comes up just the table is a little wack. The quantity and buy seems to be combined lol. And the buy text field is to big you may want to set a size for it. And there is a random item price underneath all that which I think is the javascript price add-on for it changes when I change the buy number. So you may want to look over the table. I can post a screen if you want. :-D Quote Link to comment Share on other sites More sharing options...
Sethenor Posted January 2, 2009 Share Posted January 2, 2009 Re: [MCcode v2] Shops item stock - as requested (Not Tested) Good effort mate Quote Link to comment Share on other sites More sharing options...
John99 Posted January 2, 2009 Share Posted January 2, 2009 Re: [MCcode v2] Shops item stock - as requested (Not Tested) lol Quote Link to comment Share on other sites More sharing options...
radio_active Posted January 2, 2009 Author Share Posted January 2, 2009 Re: [MCcode v2] Shops item stock - as requested (Not Tested) Okay i have woken up now, im awake and i found the errors... Replace with these itembuy.php You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. and shops.php You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. I just tested that, so it works... If you find any problems, post error. AND FOR THE CRON, USE THIS INSTEAD, THIS WILL ONLY UPDATE STOCKS AT 0. You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. ENJOY This would be so much easier if i could edit the first post. Quote Link to comment Share on other sites More sharing options...
Zero-Affect Posted January 2, 2009 Share Posted January 2, 2009 Re: [MCcode v2] Shops item stock - as requested (Not Tested) Cool... lmfao :-D Quote Link to comment Share on other sites More sharing options...
josh_boss102 Posted January 2, 2009 Share Posted January 2, 2009 Re: [MCcode v2] Shops item stock - as requested (Not Tested) This works perfectly and I thank you for doing this. I am most grateful for your work. +1 Quote Link to comment Share on other sites More sharing options...
radio_active Posted January 2, 2009 Author Share Posted January 2, 2009 Re: [MCcode v2] Shops item stock - as requested (Not Tested) One more edit.. Open staff_shops.php replace the "function new_stock_form()" and "function new_stock_submit()" with You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. This works perfectly and I thank you for doing this. I am most grateful for your work. +1 Thankyou, it was a good idea! Edit: Forgot a ) on the query. Quote Link to comment Share on other sites More sharing options...
ishmell Posted January 2, 2009 Share Posted January 2, 2009 Re: [MCcode v2] Shops item stock - as requested (Not Tested) Ah yes, works great. Great mod great idea guys. :-D Quote Link to comment Share on other sites More sharing options...
radio_active Posted January 2, 2009 Author Share Posted January 2, 2009 Re: [MCcode v2] Shops item stock - as requested (Not Tested) Optional Addition: When users sell items it updates the stock. So if a user sells 10 medical kits, the shops medical kit supplies will increase by 10. Open itemsell.php Add You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Under the item_add... or just use this. You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. I think that just about covers it. Quote Link to comment Share on other sites More sharing options...
Karlos Posted January 2, 2009 Share Posted January 2, 2009 Re: [MCcode v2] Shops item stock - as requested (Not Tested) Can you explain the following in a bit more detail please? 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...
jds137 Posted January 3, 2009 Share Posted January 3, 2009 Re: [MCcode v2] Shops item stock - as requested (Not Tested) We need to add the updated staff_shops.php as well 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...
radio_active Posted January 3, 2009 Author Share Posted January 3, 2009 Re: [MCcode v2] Shops item stock - as requested (Not Tested) We need to add the updated staff_shops.php as well You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. I updates the Add item to shop function.. One more edit.. Open staff_shops.php replace the "function new_stock_form()" and "function new_stock_submit()" with You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. This works perfectly and I thank you for doing this. I am most grateful for your work. +1 Thankyou, it was a good idea! Edit: Forgot a ) on the query. But that was only one function which is that was needed it think. Quote Link to comment Share on other sites More sharing options...
POG1 Posted January 3, 2009 Share Posted January 3, 2009 Re: [MCcode v2] Shops item stock - as requested (Not Tested) Can you explain the following in a bit more detail please? You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Its an if else function; ( condition ) ? 'true' : 'false' ; So the condition first checks if the GET['ID'] is set, then it checks if the value of GET['ID'] is numerical. Quote Link to comment Share on other sites More sharing options...
Zero-Affect Posted January 3, 2009 Share Posted January 3, 2009 Re: [MCcode v2] Shops item stock - as requested (Not Tested) Can you explain the following in a bit more detail please? You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Its an if else function; ( condition ) ? 'true' : 'false' ; So the condition first checks if the GET['ID'] is set, then it checks if the value of GET['ID'] is numerical. ereg basically checks to see if a string contains specific chars for example if $blah doesn't contrain a-z which is a b c .. and so on then it will fail that's really a crap explanation but if you have been awake for 25 hours then you attempt better i use eregi for such things like email checking and stuff like that and for the smart ass people yes i know it says ereg in the string i was just trying to show a example ... if you have a problem write me a letter or shut up Quote Link to comment Share on other sites More sharing options...
POG1 Posted January 3, 2009 Share Posted January 3, 2009 Re: [MCcode v2] Shops item stock - as requested (Not Tested) It seems your getting too big for your boots zero! I was trying to explain in simple words. My explanation was good enough because thats what the function does! Quote Link to comment Share on other sites More sharing options...
Zero-Affect Posted January 3, 2009 Share Posted January 3, 2009 Re: [MCcode v2] Shops item stock - as requested (Not Tested) i didn't deny that was the case i was just adding to the explanation... seems you have a issue with me rather than my post's i suggest you keep your personal feelings out of other peoples posts. and i was explaining the obvious which you did not do therefore i did add to your explanation... get over yourself for-real your just getting annoying Quote Link to comment Share on other sites More sharing options...
shaved92bravada Posted January 4, 2009 Share Posted January 4, 2009 Re: [MCcode v2] Shops item stock - as requested (Not Tested) I can't help myself I have to say it Can't we all just get along?? what is it with people in the forums these days ?? 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.