Forums / Setting Up Categories, Products, Attributes / Hide category count -- on only ONE category

Hide category count -- on only ONE category

Locked

Views: 9,728

Results 1 to 20 of 32
This thread is locked. New replies are disabled.
29 Oct 2007, 1:53 PM
#1
reneep avatar

reneep

New Zenner

Join Date:
Oct 2007
Posts:
4
Plugin Contributions:
0

Hide category count -- on only ONE category

The store owner wants to hide the category count only for one category -- Gift Certificates. I know how to turn off the category count for ALL categories, but is there a way to do it for just one?

This is the site in question: https://www.countrygiftsandmore.com

Thanks!

13 Nov 2007, 12:21 AM
#2
benn600 avatar

benn600

Zen Follower

Join Date:
Nov 2007
Posts:
124
Plugin Contributions:
0

Re: Hide category count -- on only ONE category

This is possible with some PHP code. If you find the file that prints these categories, which should be categories.php under sideboxes, then you can put some PHP code in there that will not print if the category ID equals whatever gift certificates is.

If you don't know PHP, then it can be tricky. I may be able to help you a little later. I'm setting up a new store but am not currently near the server/etc.

I can try to get you a solution when I can. You still want a solution, right?

Photography Equipment at Unbelievable Prices!!
http://www.thriftydigitalcamera.com/

13 Nov 2007, 1:16 AM
#3
reneep avatar

reneep

New Zenner

Join Date:
Oct 2007
Posts:
4
Plugin Contributions:
0

Re: Hide category count -- on only ONE category

I am still looking for a solution -- I'd warned the store owner that it might not be something easily done without coding.

I don't have any experience with PHP, but I'm more than willing to learn what I can from you. Any tips or hints are more than welcome!

22 Nov 2007, 5:31 AM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Hide category count -- on only ONE category

You would need to customize the class for building the categories:
/includes/classes/category_tree.php

and customize the code to not add the count for that particular categories_id ... the code that adds the count is:

    if (SHOW_COUNTS == 'true') {
      $products_in_category = zen_count_products_in_category($counter);
      if ($products_in_category > 0) {
        $this->box_categories_array[$ii]['count'] = $products_in_category;
      } else {
        $this->box_categories_array[$ii]['count'] = 0;
      }
    }

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

22 Nov 2007, 5:34 AM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Hide category count -- on only ONE category

An example would be, if the Gift Certificates are in categories_id 21 then you could use:

    if (SHOW_COUNTS == 'true' && $counter != 21) {
      $products_in_category = zen_count_products_in_category($counter);
      if ($products_in_category > 0) {
        $this->box_categories_array[$ii]['count'] = $products_in_category;
      } else {
        $this->box_categories_array[$ii]['count'] = 0;
      }
    }

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

22 Nov 2007, 7:50 AM
#6
reneep avatar

reneep

New Zenner

Join Date:
Oct 2007
Posts:
4
Plugin Contributions:
0

Re: Hide category count -- on only ONE category

I'll try that -- thanks!!

10 Aug 2008, 11:41 PM
#7
dontknowwhatimdoing avatar

dontknowwhatimdoing

Zen Follower

Join Date:
Aug 2008
Posts:
131
Plugin Contributions:
0

Re: Hide category count -- on only ONE category

Can I disable my category count on my homepage only?

11 Aug 2008, 12:37 AM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Hide category count -- on only ONE category

You can evaluate if you are on the Home page with the variable:
$this_is_home_page

if ($this_is_home_page) {
// do this I am the home page
} else {
// do something else I am not the home page
}

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

11 Aug 2008, 1:13 AM
#9
dontknowwhatimdoing avatar

dontknowwhatimdoing

Zen Follower

Join Date:
Aug 2008
Posts:
131
Plugin Contributions:
0

Re: Hide category count -- on only ONE category

Perfect, I love using these kinds of commands on wordpress. If statements/ conditional statements to call or not call functions on specific pages.

I tried to edit my category tree--but I did it wrong. The page of course did not load...

Now, I undid my changes & the page still does not load--

File Caching is not activated -- I checked for this.

The admin panel continues to work fine...

Is there something I can reset/ clear to get this functional again?

I'll probably have to do it a few times in a row until I get the code alteration correct.

11 Aug 2008, 1:19 AM
#10
dontknowwhatimdoing avatar

dontknowwhatimdoing

Zen Follower

Join Date:
Aug 2008
Posts:
131
Plugin Contributions:
0

Re: Hide category count -- on only ONE category

hey--this is quite strange, but I restarted apache on the server & it's fine now (quite odd...)

so I'll continue playing with this until I get it right :)

11 Aug 2008, 2:11 AM
#11
dontknowwhatimdoing avatar

dontknowwhatimdoing

Zen Follower

Join Date:
Aug 2008
Posts:
131
Plugin Contributions:
0

Re: Hide category count -- on only ONE category

Tried this:

if (SHOW_COUNTS == 'true' and ($this_is_home_page)) {
      $products_in_category = zen_count_products_in_category($counter);
      if ($products_in_category > 0) {
        $this->box_categories_array[$ii]['count'] = $products_in_category;
      } else {
        $this->box_categories_array[$ii]['count'] = 0;
      }
    }

