settype($g_intCatID, "integer");
include "shop.phtml";
// shop-category.phtml: Displays a list of all the Categories.
// Display the Main (Top-Level) Categories
$strSQL = "SELECT * FROM tblCategory WHERE ParentID = -1 ORDER BY CatID";
$sclNoParResultID = 0;
$g_objDB->GetAllRows($strSQL, &$ascCategoryResult, &$blnMoreRows, SQL_GET_ROW_COUNT, &$sclNoParResultID, "Get Shop Category data to Display");
if($g_objDB->HasError())
{
$g_objDB->DisplayError(__FILE__, __LINE__, "Get Product Categories failed.");
include "bottom.phtml";
exit;
}
elseif(($intCategoryRows = $g_objDB->GetRowCount($sclNoParResultID)) == 0)
{
?>
|
Main Categories while($intX < $intCategoryRows) { if($ascCategoryResult[$intX]['ContainSub'] == "N") { if($ascCategoryResult[$intX]['CatID'] == $g_intCatID) { ?> print ($ascCategoryResult[$intX]['CategoryName']); ?> } else { $strHref = $g_strFullURL.$g_strCategoryURL."?g_intCatID=".$ascCategoryResult[$intX]['CatID'] ?> print ($ascCategoryResult[$intX]['CategoryName']); ?> } } else { $strHref = $g_strFullURL.$g_strFormURL."?g_intCatID=".$ascCategoryResult[$intX]['CatID'] ?> print ($ascCategoryResult[$intX]['CategoryName']); ?> } $intX++; } ?> | // Display the SubCategories for the selected Main Category if(isset($g_intCatID) && ($g_intCatID != 0)) { $strSQL = "SELECT * FROM tblCategory WHERE ParentID = $g_intCatID ORDER BY CatID"; $sclSubCatID = 0; $g_objDB->GetAllRows($strSQL, &$ascSubCatResult, &$blnMoreRows, SQL_GET_ROW_COUNT, &$sclSubCatID, "Select parent Category data"); //print $strSQL; if($g_objDB->HasError()) { $g_objDB->DisplayError(__FILE__, __LINE__); include "bottom.phtml"; exit; } $intSubCatRows = $g_objDB->GetRowCount($sclSubCatID); $intX = 0; if(($intSubCatRows == 0) && ($g_intCatID != "") && $g_intCatID) { ?> | There are no subcategories in this Category. | } elseif(($g_intCatID != "") && $g_intCatID) { $g_objDB->FreeResults($sclSubCatID); $strSQL = "SELECT CategoryName FROM tblCategory WHERE CatID = ".$ascSubCatResult[$intX]['ParentID']; $sclNameResultID = $g_objDB->GetFirstRowOfSet($strSQL, &$ascCatNameResult, SQL_GET_ROW_COUNT, "Get Category Name"); if($g_objDB->HasError()) { $g_objDB->DisplayError(__FILE__, __LINE__); include "bottom.phtml"; exit; } elseif(!$g_objDB->GetRowCount($sclNameResultID)) { $g_objDB->DisplayError("", 0, "Category Name Not Found."); include "bottom.phtml"; exit; } $g_objDB->FreeResults($sclNameResultID); ?>Sub-Categories in Category print ($ascCatNameResult['CategoryName']); ?>
|
}
}?>