Jump to content

[HELP] Faceted search modify query


Recommended Posts

Hi!

I need to modify the query from faceted search module , just add a where clause.

i seen that i can modify it easy from ps_facetedsearch/src/Adapter/MySQL.php.

I've tried to override this class from my module , but my new file is not copied.

If i try to copy it manually, it does not works too.

image.png.f76e4bf120844efd76d50e44b5819a3d.png

image.png.25edc7b36f576c241f98bca0c437eb39.png

 

I try to modify the file when my module is installed ,but prestahop addons do not allow this...

image.png.70baf0a7ba445fbad5f40cb600ba5407.png

I seen that the hook actionProductSearchProviderRunQueryBefore can edit the query , but i don't see how to add my where clause.

 

Do you have any idea?

Thanks!

 

 

Link to comment
Share on other sites

  • 1 month later...

Hi there,

I have the same problem, I need to modify the getQuery function inside ps_facetedsearch/src/Adapter/MySQL.php but I'm not able to to it using an override nor trying to use the hook actionProductSearchProviderRunQueryBefore.

Can anyone explain how the hook actionProductSearchProviderRunQueryBefore should be used properly or point me to the right direction?

Thanks a lot!
Federica

Link to comment
Share on other sites

Hi everyone,

just an update: the hooks provided (actionProductSearchProviderRunQueryBefore and actionProductSearchProviderRunQueryAfter) are not exactly what I need, so I tried to write my own productSearchProvider and I succeeded at some point.

But my goal was just a simple modification of the query inside the faceted search Adapter and I did not want to rewrite the whole productSearchProvider (that takes care of a lot of things!): since I did not find a proper way to extend faceted search productSearchProvider I gave up and I will do my modifications inside ps_facetedsearch/src/Adapter/MySQL.php, I know this is not good programming, but this is the only way I found to reach my goal without reinventing the wheel.

If somebody knows how to properly extend faceted search productSearchProvider (if it is possible), please let me know!

Thanks,
Federica

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