🎉 Proudly, we are happy to announce the only Headless solution for PrestaShop. Read More

How PrestaShop Faceted Search Module works?

If you have no important reason to use a third-party module for your search functionality in your shop, do not miss the native module easily.

I recommend to keep using the native PrestaShop Faceted Search module. But why? because:

  • It's highly optimized
  • The module is developed by the PrestaShop team which is fully compatible with PrestaShop code standards
  • Good structure and caching mechanisms

Let me just talk about one of the technical cases in this module. This module gets benefit from its caching system in many operations within the code. One of them is when you see the filters in category pages/or listing pages. But let me show you how.

When you access a category to see all the products which are associated to that category (for example Accessories category), you have the filters list at the left column (attribute filter feature filter, brand filter, etc. For example filter for colors or compositions). The filters can have many shapes, what do I mean? I mean that you may activate one filter, and some filters are active and some of them are not (naturally at the beginning all of them are inactive). For example think of you have two attributes with two values:

red (inactive)
green (active)
Paper Type
ruled (inactive)
plain (inactive)

In a form you may only have red filter active, or in another form you may have three of them active. So, you will have many combinations with these filters. Fetching this list/ getting all attributes with their values (all brands and any other kind of filter) needs a computation. But the module computes it only once on the first request for that combination. And for the future requests it uses the cache value. But where does it store? in the ps_layered_filter_block table in database. So, when you do a clear cache within the configuration page in back-office, actually you clear this table completely.

There are also some other optimizations which the module does within the code, that is why I recommend this module.

Posted 10 months ago by Sam Berry


Add a comment