Tom Jakobsen wrote:
> 
> Thank you for your help:)
> 
> Could you send me your "department" file, so i could have a look at it.
> I get the error message "This item is unavailable at this time."
> 
> Thanks
> 
> Tom

Yes, you are right I missed two things.
1) function showRelationship(...
2) $item = $DatabaseRow->ID;



"department" file:
==================
<?php
        /*
        ** File: department
        ** Description: show departments and items contained in them
        ** Version: $Revision: 1.11 $
        ** Created: 04/22/1999
        ** Author: Leon Atkinson
        ** Email: [EMAIL PROTECTED]
        ** CVS Author: $Author: leon $
        ** Last Revised: $Date: 2000/02/02 18:59:48 $
        ** Log : $Log: department,v $
        ** Log : Revision 1.11  2000/02/02 18:59:48  leon
        ** Log : Fixing bugs reported by Ted Henigson.
        ** Log :
        ** Log : Revision 1.10  1999/11/04 21:35:40  leon
        ** Log : Cleaned up the use of paths.  Paths are now all set in
index.php3 as
        ** Log : constants.  Example settings for Apache/Unix, Apache/Win32,
and IIS.
        ** Log :
        ** Log : Revision 1.9  1999/10/30 22:07:15  leon
        ** Log : Fixed some problems with images associated with items and
departments.
        ** Log : Defined the directories for items and departments inside
global_settings.
        ** Log :
        ** Log : Revision 1.8  1999/10/12 00:39:10  chris
        ** Log : Moving text into constants in preparation of localization
support.
        ** Log :
        ** Log : Revision 1.7  1999/10/11 23:04:08  leon
        ** Log : Removed all require()'s, added block to stop double
include()'s
        ** Log :
        ** Log : Require wasn't giving any performance advantage because it was
always
        ** Log : being called with a variable.  Futhermore, using return inside
a
        ** Log : require()'d file does not work in PHP4.
        ** Log :
        ** Log : Revision 1.6  1999/08/18 22:32:14  leon
        ** Log : Returning opening PHP tag to XML-friendly tag
        ** Log :
        ** Log : Revision 1.5  1999/07/28 19:27:30  leon
        ** Log : Mass update based on code donation from a live project
        ** Log :
        **
        ** Copyright (c) 1999 Working Dogs.  All rights reserved.
        */

function showRelationship($Item, $relationship, $description)
        {
                //
                //** Related items
                //
                $CrossSellCount=0;
                if(isset($Item['Relationship'][$relationship]))
                {
                        $CrossSellCount = count($Item['Relationship'][$relationship]);
                }

                if($CrossSellCount > 0)
                {
                        print("<BR>\n");
                        print("$description\n");
                        print("<UL>\n");
                
                        for($n=0; $n<$CrossSellCount; $n++)
                        {
                                $RelatedItem =
GetItemInfo($Item['Relationship'][$relationship][$n]);

                                print("<LI><A HREF=\"".ScreenURL('item', FALSE,
array('item'=>$RelatedItem['ID']))."\">");

                                print($RelatedItem['Name']);
                                
                                print("</A>");
                        }               

                        print("</UL>\n");
                }       
        
        
        }
        $department = intval($department);

        //show sub-departments
        $Query = "SELECT ID, Name, Graphic, Description ";
        $Query .= "FROM department ";
        $Query .= "WHERE Parent=$department ";
        $Query .= "ORDER BY DisplayPrecedence, Name ";
        $DatabaseResult = mysql_query($Query, $DatabaseLink);
        while($DatabaseRow = mysql_fetch_object($DatabaseResult))
        {
                print("<A HREF=\"" . ScreenURL("department") .
"&department=$DatabaseRow->ID\">");

                if(($DatabaseRow->Graphic) AND file_exists(DEPARTMENT_IMAGES_DIR . '/'
. $DatabaseRow->Graphic))
                {
                        $department_Graphic_size = getimagesize(DEPARTMENT_IMAGES_DIR 
. '/' .
$DatabaseRow->Graphic);

                        print("<IMG SRC=\"" . DEPARTMENT_IMAGES_DIR . '/' .
$DatabaseRow->Graphic . "\"");
                        print(" $department_Graphic_size[3] BORDER=\"0\" 
ALIGN=\"left\">\n");
                }
                
                print("<B>$DatabaseRow->Name</B>");
                
                print("</A>");
                print("<BR>\n");
                
                print($DatabaseRow->Description);
                print("<BR CLEAR=\"all\">\n");
                print("<BR>\n");
                
        
        }
        
                
        //show items in this department
        $Query = "SELECT i.ID, i.Name, i.Thumbnail ";
        $Query .= "FROM item i, department_item di ";
        $Query .= "WHERE di.Department = $department ";
        $Query .= "AND i.ID = di.Item ";
        $Query .= "ORDER BY i.DisplayPrecedence, i.Name ";
        $DatabaseResult = mysql_query($Query, $DatabaseLink);
        while($DatabaseRow = mysql_fetch_object($DatabaseResult))
        {
                print("<A HREF=\"".ScreenURL("item")."&item=$DatabaseRow->ID\">");
                if(($DatabaseRow->Thumbnail) AND 
                        file_exists(ITEM_IMAGES_DIR . "/" . $DatabaseRow->Thumbnail))
                {
                        $Thumbnail_Graphic_size = getimagesize(ITEM_IMAGES_DIR . "/" .
$DatabaseRow->Thumbnail);
                        print("<IMG SRC=\"" . ITEM_IMAGES_DIR . "/" . 
$DatabaseRow->Thumbnail
. "\"");
                        print(" $Thumbnail_Graphic_size[3] BORDER=\"0\" 
ALIGN=\"left\">\n");
                }
                print("<B>$DatabaseRow->Name</B>");
                print("</A>");
                print("<BR CLEAR=\"all\">\n");
                print("<BR>\n");
        $item = $DatabaseRow->ID; 
        include(APPLICATION_ROOT . "modules/screens/item_dep");
        }

?>


------------------------------------------------------------
To subscribe:    [EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
Site:            http://www.working-dogs.com/freetrade/
Problems?:       [EMAIL PROTECTED]

Reply via email to