Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Subcategories Not Displaying Under Categories

Subcategories Not Displaying Under Categories

Views: 1,750

Results 1 to 16 of 16
25 Nov 2011, 4:08 AM
#1
jerseygirl avatar

jerseygirl

New Zenner

Join Date:
Aug 2011
Location:
New Jersey
Posts:
15
Plugin Contributions:
0

Subcategories Not Displaying Under Categories

version: v1.3.9h
template: custom
add-ons: tabbed products pro; wishllist

For some reason, my subcategories are not showing up on my category pages. Subcategories are showing up in the sidebar, but when you click on the top-level category, you get the category name with no links to any subcategories. However, products are listed on sub-subcategory pages, and the product page shows up just fine. Basically, the site looks like this:

--> Category Page: nothing

--> --> Sub Category Page: nothing

--> --> --> Sub Sub Category Page: list of products

--> --> --> --> Product Page: product info

I checked using the classic template, and the problem is still apparent. I replaced the "display grid of available subcategories" code in tpl_index_categories from a clean backup just in case, and it did nothing. I've also tried the opposite of removing subcategories from category pages (replacing clean code where it instructs to remove it),and played around with my admin settings, but I'm getting nowhere. Any ideas? TIA!

25 Nov 2011, 6:52 AM
#2
gjh42 avatar

gjh42

Black Belt

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

Re: Subcategories Not Displaying Under Categories

Not yet, but seeing it live may help.

25 Nov 2011, 11:38 AM
#3
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Subcategories Not Displaying Under Categories

You might check Admin - Configuration - Product Listing - Show SubCategories on Main Page while navigating

12 Dec 2011, 2:47 PM
#4
johnnyh avatar

johnnyh

New Zenner

Join Date:
Oct 2011
Posts:
50
Plugin Contributions:
0

Re: Subcategories Not Displaying Under Categories

Got the same problem...
Working on this site: studteol.dk/zencart

Anyone with an idea why this is so?

12 Dec 2011, 2:52 PM
#5
ajeh avatar

ajeh

Oba-san

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

Re: Subcategories Not Displaying Under Categories

What errors are you seeing in the debug logs in the /cache directory?

The page is not completing when you go to a Category with subcategories ... :unsure:

12 Dec 2011, 3:58 PM
#6
johnnyh avatar

johnnyh

New Zenner

Join Date:
Oct 2011
Posts:
50
Plugin Contributions:
0

Re: Subcategories Not Displaying Under Categories

How will I know which log to look in?
It doesn't seem to produce a log when just trying to navigate to a subcategory? And the result is just the header and footer, the breadcrumb and an empty main column....

12 Dec 2011, 4:02 PM
#7
ajeh avatar

ajeh

Oba-san

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

Re: Subcategories Not Displaying Under Categories

You should not have any debug logs in the /cache .... so you might start by deleting all of the *.log files then navigating to a Category where you do not see the subcategories then refresh your /cache directory and see what debug logs are generated ...

12 Dec 2011, 4:07 PM
#8
gjh42 avatar

gjh42

Black Belt

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

Re: Subcategories Not Displaying Under Categories

