Danny696 Posted September 28, 2009 Posted September 28, 2009 Hey there i took virtualshogun's mod and made it a little better. his mod was where you set the discount for the item on the code, mine is where you set it for each one in the staff menu. first off run this sql. [mysql]ALTER TABLE `items` ADD `discount` INT(3) NOT NULL DEFAULT '0';[/mysql] then In staff_items.php find: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. and under add You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. FIND: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. FIND the query, before You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. replace with You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. FIND You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. ADD UNDER You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. FIND THE QUERY and do the same as above, the $discount part and the query part then replace shops with: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Replace itmbuy with this: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Quote
seanybob Posted September 28, 2009 Posted September 28, 2009 even better (and more efficient) would be to add a single variable to the settings table, which would be the percentage you want donators to have off the regular prices (so you don't have to set a discount price on every item). For example: In the settings table, add the variable 'dondiscount' and set it to 10 (for a 10% discount). Then on the shops.php page (or wherever it is you buy items) update the $itemcost variable with an if statement as follows: if($ir['donator_days']>0) { $itemcost = $itemcost - ($itemcost * $set['dondiscount']); } There we have it. One new variable in the database, 3-4 lines of code added to your php files, and you don't have to reinput tons of new prices for donators. Win. :D Quote
Danny696 Posted September 28, 2009 Author Posted September 28, 2009 But what about if you wanted individual item discounts? Quote
seanybob Posted September 28, 2009 Posted September 28, 2009 But what about if you wanted individual item discounts? Then yes, I 'spose yours would work better. I've just seen in games I've run or helped run that we'd get close to a thousand items... and setting a discount for each of them would be tedious beyond belief, and unnecessary. I've always been a fan of Occam's Razor myself though. In my mind, donators would prefer a blanket discount than an individual item discount. Quote
Danny696 Posted September 28, 2009 Author Posted September 28, 2009 Yer i suppose they would, and i wouldnt suggestion adding this to an succesfull game, mabey a starting one, if you wanted this type of this on a succesfull game mabey use this one: [mccode v2.x] V2 shop discount for donators Quote
virtualshogun Posted September 28, 2009 Posted September 28, 2009 just a little clairification on something <img src= 'toys/".$r['itmid'].".jpg' border='0' width = '50' height = '50'> thats a folder in your root named toys (items) it goes 1.jpg , 2.jpg , 3.jpg and so on its useing the item number then .jpg extension just so people dont use this or mine and go where did my pics go if you have it somewhere else, nice addon danny Quote
Danny696 Posted September 28, 2009 Author Posted September 28, 2009 Thanks i wouldnt have done it without your idea tho ;) Quote
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.