Jump to content

PHP Fatal error: Call to a member function getSubCategories


Recommended Posts

My shop is built with Prestashop
On a error log file on my server, I can see the following error about 10 times a day :
PHP Fatal error:  Call to a member function getSubCategories() on null in ../controllers/front/ProductController.php on line 551
On the line 551 of the ProductController.php file is : 
 'subCategories' => $this->category->getSubCategories($this->context->language->id, true),

This line is part of the following code :

// various assignements before Hook::exec
            'path' => $path,
            'category' => $this->category,
            'subCategories' => $this->category->getSubCategories($this->context->language->id, true),
            'id_category_current' => (int)$this->category->id,
            'id_category_parent' => (int)$this->category->id_parent,
            'return_category_name' => Tools::safeOutput($this->category->name),
            'categories' => Category::getHomeCategories($this->context->language->id, true, (int)$this->context->shop->id)

I am not a developer and I do not know what could lead to this error.

Would you have any idea of what could make this error ?

Thank you in advance for your any reply.


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...