The last HTML output is ```html

<!-- eof breadcrumb --> <table width="100%" border="0" cellspacing="0" cellpadding="0" id="contentMainWrapper"> <tr> <td class="maincolumn" valign="top"> <!-- bof upload alerts --> <!-- eof upload alerts -->
so there is some kind of problem most likely in /includes/templates/your_template/templates/tpl_index_categories.php, or maybe in the module file that feeds it.

The latest debug log is the one that will have the current error.
12 Dec 2011, 6:09 PM
#9
johnnyh avatar

johnnyh

New Zenner

Join Date:
Oct 2011
Posts:
50
Plugin Contributions:
0

Re: Subcategories Not Displaying Under Categories

Well this is the message:

[12-Dec-2011 17:02:39] PHP Parse error: syntax error, unexpected '<' in /home/studteol/public_html/zencart/includes/templates/template_default/templates/tpl_index_categories.php on line 51

And the code is this:

<?php
if (PRODUCT_LIST_CATEGORIES_IMAGE_STATUS_TOP == 'true') {


<?php
// categories_description
    if ($current_categories_description != '') {
?>
<div id="categoryDescription" class="catDescContent"><?php echo $current_categories_description;  ?></div>
<?php } // categories_description ?>
<!-- BOF: Display grid of available sub-categories, if any -->
<?php
  if (PRODUCT_LIST_CATEGORY_ROW_STATUS == 0) {
    // do nothing
  } else {
    // display subcategories
/**
 * require the code to display the sub-categories-grid, if any exist
 */
   require($template->get_template_dir('tpl_modules_category_row.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_category_row.php');
  }
?>
<!-- EOF: Display grid of available sub-categories -->
<?php
$show_display_category = $db->Execute(SQL_SHOW_PRODUCT_INFO_CATEGORY);

while (!$show_display_category->EOF) {
  // //  echo 'I found ' . zen_get_module_directory(FILENAME_UPCOMING_PRODUCTS);

?>

Can anyone with more insight than me, see the problem?

Best regards
Johnny

12 Dec 2011, 6:16 PM
#10
gjh42 avatar

gjh42

Black Belt

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

Re: Subcategories Not Displaying Under Categories

while (!$show_display_category->EOF) {
  // //  echo 'I found ' . zen_get_module_directory(FILENAME_UPCOMING_PRODUCTS);

?>
```The file shouldn't cut off like that. Some code has been deleted before the ?>, leaving an unclosed while loop.


...Unless there is more of the file that you haven't posted:)
12 Dec 2011, 6:24 PM
#11
gjh42 avatar

gjh42

Black Belt

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

Re: Subcategories Not Displaying Under Categories

