Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2007
    Posts
    156
    Plugin Contributions
    0

    Default sub categories only on main page

    Hi,
    I wonder if anyone can help me, I am using zen 1.3.8a

    The link to my site is www.personalised-certificates.com so you can see what I'm talking about.

    At the moment I have 1 category which contains sub categories (baby names). If you click on Baby names in the left side menu you can see that the sub categories are listed below baby names. On the main page the subcategories are also listed but under the main page content. I would like to have just the sub categories listed on the main page (not the main page content) when a category with sub categories is clicked.

    I hope that makes sense and I hope someone can help me with this issue.

    Thanks

  2. #2
    Join Date
    Jul 2007
    Posts
    156
    Plugin Contributions
    0

    Default Re: sub categories only on main page

    Ok after stumbling across an old topic in the forum I've found what is causing the problem, its the FAQ manager. If I delete the file includes->open-operations->faq_application_top.php
    the sub categories work fine but the faq module stops working.

    I've had a quick look at the code of that page and it does mention get main page but I don't know enough about php to solve the issue.

    Does anyone know how to stop the page from calling the main page up and still keep the faq module working?

    Here is the code from that page:
    Code:
    <?php
    //
    // +----------------------------------------------------------------------+
    // |zen-cart Open Source E-commerce                                       |
    // +----------------------------------------------------------------------+
    // | Copyright (c) 2003 The zen-cart developers                           |
    // |                                                                      |
    // | http://www.zen-cart.com/index.php                                    |
    // |                                                                      |
    // | Portions Copyright (c) 2003 osCommerce                               |
    // +----------------------------------------------------------------------+
    // | This source file is subject to version 2.0 of the GPL license,       |
    // | that is bundled with this package in the file LICENSE, and is        |
    // | available through the world-wide-web at the following url:           |
    // | http://www.zen-cart.com/license/2_0.txt.                             |
    // | If you did not receive a copy of the zen-cart license and are unable |
    // | to obtain it through the world-wide-web, please send a note to       |
    // | [email protected] so we can mail you a copy immediately.          |
    // +----------------------------------------------------------------------+
    // $Id: faq_manager.php 001 2005-03-27 [email protected]
    //
    if (isset($_GET['faqs_id'])) $_GET['faqs_id'] = ereg_replace('[^0-9a-f:]', '', $_GET['faqs_id']);
    if (isset($_GET['fcPath'])) $_GET['fcPath'] = ereg_replace('[^0-9_]', '', $_GET['fcPath']);
    while (list($key, $value) = each($_GET)) {
    $_GET[$key] = ereg_replace('[<>]', '', $value);
    }
    // validate faqs_id for search engines and bookmarks, etc.
      if (isset($_GET['faqs_id']) and $_SESSION['check_valid'] != 'false') {
        $check_valid = zen_faqs_id_valid($_GET['faqs_id']);
        if (!$check_valid) {
          $_GET['main_page'] = zen_get_info_faq_page($_GET['faqs_id']);
          // do not recheck redirect
          $_SESSION['check_valid'] = 'false';
          zen_redirect(zen_href_link($_GET['main_page'], 'faqs_id=' . $_GET['faqs_id']));
        }
      } else {
        $_SESSION['check_valid'] = 'true';
      }
    // calculate faq_category path
      if (isset($_GET['fcPath'])) {
        $fcPath = $_GET['fcPath'];
      } elseif (isset($_GET['faqs_id']) && !zen_check_url_get_terms()) {
        $fcPath = zen_get_faq_path($_GET['faqs_id']);
      } else {
        if (SHOW_FAQ_CATEGORIES_ALWAYS == '1' && !zen_check_url_get_terms()) {
          $show_welcome = 'true';
          $fcPath = (defined('FAQ_CATEGORIES_START_MAIN') ? FAQ_CATEGORIES_START_MAIN : '');
        } else {
          $show_welcome = 'false';
          $fcPath = '';
        }
      }
      if (zen_not_null($fcPath)) {
        $fcPath_array = zen_parse_faq_category_path($fcPath);
        $fcPath = implode('_', $fcPath_array);
        $current_faq_category_id = $fcPath_array[(sizeof($fcPath_array)-1)];
      } else {
        $current_faq_category_id = 0;
        $fcPath_array = array();
      }
    // add faq_category names
      if (isset($fcPath_array)) {
        for ($i=0, $n=sizeof($fcPath_array); $i<$n; $i++) {
          $faq_categories_query = "select faq_categories_name
                               from " . TABLE_FAQ_CATEGORIES_DESCRIPTION . "
                               where faq_categories_id = '" . (int)$fcPath_array[$i] . "'
                               and language_id = '" . (int)$_SESSION['languages_id'] . "'";
    
          $faq_categories = $db->Execute($faq_categories_query);
    
          if ($faq_categories->RecordCount() > 0) {
            $breadcrumb->add($faq_categories->fields['faq_categories_name'], zen_href_link(FILENAME_FAQS, 'fcPath=' . implode('_', array_slice($fcPath_array, 0, ($i+1)))));
          } else {
            break;
          }
        }
      }
      require(DIR_WS_CLASSES . 'faq_category_tree.php');
    ?>
    Thanks

  3. #3
    Join Date
    Jul 2007
    Posts
    156
    Plugin Contributions
    0

    Default Re: sub categories only on main page

    Problem solved.

    For anyone else who has this problem here is what I did:

    open file includes->open-operations->faq_application_top.php
    around line 46 find:
    Code:
    $show_welcome = 'true';
    and replace with:
    Code:
    $show_faq_welcome = 'true';
    Then in the same file around line 49 find:
    Code:
    $show_welcome = 'false';
    and replace with:
    Code:
    $show_faq_welcome = 'false';
    Next open file includes->templates->YOUR_CUSTOM_TEMPLATE->templates->tpl_index_faq_categories.php
    around line 25 find:
    Code:
    if ($show_welcome == 'true') {
    and replace with:
    Code:
    if ($show_faq_welcome == 'true') {
    Upload both files and all should work fine.

  4. #4
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: sub categories only on main page

    Excellent bugfix posting - thanks for sharing so coherently. Have you also added this info to the relevant thread where the problem was being discussed?

  5. #5
    Join Date
    Jul 2007
    Posts
    156
    Plugin Contributions
    0

    Default Re: sub categories only on main page

    Hi gjh42,
    No I haven't added it to the other topic, but that's a good idea. I'll try and find the topic again and add the fix to it.

 

 

Similar Threads

  1. v139h Sub Categories not showin on main page
    By ginar in forum General Questions
    Replies: 2
    Last Post: 5 Jul 2012, 02:06 PM
  2. Alignment of Sub Categories on Main Category Page
    By DJPCMH in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 5 Aug 2010, 11:40 AM
  3. sub-categories on main page
    By gprit in forum Basic Configuration
    Replies: 0
    Last Post: 26 Jul 2009, 01:58 PM
  4. Show sub categories for one main category on main page
    By relspeedwagon in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 12 Oct 2008, 11:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg