Reputation: 225
pals. . . I'm building up a opensource ecommerce template !
This Code below lists first 3 results of the storelist . . .
<?php
if(count($this->store_list)>0){
$number_output = 0;
foreach($this->store_list as $store){
$number_output++;
if($number_output > 3) break;
?>
<div id="menu">
<span class="cons_title fl"><a href="<?php echo PATH.'store/'.$store->title_url.'.html'; ?>"><h2><?php echo ucfirst($store->name); ?></h2></a></span>
<div class="cons_bot fl clr">
<ul>
<li><h4><?php echo $store->address1; ?>,</h4></li>
<li><h4><?php echo $store->address2; ?>,</h4></li>
<li><h4><?php echo $store->area_name; ?>,</h4></li>
<li><h4><?php echo ucfirst($store->city_name); ?>,</h4></li>
<li><h4><?php echo $store->pin; ?></h4></li>
<li><h4>PH:</h4><h4><?php echo $store->phone; ?></h4></li>
</ul>
</div>
and here is the other code for displaying category wise !
<?php if(count($this->category_list)>0){
foreach($this->category_list as $category){ ?>
<a href="<?php echo PATH;?>store-listing/cat/<?php echo $category->category_url; ?>.html" class="<?php if($category->category_url == url::title($cat_active)){ echo 'active';}?>"><?php echo ucfirst($category->category_name); ?></a>
and may i integrate the code below in the above code that it shows me results of a single category only . . . Can u guide me up
Upvotes: 0
Views: 451
Reputation: 2094
not clear which object is superior store or category
well to restrict category to only 1 do something like
/*possibly a parent loop to process everything over this category - if store is super*/
<?php if(count($this->category_list)>0){
$categoryLimit = 1;
foreach($this->category_list as $category){
if($categoryLimit == 1){ ?>
<a href="<?php echo PATH;?>store-listing/cat/<?php echo $category->category_url; ?>.html" class="<?php if($category->category_url == url::title($cat_active)){ echo 'active';}?>"><?php echo ucfirst($category->category_name); ?></a>
......
<?
/*possibly a sub loop to process everything within this category - if store is child to category*/
$categoryLimit++;
} ## end if ?>
hope this help
Upvotes: 1