Hide empty categories

Questions around the TYPO3 integration and plugins
Forum rules
Always add your TYPO3/Flow, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
pixelplumber
Posts: 15
Joined: 26 Oct 2019, 12:38

Hide empty categories

Post by pixelplumber » 13 Jan 2020, 02:53

Is there a configuration option for the catalog filter tree to hide empty categories? Or would this require changes to templates?

Testing CSV import of an entire category tree and at the moment am not working on assigning products. I notice that aimeos will display all categories even if no stock is assigned.

I suppose the wrinkle here is if there is a parent child relationship you can only hide a parent where none of the children have assigned products either?

Or is the built-in solution to use the category.status to disable categories not used yet? The only issue is that needs to be manually tracked?

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

Re: Hide empty categories

Post by aimeos » 13 Jan 2020, 17:54

pixelplumber wrote:
13 Jan 2020, 02:53
Is there a configuration option for the catalog filter tree to hide empty categories? Or would this require changes to templates?
There are three things you mix:
- categories
- products
- stocks

All three are independent at first but there's a relation between categories and products resp. products and stocks. The catalog filter displaying the categries doesn't know by default if there are products attached or if these products are in stock.
pixelplumber wrote:
13 Jan 2020, 02:53
Testing CSV import of an entire category tree and at the moment am not working on assigning products. I notice that aimeos will display all categories even if no stock is assigned.

I suppose the wrinkle here is if there is a parent child relationship you can only hide a parent where none of the children have assigned products either?
Exactly, this is the second problem you will face when you try to hide empty categories automatically.
pixelplumber wrote:
13 Jan 2020, 02:53
Or is the built-in solution to use the category.status to disable categories not used yet? The only issue is that needs to be manually tracked?
This is the easiest option. Another option is the catalog count component which is called by the catalog filter via JS and which returns the number of products that are matched (or assigned without a filter) to the categories. You can use it to hide the categories via CSS if their count is 0 as it is already done for the attribute filter.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply