I'm using mall, and I want to filter products by their categories, and than search only products in this category. Is it possible? If yes, where should I dig to do this?
This is not supported out-of-the-box but can be added easily:
Create your own search provider as described in the README.
Extend the ProductsSearchProvider and override it's searchProductsFromDefaultLocale
and searchVariantsFromDefaultLocale
methods with a whereHas('categories', ...)
condition that includes the categories you wish to search for.
You can pass the categories along with your search form and access them using the post()
helper.
I cant find my mistake - all works, but i have two serachresults, mine - from category, and second - from all products. I mean i have two queries, but I want only one - mine, from categories.
It works, if I just put my method into ProductsSearchProvider, but if I listen sitesearchextend i have two results of searching
Last updated
Hello, How could we deactivate JiriJKShopResultsProvider ? I extended sitesearch:
public function boot() { Event::listen('offline.sitesearch.extend', function () { return new JiriJKShopResultsExtendedProvider();
// or
// return [new DocumentsSearchProvider(), new FilesSearchProvider()];
});
}
and now I want to disable JiriJKShopResultsProvider as it returns two results now.
Last updated
My new provider does not seem to appear in backend, however it works. And when JiriJKShopResultsProvider is disabled it does not work anymore.
Last updated
Ah, now I see, you have extended the original provider. In this case you can override the isInstalledAndEnabled
method in your provider and simply return true
. This way, the built in provider will be disabled (via the backend settngs) but your custom provider will always be enabled:
1-9 of 9