*

san37

  • ***
  • 89 posts
search-cat in inc.category.php
« on: June 16, 2016, 10:41:53 AM »
hi
tell me how to create a condition to display the category where more >1 ad, which is < than 1, do not display them

Code: [Select]
<div id="search-cat" class="search-cat">
            <div class="cat-tab">
              <?php $cat_id osc_category_id(); ?>

              <?php if(!empty($subcats)) { ?>
                <?php foreach($subcats as $s) { ?>
                  <?php $search_params['sCategory'] = $s['pk_i_id']; ?>

                  <div class="link-wrap">
                    <a href="<?php echo osc_search_url($search_params); ?>" <?php echo ($s['pk_i_id'] == $search_cat_id 'class="bold"' ''); ?>>
                      <?php echo $s['s_name'] . ' <strong>' $s['i_num_items'] . '</strong>'?>
                    </a>
                  </div>

*

MB Themes

Re: search-cat in inc.category.php
« Reply #1 on: June 16, 2016, 12:31:59 PM »
@san37
You may try to use function:
Code: [Select]
osc_category_total_items()
It returns number of listings in category.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

san37

  • ***
  • 89 posts
Re: search-cat in inc.category.php
« Reply #2 on: June 16, 2016, 02:55:56 PM »
I mean if for example in the category bmw has 1 ad category to display.If the category audi 0 ads category does not show
Do not need to show a category in which no ads, and if there is 1 more category to display

*

MB Themes

Re: search-cat in inc.category.php
« Reply #3 on: June 16, 2016, 02:57:15 PM »
@san37
I got you all required.
Code: [Select]
if(osc_category_total_items() > ) { .... some code ... }
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

san37

  • ***
  • 89 posts
Re: search-cat in inc.category.php
« Reply #4 on: June 16, 2016, 03:25:00 PM »
 
Code: [Select]
<?php if(osc_category_total_items()>1){ echo '('$s['s_name']. $s['i_num_items'].')';} ?>
Tried so, but remained still, where less than 1 are displayed
What's wrong?
« Last Edit: June 16, 2016, 06:59:01 PM by san37 »

*

MB Themes

Re: search-cat in inc.category.php
« Reply #5 on: June 17, 2016, 08:46:18 AM »
First try if item counts are correct. And you should know what are you doing, I gave you all the tools required.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots