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
Bookmarks