0

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!

1 Answer 1

0

Sometimes it is because of URL change. Change the URL Key and uncheck the "Rewrite old URL" option. Let me know if it works. Apart from that make sure that it is tagged under Root Category :)

1
  • Hi there, unfortunately did not solve the issue, changed the URL to something totally different and unchecked the redirect and saved, flushed cache and index, it is in the root category and is enabled for the store view :( Commented Apr 27, 2017 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.