Jump to content

Home Category Returns 404


Recommended Posts

I recently upgraded my shop to PrestaShop 1.6. I previously had my shop laid out to use the Home category page as the top level of my shop, with the subcategories listed there. Now when I try navigating to the Home category I get a 404 error (http://shop.url/2-home).  Is anyone else having this problem?

 

I've dug around and can't seem to fix the issue.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

Did you find a fix for this? I upgraded to 1.6, and now all of my category pages return a 404 not found. I am also using home as my root category. Product, and manufacturer pages seem to be working fine.

Link to comment
Share on other sites

  • 2 weeks later...

Hello. I faced this problem too and found a solution. Might seem a little dirty, but it seems it is the only way out, since we ain't got an option to override module classes in PrestaShop 1.6.
 
Anyway, here is the solution:
 
Step 1: Backup the file controllers/front/CategoryController.php so that you can rollback if and when you want to;
 
Step 2: In line 62, there is an if with a condition like:

if (!Validate::isLoadedObject($this->category) || !$this->category->inShop() || !$this->category->isAssociatedToShop() || in_array($this->category->id, array(Configuration::get('PS_HOME_CATEGORY'), Configuration::get('PS_ROOT_CATEGORY'))))

You need to remove the condition for home, i.e. the modified line should read like:

if (!Validate::isLoadedObject($this->category) || !$this->category->inShop() || !$this->category->isAssociatedToShop() || in_array($this->category->id, array(Configuration::get('PS_ROOT_CATEGORY'))))

Now, the 404 issue should be solved. However, products still won't show up on the home category.

 

Step 3: In line 195, there is another if with a condition, which you would need to change to:

if (!$hookExecuted || is_null($this->nbProducts))

Yay! That should take care of your problem! Took care of mine.

  • Like 2
Link to comment
Share on other sites

  • 2 months later...
×
×
  • Create New...