Hi

Im using some of the the original code for SpecialItem in the item_functions file.
Im sort of a newbie with php3 so i have experimentet with the code little bit, maybe 
you could have a look at it and see if
there is something that could be done to make it faster and easier.

Thanks so much for your help.

Tom


This is the SpecialItem code in item_functions:

/*
 ** Function: SpecialItem3
 ** Input: 
 ** Output: INTEGER
 ** Description: returns ID of one of the featured items. 
 */
 function SpecialItem3()
 {
 
 
 require(APPLICATION_ROOT . "/modules/include/frontitems");
 
  global $DatabaseLink;
 
  file://create array of item IDs
  $Item_ID = array($topptre);


  file://return item ID
  return($Item_ID[(floor%($Item_ID))]);
 } 


 /*
 ** Function: SpecialItem4
 ** Input: 
 ** Output: INTEGER
 ** Description: returns ID of one of the featured items. 
 */
 function SpecialItem4()
 {
 
 
 require(APPLICATION_ROOT . "/modules/include/frontitems");
 
  global $DatabaseLink;
  
  file://create array of item IDs
  $Item_ID = array($toppfire);


  file://return item ID
  return($Item_ID[(floor%($Item_ID))]);
 } 
 

In the actual page i refer it like:

if ( $SpecialItem = GetItemInfo(SpecialItem()) )
 {
 $tekst = substr($SpecialItem['Description'], 0, 200);
 $navn = substr($SpecialItem['Name'], 0, 25);

  print("<TR><TD colspan=\"2\"valign=\"top\" 
background=\"http://www.shop.nu/pic/forsidetoppbak.gif\"><font face=\"Verdana, Arial, 
Helvetica\" size=\"2\"><B>&nbsp;&nbsp;$navn</B></TD></TR>\n");
  print("<TR><TD valign=\"top\"><font face=\"Verdana, Arial, Helvetica\" 
size=\"1\">$tekst ....\n");
  print("</TD><TD width=\"90\" valign=\"top\" rowspan=\"2\">\n");
  print("<table border=\"0\">\n");
  print("<tr><td>\n");
  $size = GetImageSize($SpecialItem["Thumbnail"]);
  print("<A HREF=\"".ScreenURL('item', FALSE, 
array('item'=>$SpecialItem['ID']))."\"></FONT><IMG SRC=\"http://www.shop.nu/". 
$SpecialItem["Thumbnail"] . "\" $size[3] BORDER=\"0\" ALIGN=\"left\" 
HSPACE=\"5\"></A>\n");
  print("</td></tr>\n");
  print("<tr><td>\n");
  for($index = 0; $index < count($SpecialItem["SKU"]["ID"]); $index++)
   {
    print(StartForm("welcome",   'post' ,'ADD_BASKET', FALSE, 
    array( 
    "item"=>$item, 
    "sku"=>$SpecialItem["SKU"]["ID"][$index])));
    if($SpecialItem["SKU"]["SalePrice"][$index] > 0)
    {
    print("<CENTER><font face=\"Verdana, Arial, Helvetica\" size=\"2\"><B> " . 
formatMoney($SpecialItem["SKU"]["SalePrice"][$index]));
    }
    else
    {
    print("<CENTER><font face=\"Verdana, Arial, Helvetica\" size=\"2\"><B> " .  
formatMoney($SpecialItem["SKU"]["ListPrice"][$index]));
    }
    print("<BR><INPUT type=\"image\" src=\"http://www.shop.nu/pic/buy.gif\"
    name=\"Add to basket\" border=\"0\" value=\"Add to basket\" VALIGN=BOTTOM>");
   }
  print("</td></tr>\n");
  print("</table>\n");
  print("</TD></TR>\n");
  
  print("</TABLE></FORM>\n");


----- Original Message ----- 
From: Shannon -jj Behrens <[EMAIL PROTECTED]>
To: FreeTrade <[EMAIL PROTECTED]>
Sent: Tuesday, September 05, 2000 12:25 AM
Subject: Re: [FreeTrade] Items on frontpage


> > Can any1 tell me whats the fastest code to have items with price, buybutton
> > picture, description on the front page of the shop. I only want the admin of the 
>store to upload
> > a file with variables to change the items on the front page.
> > 
> > I have tried out the SpecialItem from the Item_functions, but i think it is a 
>little slow.
> 
> Hmm, what do you mean by "slow"?  Does it do additional functionality
> that you do not need (i.e. is it doing unnecessary queries)?  Why would
> any other way of programming the same functionality be any faster?  What
> do you mean when you say you want the admin of the store to upload a
> file with variables?  Why would you do this rather than simply provide a
> screen and its related action in the admin interface?  
> 
> Best Regards,
> -jj
> 
> -- 
> if (shannon - jj) * behrens == webEngineer["CLEAR INK�"]:
>     print "<i>imagination is the only real medium(sm)</i><br>"
> 
> 
> ------------------------------------------------------------
> To subscribe:    [EMAIL PROTECTED]
> To unsubscribe:  [EMAIL PROTECTED]
> Site:            http://www.working-dogs.com/freetrade/
> Problems?:       [EMAIL PROTECTED]




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

Reply via email to