if ($itemmode) // display as an item (not as catalog)
{
echo "
";
mysql_query("update items set viewcount = viewcount+1 where itemindex = \"$itemindex\" ");
// get item record
$result=mysql_query("select * from items
where itemindex = \"$itemindex\" ");
$row = mysql_fetch_array($result);
$smallimage = "itempics/I" . $row[itemindex] . "_S.jpg";
$smallimage2 = "itempics/I" . $row[itemindex] . "_S2.jpg";
$largeimage = "itempics/I" . $row[itemindex] . "_L.jpg";
echo "
";
echo " | ";
echo "
 | ";
echo "
";
echo "
\n";
echo "\n";
$shippingtext = "";
if ($row[itemmailcost]>0)
$shippingtext = " Shipping: PhP $row[itemmailcost] ";
echo "| ItemNum $itemindex | ";
echo "PhP $row[itemprice] $shippingtext | ";
echo "
\n";
echo "
\n";
echo "
";
$detaildisp=nl2br($row[itemdetails]);
echo "
| $detaildisp | ";
echo "
";
if ($paypal=="Y")
{
// check if this is already a loopback via activating the cart
// if so then suspend the item and show the paypart cart link
if ($reserve == $itemindex and $row[available] == "Y")
{
// suspend item here (available=N)
mysql_query("update items set available = \"N\"
where itemindex = \"$itemindex\" ");
echo "
\n";
echo "\n";
echo "| \n";
echo "\n";
echo " | \n";
echo "
\n";
echo "
\n";
}
else
// if not a loopback then simply check if item is available
// and then prompt accordingly
{
if ($row[available]=="Y")
{
echo "
\n";
}
else
{
echo "
\n";
echo "\n";
echo "| ";
echo "This item is no longer available. ";
echo " | \n";
echo "
\n";
echo "
\n";
};
};
}
else // (non paypal routine)
{
if ($row[available]<>"Y")
{
echo "
\n";
echo "\n";
echo "| ";
echo "This item is no longer available. ";
echo " | \n";
echo "
\n";
echo "
\n";
};
echo "
\n";
echo "\n";
echo "";
echo "My online payment system is still undergoing construction.";
echo " If you are interested in this item, please note the ItemNum ($itemindex) and contact me.";
echo " ";
echo "click here for my contact information ";
echo " | \n";
echo "
\n";
echo "
\n";
};
echo "
";
$description = $row[itemdesc]; /// to be used for item header below
};
if ($groupmode) // display as group catalog format
{
echo "
";
// get all grouptree records whose parents are the current group
$result=mysql_query("select * from grouptree
where parentgroup = \"$groupcode\" ");
$dami = mysql_num_rows($result);
// if ($dami > 0)
// echo "
Sub Groups";
echo "
";
for ($i = 1; $i <= $dami; $i++)
{
$row = mysql_fetch_array($result);
$thumbfile = "siteimages/grp_icon_" . $row[groupcode] . ".jpg";
echo "";
echo "";
echo "";
echo " ";
echo " | ";
echo "";
echo " $row[groupname] ";
echo " | ";
echo "
";
};
echo "
";
// get all items records whose parents are the current group
// set paging parameters
if (empty($fromrec)) $fromrec=0;
if ($fromrec < 0) $fromrec=0;
$itemlimit = 14;
// count total number of items in the group
$result=mysql_query("select count(*) from items where parentgroup = \"$groupcode\" ");
$row=mysql_fetch_array($result);
$itemcount = $row[0];
if ($itemcount > 0)
{
echo "
Items ";
// fetch the items for display, limited by paging parameters
$result=mysql_query("select * from items
where parentgroup = \"$groupcode\"
ORDER BY dispseq
LIMIT $fromrec,$itemlimit");
$dami = mysql_num_rows($result);
// prepare the paging navigational bar
$dispfromrec = $fromrec+1;
$disptorec = $dispfromrec + $dami - 1;
$newfromrec = $dispfromrec - $itemlimit - 1; // when needed, backout itemlimit records, compensate for base 0
// display the paging navigational bar
echo "
$dispfromrec - $disptorec of $itemcount";
if ($dispfromrec > 1)
{
echo " <Previous";
};
if ($disptorec < $itemcount) echo " Next>";
echo "";
echo "
";
echo "
";
for ($i = 1; $i <= $dami; $i++)
{
$row = mysql_fetch_array($result);
$thumbfile = "itempics/I" . $row[itemindex] . "_icon.jpg";
echo "";
echo "";
echo "";
echo " ";
echo " | ";
echo "";
echo " $row[itemdesc] ";
echo " | ";
echo "
";
};
echo "
";
}
else
{
echo "
Sorry, as of this time there are no available items of this type that are for sale.
";
};
echo "
";
};
if ($searchmode) // display as group catalog format with searched items
{
echo "
";
// $skey = " " . $skey . " ";
// or itemdesc REGEXP '[[:<:]]$skey[[:>:]]'
// or itemdesc LIKE '%$skey%'
$result=mysql_query("select * from items
left join grouptree on (items.parentgroup = grouptree.groupcode)
where itemdetails RLIKE '\[\[:<:\]\]$skey\[\[:>:\]\]'
or itemdesc RLIKE '\[\[:<:\]\]$skey\[\[:>:\]\]'
or groupname LIKE '$skey' ");
$dami = mysql_num_rows($result);
echo "
$dami item(s) found:
";
echo "
";
for ($i = 1; $i <= $dami; $i++)
{
$row = mysql_fetch_array($result);
$thumbfile = "itempics/I" . $row[itemindex] . "_icon.jpg";
echo "";
echo "";
echo "";
echo " ";
echo " | ";
echo "";
echo " $row[itemdesc] ";
echo " | ";
echo "
";
};
echo "
";
echo "
";
$description = "Search result for $skey";
};
?>