Jump to content

Overriding ProductListingFrontController does not override SearchControllerCore


MartinHlavna

Recommended Posts

When tailoring shop to my needs I have created override of ProductListingFrontController. However this change is not applied to SearchController which extends from ProductListingFrontController. Checking the source revealed it extends directly from ProductListingFrontControllerCore, not from ProductListingFrontController as other product listing contollers where it works. Is this behaviour by design, or it is a bug? 

 

Thanks for reply

Link to comment
Share on other sites

So this is what the core extension looks like...

 

ProductPresentingFrontController

  ->ProductListingFrontControllerCore

    ->SearchControllerCore

 

Now you create an override for ProductListingFrontControllerCore, and your override class name is ProductListingFrontController.  And that looks like this...

 

ProductPresentingFrontController

  ->ProductListingFrontControllerCore

    ->ProductListingFrontController

 

But SearchControllerCore does not extend ProductListingFrontController, it extends ProductListingFrontControllerCore.  So SearchControllerCore will not utilize your override class, since it still extends directly from ProductListingFrontControllerCore. 

 

And yes, that is how Prestashop designed overrides

 

And Prestashop does not want you using overrides, have you looked at the code to see if you can accomplish your customization using hooks?

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...