Jump to content

[Solved] override Search isn't called by Prestashop


matavz
 Share

Recommended Posts

Hello everyone,

I was creating my own module, and I firstly extended the classes/Search.php file by adding the following function:

static public function getCustomFieldSearchResults($aData, $pageNumber = 1, $pageSize = 10, $orderBy = 'relevance', $orderWay = 'desc'){
// here my logic
}



this all worked.
but then I read something about overriding classes and that this approach is better to do, so I removed my function from classes/Search.php and instead created the following file in override/classes/Search.php :

class Search extends SearchCore
{
   static public function getCustomFieldSearchResults($aData, $pageNumber = 1, $pageSize = 10, $orderBy = 'relevance', $orderWay = 'desc'){
// here my logic
}
}



but this doesn't work. I've turned on error reporting and no matter what I do, whenever I try to call this new function I keep on getting this error:

Fatal error: Call to undefined method SearchCore::getCustomFieldSearchResults() in /var/www/presta142/controllers/EPCSearchController.php on line 154


does anyone know what I'm doing wrong?

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More