So I have made a new category and copied all settings from another working category with a new name and url etc but I get a 404 when hitting the category frontend.
When trying to debug this I have found the following...
#File: app/code/core/Mage/Catalog/controllers/CategoryController.php
if (!Mage::helper('catalog/category')->canShow($category)) {
return false;
}
The CanShow function above returns false when I hit the category.
When looking at the below file you can see my comments regarding what is happening:
#File: app/code/core/Mage/Catalog/Helper/Category.php
public function canShow($category)
{
if (is_int($category)) {
$category = Mage::getModel('catalog/category')->load($category);
//THIS $category VARIABLE IS NOT SET
}
if (!$category->getId()) {
return false;
//NOT RETURNED FASLE
}
if (!$category->getIsActive()) {
return false;
//NOT RETURNED FASLE
}
if (!$category->isInRootCategoryList()) {
return false;
//NOT RETURNED FASLE
}
return true;
//RETURNS TRUE BUT NO $category IS SET
}
If I visit a product inside the category it works fine and the category URL is in the URL e.g. /shop/categoryname/product-url/
I have flushed the cache and reindexed etc.
Can anyone offer any advice on what I can do to stop this 404? Other categories created in the past are working fine, only new ones are affected!