Page 1 of 15

Item mall V2

PostPosted: Wed Aug 19, 2009 5:39 pm
by Rifke
Item mall version 2
Response to: viewtopic.php?f=28&t=137
I’ve written this new version of the item mall because the previous one was just bad… To heavy and crappy coded. This one is better. I’ve removed pretty much of the HTML code, all tables are handled within a self-written table class. So that cleared up a lot or old code, it just needs to be tested. If anyone is willing to sacrifice their free time feel free.
Code should be easy readable.

Quick how-to:
table: mall_category
Make a list of all your categories etc
  • cid : Category ID – auto increment
  • ctitle: Category title
  • cdesc: Description of category
  • cparent: -1 to show on the main page, an different number referring to the cid from an other category, so you’ll get a sub category.
  • cminlevel: To get like VIP – Only items. Or GM only items for GMs that can’t make items or something. Or to create different levels like 101, 104 etc…
  • chidden: 0 to show, 1 to hide the category (like if you’re adding stuff so it won’t show up for other users. But you can also set the cminlevel to 300+ or so depending on what you like)
table: mall_items
Put the available items in here. Tables speak for them self. Field image is not used.. Could be added when necessary.
The other things speak for them self eg
  • item_id: 337
  • item_type: 11
  • item_name: Topaz [7]
  • item_desc: +35int
table: mall_forsale
This holds all the items you’re about to sell.
  • cid: Category id -> from mall_category
  • iid: item id -> from mall_items
  • price: INTEGER format, could also be negative to increase someone’s money?! Be warned! Lol
  • payment: Z for zully, D: for donationpoints
  • quantity: amount of that items, eg: 999 and for bullets would give you 999 bullets off course.
  • ref_able: is the item refineable if yes add a number between 1-9 for the grade to give
  • soc_able: does the item contain a socket?



To make it load in as a module
It has to be included in an other page (or to make it standalone it requires a random parameters to make the url checking posible eg: itemmall_v2.php?p=itemmall_or_what_ever

In the itemmall_v2 You'll find:
// Configuring some data
$item_mall->setlog(true); // enable/disable to create an information stream of who bought what
$item_mall->setaccount_id(1); // set the users account ID
$item_mall->setalevel(100); // set the users access level

You'll have to retrieve the account id, and the access level to get the stuff to work fine.




Download: DOWNLOAD NOW!
Password: myrose


Dynasty CMS plugin
Add this file to your administrator's dir, and than you can add a new link to in your administrator's panel.
  1. <a href="?op=add_dpts">Add Donation Points</a>

:ugeek: Warning: Don't forget to change the SQL queries if you use an the other donation field.

add_dpts.zip
Dynasty CMS plugin
(952 Bytes) Downloaded 1476 times

Re: Item mall V2

PostPosted: Wed Aug 19, 2009 6:34 pm
by thriel
does this version also support both donation points and zullie ?

Re: Item mall V2

PostPosted: Wed Aug 19, 2009 8:53 pm
by Rifke
Yes

If you have read through all the details
...
table: mall_forsale
This holds all the items you’re about to sell.

* cid: Category id -> from mall_category
* iid: item id -> from mall_items
* price: INTEGER format, could also be negative to increase someone’s money?! Be warned! Lol
* payment: Z for zully, D: for donationpoints
* quantity: amount of that items, eg: 999 and for bullets would give you 999 bullets off course.
* ref_able: is the item refineable if yes add a number between 1-9 for the grade to give
* soc_able: does the item contain a socket?

Re: Item mall V2

PostPosted: Thu Aug 20, 2009 7:01 am
by Mike567
i go on http://localhost/itemmall_v2.php
then its work fine i click the Muse Staff, then the url is http://localhost&i_cid=9&i_par=1 now,

it not working on me... and not requird login page

Re: Item mall V2

PostPosted: Thu Aug 20, 2009 11:37 am
by Mike567
its kinda little weird,

i'm using dynastycms rev 1. but i really don't understand this,

Re: Item mall V2

PostPosted: Thu Aug 20, 2009 2:40 pm
by Rifke
...
To make it load in as a module
It has to be included in an other page (or to make it standalone it requires a random parameters to make the url checking posible eg: itemmall_v2.php?p=itemmall_or_what_ever



Mike567 wrote:i go on http://localhost/itemmall_v2.php
then its work fine i click the Muse Staff, then the url is http://localhost&i_cid=9&i_par=1 now,

it not working on me... and not requird login page


So you'll have to go to
http://localhost/itemmall_v2.php?p=random


The login is not my concern, you'll have to add/create it your own...



If you use dynasty CMS you'll just add a new link in user panel. to index.php?p=itemmall_v2, and then add the itemmall_v2.php under modules (I think) and it should work.

Re: Item mall V2

PostPosted: Thu Aug 20, 2009 4:34 pm
by Mike567
ok, thnx

but when i go when i go on user panel then click the item mall which direct me into t
his http://localhost/index.php?op=itemmall_v2 URL. then the result is only Main and which direct to
this http://localhost/index.php?op=itemmall_v2 URL.

and i see on the itemmal_v2 there's a code include('class.table.inc.php');
but i don't have class.table.inc.php

sorry bcz i only noob at php

Re: Item mall V2

PostPosted: Thu Aug 20, 2009 9:42 pm
by Rifke
In the .ZIP file you're able to download from the URL in the first post, there are three files included

  • itemmall_v2.php
  • class.table.inc.php
  • sql_with_some_pre_made_categories.sql


Now you only have moved itemmall_v2.php to your modules dir... Add the class.table.inc.php there to and it should work...
It makes sence if you click on Main than you redirect to your MAIN page... in this case the itemmall page.

Re: Item mall V2

PostPosted: Fri Aug 21, 2009 1:09 pm
by Mike567
thx, i saw it now

Re: Item mall V2

PostPosted: Fri Aug 21, 2009 1:17 pm
by Mike567
btw, how to add points?

donation points or nb_donation points?

edit:and can you give a script that i can add the donation points in admin panel.
bcz i try but nothing happend. i only edit the change the character name

  1. <?php if(!session_is_registered(Admin)) {
  2. die('Access Denied');
  3. }
  4. ?>
  5. <form id="form1" name="form1" method="post" action="?op=name_change">
  6. <table width="275" border="0" align="center">
  7.   <tr>
  8.     <td width="98">Account Name: </td>
  9.     <td width="167"><label>
  10.       <input type="text" name="textfield1">
  11.     </label></td>
  12.   </tr>
  13.   <tr>
  14.     <td width="98"> Donation PT: </td>
  15.     <td width="167"><label>
  16.       <input type="text" name="textfield2">
  17.     </label></td>
  18.   </tr>
  19.   <tr>
  20.     <td>Are you sure? </td>
  21.     <td><label>
  22.       <input name="sure" type="checkbox" id="sure" value="checkbox">
  23.     </label></td>
  24.   </tr>
  25. </table>
  26.  
  27. <p align="center">
  28.   <input name="submit" type="submit" id="submit" />
  29.   <br />
  30.   <br />
  31. <?php
  32. if(isset($_POST['sure'])) {
  33. mysql_query("UPDATE accounts SET donation = '".$_POST['textfield2']."' WHERE username = '".$_POST['textfield1']."'");
  34. echo 'Add DPT Succesfully!.';
  35. } else {
  36. echo 'If you want to add the donation points, then click the box!';
  37. }
  38. ?></p>
  39.  
  40. </form>
  41.