<?php
if (PRODUCT_LIST_CATEGORIES_IMAGE_STATUS_TOP == 'true') {


<?php
// categories_description 
```The first <?php tag is not closed by a ?> before the next opening tag. Thus the "unexpected <".
12 Dec 2011, 8:37 PM
#12
johnnyh avatar

johnnyh

New Zenner

Join Date:
Oct 2011
Posts:
50
Plugin Contributions:
0

Re: Subcategories Not Displaying Under Categories

I tried to close it, but no difference.

Here is the entire file: (but I do not remember to have alterede anything in it, but...?

<?php
/**
 * Page Template
 *
 * Loaded by main_page=index<br />
 * Displays category/sub-category listing<br />
 * Uses tpl_index_category_row.php to render individual items
 *
 * @package templateSystem
 * @copyright Copyright 2003-2006 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: tpl_index_categories.php 4678 2006-10-05 21:02:50Z ajeh $
 */
?>
<div class="centerColumn" id="indexCategories">
<?php if ($show_welcome == true) { ?>
<h1 id="indexCategoriesHeading"><?php echo HEADING_TITLE; ?></h1>

<?php if (SHOW_CUSTOMER_GREETING == 1) { ?>
<h2 class="greeting"><?php echo zen_customer_greeting(); ?></h2>
<?php } ?>

<!-- deprecated - to use - uncomment
<?php if (TEXT_MAIN) { ?>
<div id="" class="content"><?php echo TEXT_MAIN; ?></div>
<?php } ?>-->

<!-- deprecated - to use - uncomment
<?php if (TEXT_INFORMATION) { ?>
<div id="" class="content"><?php echo TEXT_INFORMATION; ?></div>
<?php } ?>-->

<?php if (DEFINE_MAIN_PAGE_STATUS >= 1 and DEFINE_MAIN_PAGE_STATUS <= 2) { ?>
<div id="indexCategoriesMainContent" class="content"><?php
/**
 * require the html_define for the index/categories page
 */
  include($define_page);
?></div>
<?php } ?>

<?php } else { ?>
<h1 id="indexCategoriesHeading"><?php echo $breadcrumb->last(); ?></h1>
<?php } ?>

<?php
if (PRODUCT_LIST_CATEGORIES_IMAGE_STATUS_TOP == 'true') {

?>
<?php
// categories_description
    if ($current_categories_description != '') {
?>
<div id="categoryDescription" class="catDescContent"><?php echo $current_categories_description;  ?></div>
<?php } // categories_description ?>
<!-- BOF: Display grid of available sub-categories, if any -->
<?php
  if (PRODUCT_LIST_CATEGORY_ROW_STATUS == 0) {
    // do nothing
  } else {
    // display subcategories
/**
 * require the code to display the sub-categories-grid, if any exist
 */
   require($template->get_template_dir('tpl_modules_category_row.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_category_row.php');
  }
?>
<!-- EOF: Display grid of available sub-categories -->
<?php
$show_display_category = $db->Execute(SQL_SHOW_PRODUCT_INFO_CATEGORY);

while (!$show_display_category->EOF) {
  // //  echo 'I found ' . zen_get_module_directory(FILENAME_UPCOMING_PRODUCTS);

?>

<?php if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_CATEGORY_FEATURED_PRODUCTS') { ?>
<?php
/**
 * display the Featured Products Center Box
 */
?>
<?php require($template->get_template_dir('tpl_modules_featured_products.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_featured_products.php'); ?>
<?php } ?>

<?php if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_CATEGORY_SPECIALS_PRODUCTS') { ?>
<?php
/**
 * display the Special Products Center Box
 */
?>
<?php require($template->get_template_dir('tpl_modules_specials_default.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_specials_default.php'); ?>
<?php } ?>

<?php if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_CATEGORY_NEW_PRODUCTS') { ?>
<?php
/**
 * display the New Products Center Box
 */
?>
<?php require($template->get_template_dir('tpl_modules_whats_new.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_whats_new.php'); ?>
<?php } ?>

<?php if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_CATEGORY_UPCOMING') { ?>
<?php include(DIR_WS_MODULES . zen_get_module_directory(FILENAME_UPCOMING_PRODUCTS)); ?><?php } ?>
<?php
  $show_display_category->MoveNext();
} // !EOF
?>
</div>
12 Dec 2011, 8:39 PM
#13
johnnyh avatar

johnnyh

New Zenner

Join Date:
Oct 2011
Posts:
50
Plugin Contributions:
0

Re: Subcategories Not Displaying Under Categories

Might be a problem with the css_horizontal_dropdown_menu_with_jquery_2-0?

12 Dec 2011, 8:48 PM
#14
johnnyh avatar

johnnyh

New Zenner

Join Date:
Oct 2011
Posts:
50
Plugin Contributions:
0

Re: Subcategories Not Displaying Under Categories

Solved it I think...

Found this missing code in a backup:

// categories_image

  if ($categories_image = zen_get_categories_image($current_category_id)) {

?>

<div id="categoryImgListing" class="categoryImg"><?php echo zen_image(DIR_WS_IMAGES . $categories_image, '', SUBCATEGORY_IMAGE_TOP_WIDTH, SUBCATEGORY_IMAGE_TOP_HEIGHT); ?></div>

<?php

  }

} // categories_image

?>



<?php
12 Dec 2011, 9:06 PM
#15
gjh42 avatar

gjh42

Black Belt

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

Re: Subcategories Not Displaying Under Categories

That section of the file should look like```php

<?php if (PRODUCT_LIST_CATEGORIES_IMAGE_STATUS_TOP == 'true') { // categories_image if ($categories_image = zen_get_categories_image($current_category_id)) { ?> <div id="categoryImgListing" class="categoryImg"><?php echo zen_image(DIR_WS_IMAGES . $categories_image, '', SUBCATEGORY_IMAGE_TOP_WIDTH, SUBCATEGORY_IMAGE_TOP_HEIGHT); ?></div> <?php } } // categories_image ?> <?php // categories_description if ($current_categories_description != '') { ?>

This could not have anything to do with any menus.
13 Dec 2011, 5:10 PM
#16
johnnyh avatar

johnnyh

New Zenner

Join Date:
Oct 2011
Posts:
50
Plugin Contributions:
0

Re: Subcategories Not Displaying Under Categories

Thanks a lot, it works :clap: