As we saw in the introduction of this chapter, sometimes hooks are not sufficient to meet the needs of developers; hooks can't alter the default process of PrestaShop. We could add code to core classes; however, it is not recommended, as all those core changes will be erased when PrestaShop is updated using the autoupgrade module (even a manual upgrade would be difficult). That's where overrides take the stage.
To do so, you have to create an
override directory in the root of your module's directory. Then, you just have to place your override files respecting the path of the original file that you want to override. When you install the module, PrestaShop will automatically move the override to the
overrides directory of PrestaShop.
In our case, we will override the
getProducts method of the
/classes/Search.php class to display the grade and the number...