I am displaying product list related to different categories.
Product list displaying correctly . But I want to display product list Heading should be Category then all product of this category then Heading of Next Category then all product of this category so on.
But i am facing this problem code is below ant also attachment of current display. where category heading displaying with each row.
Code: Select all
$sql = $this->MMdbobj->query("SELECT pro.*,cat.catname FROM tbl_products pro,tbl_category cat where pro.status='1' and cat.cat_id=pro.cat_id order by cat.cat_id ASC limit $eu, $limit");
$i=0;
foreach($this->params['ProductList'] as $Products)
{
$i++;
$start++;
$cat=$Products['catname'];
?>
<tr><td colspan="4" align="center"><?php echo $Products['catname'];?></td></tr>
<tr bgcolor="<?php if($i%2){?>#efefef<?php }?>">
<td class="para" style="padding-left:5px; padding-right:5px; border:2px #000 thick;"><?php echo $start;?></td>
<td class="para" style="padding-left:5px; padding-right:5px; border:2px #000 thick; "><?php echo $Products['pname'];?></td>
<td class="para" style="padding-left:5px;padding-right:5px; border:2px #000 thick; "><?php echo $Products['detail'];?></td>
<td height="20" class="para" style="padding-left:5px;padding-right:5px; border:2px #000 thick; "><?php echo $Products['company'];?></td>
<td height="20" class="para" style="padding-left:5px;padding-right:5px; border:2px #000 thick; ">
<?php if($Products['hot']==1){?>
<input type="button" value="view" style="cursor:pointer;" onClick="window.location.href='index.php?module=productdetail&pro_id=<?php echo $Products['pro_id'];?>'" class="readmore">
<?php }?>
</td>
</tr>
<?php
}
?>