Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Category->Sub-Category Counts

Category->Sub-Category Counts

Locked

Views: 3,253

Results 1 to 20 of 42
This thread is locked. New replies are disabled.
14 Aug 2010, 6:35 PM
#1
jfreeman avatar

jfreeman

Zen Follower

Join Date:
Apr 2010
Location:
Sutton, MA
Posts:
150
Plugin Contributions:
0

Category->Sub-Category Counts

I've been looking for a solution here but can't seem to find it amoung the faq's here - perhaps I missedit.

I would like the following to happen (which I was working in my original install but went away at some point):

From Main Menu - Categories Box

Category [count] <-This happening correctly

Click on Category - displays sub-categories

When do this I see the all of the sub-categories but do not see counts per sub-categories - I would like this turn on so my customers can click on sub-categories with products in them.

Any help would be most appreciated.

14 Aug 2010, 7:07 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Category->Sub-Category Counts

That would be the normal default behaviour....

What are your install details?? ver etc?

Settings in config > layout settings around this function

15 Aug 2010, 2:16 PM
#3
jfreeman avatar

jfreeman

Zen Follower

Join Date:
Apr 2010
Location:
Sutton, MA
Posts:
150
Plugin Contributions:
0

Re: Category->Sub-Category Counts

Thanks for replying, I'm at the latest relase of Zen Cart 1.3.9e

15 Aug 2010, 2:21 PM
#4
jfreeman avatar

jfreeman

Zen Follower

Join Date:
Apr 2010
Location:
Sutton, MA
Posts:
150
Plugin Contributions:
0

Re: Category->Sub-Category Counts

Thank you for replying,

I am at the latest Zen Cart 1.3.9e and I had to paste here as the attachment was too large. Below are the layout configurations and if you need any other config info - just let me know.

Any help would be much appreciated.

Title Value Action
Column Width - Left Boxes 150px
Column Width - Right Boxes 150px
Bread Crumbs Navigation Separator  :: 
Define Breadcrumb Status 1
Bestsellers - Number Padding  
Bestsellers - Truncate Product Names 35
Bestsellers - Truncate Product Names followed by ... true
Categories Box - Show Specials Link true
Categories Box - Show Products New Link true
Shopping Cart Box Status 1
Categories Box - Show Featured Products Link true
Categories Box - Show Products All Link true
Column Left Status - Global 1
Column Right Status - Global 1
Column Width - Left 150px
Column Width - Right 150px
Categories Separator between links Status 0
Categories Separator between the Category Name and Count ->
Categories Separator between the Category Name and Sub Categories |_ 
Categories Count Prefix  (
Categories Count Suffix )
Categories SubCategories Indent   
Categories with 0 Products Status 0
Split Categories Box True
Shopping Cart - Show Totals 1
Customer Greeting - Show on Index Page 1
Categories - Always Show on Main Page 0
Main Page - Opens with Category 0
Categories - Always Open to Show SubCategories 1
Banner Display Groups - Header Position 1
Banner Display Groups - Header Position 2
Banner Display Groups - Header Position 3
Banner Display Groups - Footer Position 1
Banner Display Groups - Footer Position 2
Banner Display Groups - Footer Position 3 Wide-Banners
Banner Display Groups - Side Box banner_box SideBox-Banners
Banner Display Groups - Side Box banner_box2 SideBox-Banners
Banner Display Group - Side Box banner_box_all BannersAll
Footer - Show IP Address status 1
Product Discount Quantities - Add how many blank discounts? 5
Product Discount Quantities - Display how many per row? 5
Categories/Products Display Sort Order 3
Option Names and Values Global Add, Copy and Delete Features Status 1
Categories-Tabs Menu ON/OFF 0
Site Map - include My Account Links? Yes
Skip 1-prod Categories True
Use split-login page False
CSS Buttons No

15 Aug 2010, 2:32 PM
#5
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Category->Sub-Category Counts

Need a link to your install to see if this might be a template issue

Post one with ONE space to break the link and prevent it being googled as in

http: //www.zen-cart.com/

15 Aug 2010, 2:39 PM
#6
jfreeman avatar

jfreeman

Zen Follower

