No I agree. The issue is when the cpath is invalid. if there is no stock then i think the message is appropriate. I have this problem because people link in to my shop. and if i change a category and it disappears then it displays no products found on an invalid catategory. If i have no stock for that category then it displays the category with the message saying in my case awaiting stock. I might just be an oddball having invalid categories.
This is what I added/changed from line 108 v1.5.7 about line
/**
* We do some checks here to ensure $_GET['main_page'] has a sane value
*/
$mjfbCheck=True;
if (empty($_GET['main_page'])) $_GET['main_page'] = 'index';
if (!is_dir(DIR_WS_MODULES . 'pages/' . $_GET['main_page'])) {
if (MISSING_PAGE_CHECK == 'On' || MISSING_PAGE_CHECK == 'true') {
$_GET['main_page'] = 'index';
$mjfbCheck=False;
} elseif (MISSING_PAGE_CHECK == 'Page Not Found') {
header('HTTP/1.1 404 Not Found');
$_GET['main_page'] = FILENAME_PAGE_NOT_FOUND;
$mjfbCheck=False;
}
}
//mjfb start Check the category path is valid
if (isset($_GET['cPath']) && $mjfbCheck) {
$cPath = $_GET['cPath'];
if (zen_not_null($cPath)) {
$cPath_array = zen_parse_category_path($cPath);
$cPath = implode('_', $cPath_array);
$current_category_id = $cPath_array[(sizeof($cPath_array)-1)];
} else {
$current_category_id = 0;
}
$mjfb_category_exists_query = "SELECT count(*) AS total
FROM " . TABLE_CATEGORIES . "
WHERE categories_id = :categoriesID";
$mjfb_category_exists_query = $db->bindVars($mjfb_category_exists_query, ':categoriesID', $current_category_id, 'integer');
$mjfb_category_exists = $db->Execute($mjfb_category_exists_query);
if ($mjfb_category_exists->fields['total'] == 0) {
if (MISSING_PAGE_CHECK == 'On' || MISSING_PAGE_CHECK == 'true') {
$_GET['main_page'] = 'index';
} elseif (MISSING_PAGE_CHECK == 'Page Not Found') {
header('HTTP/1.1 404 Not Found');
$_GET['main_page'] = FILENAME_PAGE_NOT_FOUND;
}
}
}
//mjfb end
So I only return page not found for an invalid cpath.
What do you think