Author Topic: RC 3?  (Read 6643 times)

Offline Syndel

Re: RC 3?
« Reply #15 on: September 02, 2006, 10:04:59 am »
This is what my ShopAdmin.php looks like:

<snipped by Daniel15, too long>
« Last Edit: September 26, 2006, 08:29:24 pm by daniel15 »

Offline Syndel

Re: RC 3?
« Reply #16 on: September 02, 2006, 10:11:18 am »
And this is the AddToPostCount.php

Quote
<?php
/**********************************************\
| SMFSHOP (Shop MOD for Simple Machines Forum) |
|         (c) 2005 DanSoft Australia           |
|      http://www.dansoftaustralia.com/        |
\**********************************************/

//File: AddToPostCount.php
//      Item (takes additional fields when adding to Admin panel)

//VERSION: New Version
//DATE: 10th April 2005
// $Id: AddToPostCount.php 3 2006-07-08 10:01:21Z daniel15 $

class item_AddToPostCount extends itemTemplate {
    function getItemDetails() {
        $this->name = "Add xxx to Post Count";
        $this->desc = "Increase your Post Count by xxx!";
        $this->price = 50;
       
        $this->require_input = false;
        $this->can_use_item = true;
    }
   
    //this is the best bit of this item. When you add the item into the admin panel, you
    //can set additional variables (up to 4). Make sure to call them info1, info2, info3
    //and info4.
    function getAddInput() {
        return "Amount to change post count by: <input type='text' name='info1' value='100'>";
    }

    //the additional parameters (see 'getAddInput' above) are in the '$item_info array.
    //make sure to make it global (like shown here) otherwise you won't be able to access
    //it's contents. THE ARRAY IS 1-BASED (eg. 1 IS THE FIRST ITEM) NOT 0-BASED!
    function onUse() {
        global $db_prefix, $ID_MEMBER, $item_info;

        $result = db_query("UPDATE {$db_prefix}members
                            SET posts = posts + {$item_info[1]}
                            WHERE ID_MEMBER = {$ID_MEMBER}",
                            __FILE__, __LINE__);
        return "Successfully added {$item_info[1]} to post count!";
    }

}

?>

Offline Daniel15

Re: RC 3?
« Reply #17 on: September 02, 2006, 10:57:47 am »
Syndel, that's an interesting problem... I haven't seen that before. Could you please check in your forum's error log to see whether any errors were output there.

If there's nothing, could you please open your Sources/shop/ShopAdmin.php file, and try changing
                include "$sourcedir/shop/items/$file";

to:
                require "$sourcedir/shop/items/$file";

And see if it makes a difference?
« Last Edit: September 02, 2006, 11:01:13 am by daniel15 »

Offline Syndel

Re: RC 3?
« Reply #18 on: September 02, 2006, 01:41:36 pm »
Nothing was recorded in the error log about the shop other than this, which has nothing to do with the add items thing:

Quote
Syndel   Today at 11:39:41 PM 
      fc9c2376c5a8c50b18c73bb0000f31e1 
 http://roleplaycentral.com/cgi/boards/index.php?action=shop;do=viewall 
Unable to load the 'InstantMessage.english' language file.

And after I made the substitution you asked me to, the error changed to:

Quote
Fatal error: Failed opening required '/www/cgi/boards/Sources/shop/items/AddToPostCount' (include_path='.:/usr/share/pear') in /www/cgi/boards/Sources/shop/ShopAdmin.php on line 168

Offline Daniel15

Re: RC 3?
« Reply #19 on: September 02, 2006, 04:46:44 pm »
OK, I think I found the problem. Try changing the
               require "$sourcedir/shop/items/$file";

to:
               require "$sourcedir/shop/items/{$file}.php";

That should work for you :)

Offline Syndel

Re: RC 3?
« Reply #20 on: September 03, 2006, 12:11:53 am »
Nope...
I did change that and it gives me:

Quote
Fatal error: Failed opening required '/www/cgi/boards/Sources/shop/items/AddToPostCount' (include_path='.:/usr/share/pear') in /www/cgi/boards/Sources/shop/ShopAdmin.php on line 168

Oh yeah... how do people add items for trade on their own? I do not see how... :)
« Last Edit: September 03, 2006, 12:13:51 am by Syndel »