Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2009
    Posts
    264
    Plugin Contributions
    1

    Default Main page not displaying categories and being marked as 404 not found.

    URL:Innerlightcrystals.co.uk/sales
    ZC version: 1.5.7b
    PHP version:7.2

    The main page (top page) is no longer displaying the sub categories (level below top). also the page is returning 404 status.

    This behaviour has appeared since 1.5.6c prior to that it worked fine. I have looked at the code and I think I know the cause.

    /includes/modules/pages/index/header_php.php
    PHP Code:
    $category_depth 'top';
    $current_category_not_found false;
    $current_category_is_disabled false;
    $current_category_has_products false;
    $current_category_has_subcats false;
    if (isset(
    $cPath) && zen_not_null($cPath)) {
        
    $category_status_query 
            
    "SELECT categories_status
               FROM " 
    TABLE_CATEGORIES "
              WHERE categories_id = :currentCategoryId
              LIMIT 1"
    ;
        
    $category_status_query $db->bindVars($category_status_query':currentCategoryId'$current_category_id'integer');
        
    $category_status $db->Execute($category_status_query);
        if (
    $category_status->EOF) {
            
    $current_category_not_found true;
        } elseif (
    $category_status->fields['categories_status'] == '0') {
            
    $current_category_is_disabled true;
        } 
    sets $current_category_not found = true;
    this causes
    PHP Code:
        if (!$category_redirect_handled) {
            if (
    $current_category_not_found) {
                unset(
    $_GET['cPath']);
                
    $breadcrumb->reset();
                
    $robotsNoIndex true;
                
    header('HTTP/1.1 404 Not Found');
    //-bof-Comment the following four (4) lines out to display disabled categories
            
    } elseif ($current_category_is_disabled) {
                
    $category_depth 'products';
                
    $robotsNoIndex true;
                
    header('HTTP/1.1 410 Gone');
    //-eof-Comment the above four (4) lines out to display disabled categories
            
    } elseif ($current_category_has_products) {
                
    $category_depth 'products';
            } else {
                
    $category_depth = ($current_category_has_subcats) ? 'nested' 'products';
            }
        } 
    For the index page.
    The reason for this is that the $cPath variable is set in includes/init_includes/init_category_path.php during the autoload.
    PHP Code:
    if (!defined('IS_ADMIN_FLAG')) {
      die(
    'Illegal Access');
    }
    $show_welcome false;
    if (isset(
    $_GET['cPath'])) {
      
    $cPath $_GET['cPath'];
    } elseif (isset(
    $_GET['products_id']) && !zen_check_url_get_terms()) {
      
    $cPath zen_get_product_path($_GET['products_id']);
    } else {
      if (
    $current_page == 'index' && SHOW_CATEGORIES_ALWAYS == '1' && !zen_check_url_get_terms()) {
        
    $show_welcome true;
        
    $cPath = (defined('CATEGORIES_START_MAIN') ? CATEGORIES_START_MAIN '');
      } else {
        
    $show_welcome false;
        
    $cPath '';
      }

    in my case it is $cPath = (defined('CATEGORIES_START_MAIN') ? CATEGORIES_START_MAIN : '');
    this sets $cPath to 0 for me as CATEGORIES_START_MAIN=0 for top.
    This causes $category_depth to be set to "top" instead of "nested" as it was with 1.5.6c

    Am I doing something wrong? or is this a bug?

    I hope I have given enough info for you to resolve. I could hardcode a temporary measure (on my site). Unfortunately i do not understand enough of consequence of change to suggest a fix.

    Regards
    Mark
    Mark Brittain
    http:\\innerlightcrystals.co.uk\sales\

  2. #2
    Join Date
    Jan 2004
    Posts
    66,263
    Blog Entries
    7
    Plugin Contributions
    270

    Default Re: Main page not displaying categories and being marked as 404 not found.

    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Apr 2009
    Posts
    264
    Plugin Contributions
    1

    Default Re: Main page not displaying categories and being marked as 404 not found.

    sounds like it. I have got around it by checking if the $cpath=0 and if it is not performing the first check.
    PHP Code:
    $category_depth 'top';
    $current_category_not_found false;
    $current_category_is_disabled false;
    $current_category_has_products false;
    $current_category_has_subcats false;
    if (isset(
    $cPath) && zen_not_null($cPath)) {
    if(
    $cpath <> 0) {
        
    $category_status_query 
            
    "SELECT categories_status
               FROM " 
    TABLE_CATEGORIES "
              WHERE categories_id = :currentCategoryId
              LIMIT 1"
    ;
        
    $category_status_query $db->bindVars($category_status_query':currentCategoryId'$current_category_id'integer');
        
    $category_status $db->Execute($category_status_query);
        if (
    $category_status->EOF) {
            
    $current_category_not_found true;
        } elseif (
    $category_status->fields['categories_status'] == '0') {
            
    $current_category_is_disabled true;
        }

    Is there another fix?
    Mark Brittain
    http:\\innerlightcrystals.co.uk\sales\

  4. #4
    Join Date
    Apr 2009
    Posts
    264
    Plugin Contributions
    1

    Default Re: Main page not displaying categories and being marked as 404 not found.

    just seen your fix $cpath > 0.
    Will mod my fix to be the same. Thanks sorry for the duplicate.
    Mark Brittain
    http:\\innerlightcrystals.co.uk\sales\

  5. #5
    Join Date
    Jan 2004
    Posts
    66,263
    Blog Entries
    7
    Plugin Contributions
    270

    Default Re: Main page not displaying categories and being marked as 404 not found.

    The problem affected v157, v157a, v157b.
    v157c was just released, and contains that fix.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. Replies: 9
    Last Post: 25 Jul 2014, 01:55 AM
  2. v1.2.x 1.3.9e URL Mapping and 404 page not found
    By shahchiragg in forum Customization from the Admin
    Replies: 0
    Last Post: 4 Feb 2012, 08:57 AM
  3. Admin 404 Not Found The requested URL was not found on this server
    By L.a.Willman in forum Installing on a Windows Server
    Replies: 23
    Last Post: 10 Jan 2012, 02:26 AM
  4. 404 Not Found Page Not Found not working!
    By NamSingh in forum Basic Configuration
    Replies: 0
    Last Post: 15 Oct 2006, 10:31 AM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR