FIltering in combination with categories

  • Posts: 52
  • Thank you received: 4
  • Hikashop Multisite
3 years 7 months ago #323250

-- HikaShop version -- : 4.3.0 buisness
-- Joomla version -- : 3.9.20
-- PHP version -- : 6.3.20
-- Browser(s) name and version -- : Firfox latest

I have a website with some product categories and within the product categories subcategories. This means when the user is selecting the main category on the main pagina, he is seeing on the next page all subcategories (the images and name). Because there are a lot of products with their own specs it would be nice if I could filter it on some specs, like kind of material, color, etc. This can of course be done on product-based, but I like to have it a category based so that the user sees the picture of these products only.

What should be the best method to get this? Especially for the end-user, it is much more handsome. Who has a smart ID/Solution?

Please Log in or Create an account to join the conversation.

  • Posts: 81378
  • Thank you received: 13037
  • MODERATOR
3 years 7 months ago #323259

Hi,

Filtering can only be applied to a products listing page and I can see that the filter module you have works fine on the products listing of each category you have.
I see that you configured the filter module to also appear on the categories listing page.
You can have it work on these pages too but in that case you need to either:
- change the "sub element filters" setting of the "products options" tab of your menu items to "all sub elements" instead of "direct sub elements" so that the products listing of all the products of the sub categories will display at the bottom when you access the categories listing page. That way, the filter module will refresh that products listing.
- activate the "force redirect" setting of the filter module and configure the "menu item id" setting above with the id of a menu item configured to display all your products. That way, when using the filter module it will redirect to that listing of all the products and filter the products based on what you selected. You could, with Advanced modules manager, have two different filter module, one for the categories listing pages, and one for the products listing pages so that it would only redirect with the one on the categories listing and stay on the current page for the products listings.

Please Log in or Create an account to join the conversation.

  • Posts: 52
  • Thank you received: 4
  • Hikashop Multisite
3 years 7 months ago #323277

Thanks Nicolas,

This implementation is not real user friendly, but is there a way that I can read the current filter settings on the category page?

On the way I'm using the filter module right now it is remembering what filter was set.

So, what I try to build is:
1. get all filtered id's for the prducts,
2. get all categories id's for the products this will be placed in an array
3. before a category is showed on the screen form file catogory/linsting_div.php I will check if the cat_id is in the array from step 2. If so, the category is showed on the screen, otherwise, the next category is checked the process is going on.

So what I need: All current filter settings and all products that belong to that filter. I tried to use the functions or getFilters and getProdcutList from the class/filter.php. But that seems not be working or I do something wrong.

Please help/advise if how I can get set filters and filters product list.

Please Log in or Create an account to join the conversation.

  • Posts: 81378
  • Thank you received: 13037
  • MODERATOR
3 years 7 months ago #323295

Hi,

The list of the filtered products ids is indeed retrieved by the call to getProductList in the product / filter.php view file.
However, this supposes that in the first parameter to getProductsList, which is an object, you have an attribute listingQuery which contains almost the full MySQL query (minus the select part as it will be changed to only have the ids of the products loaded) loading all the products without filtering.
That's probably what you're missing in your code.

Please Log in or Create an account to join the conversation.

Time to create page: 0.058 seconds
Powered by Kunena Forum