And I tried this:
Tried this:

if (SHOW_COUNTS == 'true' and $this_is_home_page !=true) {
      $products_in_category = zen_count_products_in_category($counter);
      if ($products_in_category > 0) {
        $this->box_categories_array[$ii]['count'] = $products_in_category;
      } else {
        $this->box_categories_array[$ii]['count'] = 0;
      }
    }

I also tried and $this_is_home_page == false

But nothing seems to work right. I'm not sure whether I need to compare "$this_is_home_page" to some global variable/ or what...

11 Aug 2008, 2:31 AM
#12
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Hide category count -- on only ONE category

Say in english, and type really slow as I do not read very fast, what it is you want to do ... :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

11 Aug 2008, 3:09 AM
#13
dontknowwhatimdoing avatar

dontknowwhatimdoing

Zen Follower

Join Date:
Aug 2008
Posts:
131
Plugin Contributions:
0

Re: Hide category count -- on only ONE category

Acceptable Scenario:
I was trying to achieve this: category counts DON'T appear on the home page, but category counts appear on all other pages

What DONTKNOWWHATIMDOING (<--me!) Was Trying to Do (What an Appropriate name!)
=>IF the page I am on is the home page, no category counts appear
=>If the page I am on is NOT the home page,* show the category counts*

It would be even better if I could somehow only have category counts appearing on pages showing at least 1 category level deep.

I wouldn't bother with the 'even better' scenario unless there was a simple way to do it.

11 Aug 2008, 4:11 AM
#14
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Hide category count -- on only ONE category

You will want to use your templates and overrides for this ... I like to copy both peices even if I am only editing one of the files for consistancy:
/includes/modules/sideboxes/categories.php
/includes/templates/templates_default/sideboxes/tpl_categories.php

Copy to your overrides directory:
/includes/modules/sideboxes/your_template_dir/categories.php
/includes/templates/your_template_dir/sideboxes/tpl_categories.php

Edit the file:
/includes/templates/your_template_dir/sideboxes/tpl_categories.php

Line 51 reads:

      if (SHOW_COUNTS == 'true') {

Change to read:

      if (SHOW_COUNTS == 'true' && !$this_is_home_page) {

Now you see the counts when not on the Home page ... :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

11 Aug 2008, 7:34 AM
#15
dontknowwhatimdoing avatar

dontknowwhatimdoing

Zen Follower

Join Date:
Aug 2008
Posts:
131
Plugin Contributions:
0

Re: Hide category count -- on only ONE category

It worked flawlessly (of course--you wrote it)

Thank you so much! You're a pro <= Sorry for telling you something you already know! :wink:

11 Aug 2008, 2:58 PM
#16
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Hide category count -- on only ONE category

Heck ... I just type really really fast until the right letters fall together ... there are only so many combos and eventually I will hit it ... :lamo:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

16 Aug 2008, 12:56 AM
#17
keith_s avatar

keith_s

New Zenner

Join Date:
Aug 2008
Posts:
18
Plugin Contributions:
0

Re: Hide category count -- on only ONE category

Hello,

I am trying to find out how to turn off the category count for my products, Just the number that shows next to each product in the category box on the main page. I have set all quanity counts to (zero), But i must be missing one.

I know there is a way to do this without having to do code, Just using the configuration some were?

Thanks alot!

16 Aug 2008, 9:57 AM
#18
dontknowwhatimdoing avatar

dontknowwhatimdoing

Zen Follower

Join Date:
Aug 2008
Posts:
131
Plugin Contributions:
0

Re: Hide category count -- on only ONE category

Keith.S:

Hello,

I am trying to find out how to turn off the category count for my products, Just the number that shows next to each product in the category box on the main page. I have set all quanity counts to (zero), But i must be missing one.

I know there is a way to do this without having to do code, Just using the configuration some were?

Thanks alot!

Admin > Configuration > my store

Show Category Counts = False

21 Jan 2009, 7:49 PM
#19
dashizna avatar

dashizna

Zen Follower

Join Date:
Mar 2006
Posts:
424
Plugin Contributions:
0

Re: Hide category count -- on only ONE category

How about doing this same thing but i only want to show the quanity in one category for our clearance section only

We sell ATV, Dirtbike, Streetbike, Snowmobile, Watercraft & Custom stickers & Banners. Check us out https://www.AD-DiscountPerformance.com

25 Jan 2009, 4:53 PM
#20
dontknowwhatimdoing avatar

dontknowwhatimdoing

Zen Follower

Join Date:
Aug 2008
Posts:
131
Plugin Contributions:
0

Re: Hide category count -- on only ONE category

Dashizna:

How about doing this same thing but i only want to show the quanity in one category for our clearance section only

The only way I personally would know how to do this would be with a PHP conditional statement --

I don't know if that can be done without altering the core code (i.e. I don't think there's a simple box you can check to do that).

There's some posts about exactly what you're asking, I can't recall where they are though, so I don't have a link for you.