Join Date:
Apr 2010
Location:
Sutton, MA
Posts:
150
Plugin Contributions:
0

Re: Category->Sub-Category Counts

Thanks for helping here is the link:

http:// www. vintagesheetmusiconline .com/ zennew13/ index.php?main_page=

15 Aug 2010, 2:56 PM
#7
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Category->Sub-Category Counts

What I see is exactly as it should be - those with products show

SIZE="4"[/SIZE]

What are you referring to???

15 Aug 2010, 6:04 PM
#8
jfreeman avatar

jfreeman

Zen Follower

Join Date:
Apr 2010
Location:
Sutton, MA
Posts:
150
Plugin Contributions:
0

Re: Category->Sub-Category Counts

I agree in the Categories Box it would show counts and sub categories with counts in it . What I'm driving at is when you click on Sheet Music - I believe at one time it displayed all the sub-categories to the right and their counts (except zero items in a sub-category) - then when you click on the sub-category with a count next to it (in this case 1800's) and then when I clicked on it displays the sub-sub-category (E. T. Paull) with a count next to it and when I clicked on it I saw the items for me to choose and purchase.

Again, this is what I thought I saw as I was somewhat rapidly setting things up as I did like three fresh installs after playing around with configurations.

Thanks - Jeff

15 Aug 2010, 6:52 PM
#9
ajeh avatar

ajeh

Oba-san

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

Re: Category->Sub-Category Counts

Could it possibly be because you have 1 item in that Category and have the Skip Product Listing with 1 item turned on in the Configuration ... Layout Settings ...

Skip 1-prod Categories
Skip single-product categories
If this option is set to True, then if the customer clicks on a link to a category which only contains a single item, then Zen Cart will take them directly to that product-page, rather than present them with another link to click in order to see the product.
Default: True

15 Aug 2010, 7:03 PM
#10
jfreeman avatar

jfreeman

Zen Follower

Join Date:
Apr 2010
Location:
Sutton, MA
Posts:
150
Plugin Contributions:
0

Re: Category->Sub-Category Counts

I tried changing that optioin and it still does not turnon the sub-categories count to the right of the Category Box. Please follow this link to see what I mean. Again, Category Box shows counts and sub-categories correct. But if you click on Sheet Music - the categories display to the right (which I want) but they do not display sounds of the sub-categories to the right of the Categories Box. Please piece back the url below in order to see my ecommerce cart.

http:// www. vintagesheetmusiconline .com/ zennew13/i ndex.php?main_page=index&cPath=1

Thanks for any help.

16 Aug 2010, 12:51 AM
#11
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Category->Sub-Category Counts

What I'm driving at is when you click on Sheet Music - I believe at one time it displayed all the sub-categories to the right and their counts
Well I still do not understand what your issue is as what you state above is EXACTLY what the picture shows

Category/sub-cat counts in the categories box - - just as it should

16 Aug 2010, 11:41 AM
#12
jfreeman avatar

jfreeman

Zen Follower

Join Date:
Apr 2010
Location:
Sutton, MA
Posts:
150
Plugin Contributions:
0

Re: Category->Sub-Category Counts

Okay I will try to be more clear:

  1. In the "Categories Box" on the left shows the top Categories and counts if there are any items in sub-categories - this works perfect - NO issue uere
  2. When click on the Category in the Categories Box on the left it opens to the sub-categories and sub-categories with items below them show counts otherwise we see just empty sub-categories - this works perfect - NO issue here.
  3. When I drill down further by clicking on sub-categories in the Categories Box on the left I see the items and can click on them. This works perfect - NO issue here.

The issue is:

When I see counts next a Category within the Categories Box on the left and I click on one of them - my example in the picture shows Categories and sub-categories on the left with counts but on the RIGHT you see the sub-categories and there are NO counts displayed next to categories with items that are directly below them or in sub-categories.

Ultimately I would just like to see counts in the Categories Box on the left - have the use click on the Category with a count next to it in the Cateogories Box and then display the sub-categories on the right with counts next to the sub-categories.

So, when you look at the supplied picture - you see counts on the LEFT inside the Categories Box and none on the RIGHT outside of the Categories Box.

