Filters

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
karpati
Posts: 14
Joined: 08 Feb 2022, 20:42

Filters

Post by karpati » 27 Mar 2022, 15:49

Hi!

The filter on the catalog page also displays attributes that are not relevant to that category.
How do I set it to not show attributes from another category?

For example:

First category:
Red and blue products

Second category:
Blue and green products

When I look at the first category, the filter shows red, blue, and green colors.

There is no green product in the first category, so it should not be shown in the filter.

User avatar
aimeos
Administrator
Posts: 7894
Joined: 01 Jan 1970, 00:00

Re: Filters

Post by aimeos » 28 Mar 2022, 07:38

The attributes are always in the filters but you can hide them using the catalog/count JS if there are no products available for that attribute:
https://github.com/aimeos/ai-client-htm ... dy.php#L19
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

karpati
Posts: 14
Joined: 08 Feb 2022, 20:42

Re: Filters

Post by karpati » 31 Mar 2022, 19:24

If I remove disabled items, the ones that are relevant in that category will also disappear after the first click in the filter.
I only want to remove attributes that are not specific to any product in that category.
Is there a way to do that?

User avatar
aimeos
Administrator
Posts: 7894
Joined: 01 Jan 1970, 00:00

Re: Filters

Post by aimeos » 03 Apr 2022, 08:22

The default behavior should be that the attributes with no product number are disabled and if one attribute type has no attribute active attributes, than the complete attribute type with all attributes is hidden.

The only other way would be to store the attribute types that are relevant to the category somewhere so the frontend knows if the attribute type should be displayed at all. But that requires a custom implementation.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply