$k =0;
if($Num >0)
{
$ShowBy = strtolower(trim(mysql_result($ProdCat,$k,'showby')));
$ShowBy = 'subcategories';
if($ShowBy == 'subcategories')
{
$SubCatQuery = mysql_query("SELECT * FROM store_category WHERE masterid='".$MaterID."' AND isactive='1' ORDER BY rank ASC, name ASC");
$SubCatNum = @mysql_num_rows($SubCatQuery);
if($SubCatNum > 0)
{
for($i=0; $i<$SubCatNum; $i++)
{
$SID = mysql_result($SubCatQuery,$i,'id');
$SName = mysql_result($SubCatQuery,$i,'name');
$SubcatSeoUrl = mysql_result($SubCatQuery,$i,'seourl');
$ProductQuery = mysql_query("SELECT * FROM store_products WHERE masterid='".$MaterID."' AND subcatid='".$SID."' AND isactive='1' ORDER BY isfeatured DESC, id ASC LIMIT 1");
$ProductNum = mysql_num_rows($ProductQuery);
for($k=0; $k<$ProductNum ;$k++)
{
$PID = mysql_result($ProductQuery,$k,'id');
$Mid = mysql_result($ProductQuery,$k,'masterid');
$Subid = mysql_result($ProductQuery,$k,'subcatid');
$Name = mysql_result($ProductQuery,$k,'name');
$Image1 = trim(@mysql_result($ProductQuery,$k,'productimage'));
$Image2 = trim(@mysql_result($ProductQuery,$k,'productimage2'));
$Image3 = trim(@mysql_result($ProductQuery,$k,'productimage3'));
$Subid = $SID;
$ImagePath = "";
if($Image1 != '' && file_exists($UploadSmallImage.$Image1))
{
$ImagePath = $UploadSmallImage.$Image1;
}
else if($Image2 != '' && file_exists($UploadSmallImage.$Image2))
{
$ImagePath = $UploadSmallImage.$Image2;
}
/*else if($Image3 != '' && file_exists($UploadSmallImage.$Image3))
{
$ImagePath = $UploadSmallImage.$Image3;
}*/
else
{
$ImagePath = $NoImage;
}
if(trim($ImagePath) != '' && $RecordFound == 0)
{
$RecordFound = 1;
}
$SubCatPageName = '';
if($SubcatSeoUrl !='')
{
$SubCatPageName = $SubcatSeoUrl;
}
else
{
$SubCatPageName = 'product_list.html?mid='.$Mid.'&sid='.$Subid;
}
?>
}
}
}
}
else
{
$ProductQuery = mysql_query("SELECT * FROM store_products WHERE masterid='".$MaterID."' AND subcatid='0' AND isactive='1' ORDER BY rank ASC, name ASC");
$ProductNum = mysql_num_rows($ProductQuery);
for($k=0; $k<$ProductNum ;$k++)
{
$PID = mysql_result($ProductQuery,$k,'id');
$Mid = mysql_result($ProductQuery,$k,'masterid');
$Subid = mysql_result($ProductQuery,$k,'subcatid');
$Name = mysql_result($ProductQuery,$k,'name');
$Image1 = trim(@mysql_result($ProductQuery,$k,'productimage'));
$Image2 = trim(@mysql_result($ProductQuery,$k,'productimage2'));
$Image3 = trim(@mysql_result($ProductQuery,$k,'productimage3'));
$ProductSeoUrl = trim(@mysql_result($ProductQuery,$k,'seourl'));
$ImagePath = "";
if($Image1 != '' && file_exists($UploadSmallImage.$Image1))
{
$ImagePath = $UploadSmallImage.$Image1;
}
else if($Image2 != '' && file_exists($UploadSmallImage.$Image2))
{
$ImagePath = $UploadSmallImage.$Image2;
}
/*else if($Image3 != '' && file_exists($UploadSmallImage.$Image3))
{
$ImagePath = $UploadSmallImage.$Image3;
}*/
else
{
$ImagePath = $NoImage;
}
if(trim($ImagePath) != '' && $RecordFound == 0)
{
$RecordFound = 1;
}
$ProductPageName = '';
if($ProductSeoUrl!='')
{
$ProductPageName = $ProductSeoUrl;
}
else
{
$ProductPageName = 'productdetails.html?id='.$PID;
}
?>
}
}
}
if($RecordFound != 1)
{
echo ' No Record Found! ';
}
?>
//include_once('pagging.php');?>
|