I really do appreciate any help here and if I need to go into more detail I would be happy to. Thank you one and all! :smile:

16 Aug 2010, 1:53 PM
#13
ajeh avatar

ajeh

Oba-san

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

Re: Category->Sub-Category Counts

Are you trying to get Category Counts to show in both the Category sidebox and next to the Category in the middle of the screen? :unsure:

16 Aug 2010, 4:16 PM
#14
jfreeman avatar

jfreeman

Zen Follower

Join Date:
Apr 2010
Location:
Sutton, MA
Posts:
150
Plugin Contributions:
0

Re: Category->Sub-Category Counts

Yes - that is what I have been trying to explain - if you look at the document that shows the counts on the left side in the Category Box and the sub-categories in the "middle" of the screen are what I am hoping to have display counts per sub-category.

16 Aug 2010, 5:46 PM
#15
ajeh avatar

ajeh

Oba-san

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

Re: Category->Sub-Category Counts

You would need to customize the code for those counts and you could use the function zen_count_products_in_category for obtaining what those counts are ...

20 Sep 2010, 5:05 AM
#16
judah avatar

judah

New Zenner

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

Re: Category->Sub-Category Counts

Is there a way to "Not Display The Counts"?

20 Sep 2010, 5:09 AM
#17
ajeh avatar

ajeh

Oba-san

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

Re: Category->Sub-Category Counts

If you mean the counts on the Categories ... you can turn them off with the setting in the Configuration ... My Store ...

Show Category Counts
Count recursively how many products are in each category
true
false

30 Sep 2010, 9:55 PM
#18
fontaholic avatar

fontaholic

Zen Follower

Join Date:
Jun 2008
Posts:
111
Plugin Contributions:
0

Re: Category->Sub-Category Counts

jfreeman:

Yes - that is what I have been trying to explain - if you look at the document that shows the counts on the left side in the Category Box and the sub-categories in the "middle" of the screen are what I am hoping to have display counts per sub-category.

i was hoping to be able to do this as well.

30 Sep 2010, 10:24 PM
#19
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Category->Sub-Category Counts

That would take custom coding as Ajeh mentioned in post 15. It actually doesn't look like it should be difficult. I'll take a look at it later (gotta go now).

30 Sep 2010, 10:37 PM
#20
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Category->Sub-Category Counts

In /includes/modules/your_template/category_row.php, find this section```php
while (!$categories->EOF) {
if (!$categories->fields['categories_image']) !$categories->fields['categories_image'] = 'pixel_trans.gif';
$cPath_new = zen_get_path($categories->fields['categories_id']);

// strip out 0_ from top level cats
$cPath_new = str_replace('=0_', '=', $cPath_new);

//    $categories->fields['products_name'] = zen_get_products_name($categories->fields['products_id']);

$list_box_contents[$row][$col] = array('params' => 'class="categoryListBoxContents"' . ' ' . 'style="width:' . $col_width . '%;"',
                                       'text' => '<a href="' . zen_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . zen_image(DIR_WS_IMAGES . $categories->fields['categories_image'], $categories->fields['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br />' . $categories->fields['categories_name'] . '</a>');

and replace with thisphp
while (!$categories->EOF) {
if (!$categories->fields['categories_image']) !$categories->fields['categories_image'] = 'pixel_trans.gif';
$cPath_new = zen_get_path($categories->fields['categories_id']);
$cat_count = '<span class="catCount">' . CATEGORIES_COUNT_PREFIX . zen_count_products_in_category($categories->fields['categories_id']) . CATEGORIES_COUNT_SUFFIX . '</span>';
// strip out 0_ from top level cats
$cPath_new = str_replace('=0_', '=', $cPath_new);

//    $categories->fields['products_name'] = zen_get_products_name($categories->fields['products_id']);

$list_box_contents[$row][$col] = array('params' => 'class="categoryListBoxContents"' . ' ' . 'style="width:' . $col_width . '%;"',
                                       'text' => '<a href="' . zen_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . zen_image(DIR_WS_IMAGES . $categories->fields['categories_image'], $categories->fields['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br />' . $categories->fields['categories_name'] . $cat_count . '</a>');
Let me know how it works and I can tweak it if necessary.