Show products from subcategories.

Mar 25, 2010 at 9:26 AM

For example, I have categories:

  • Hardware (0)
  • Hardware (0) -> HDD (5)
  • Hardware (0) -> Video (6)
  • Hardware (0) -> Cooler (2)
  • Hardware (0) -> Processor (8)
  • ...

In brackets the count of products.

If I choose the category of Hardware, the list of products will be empty :(

How can I make when choosing one category shows all the products in this category, including all sub-categories?


Mar 25, 2010 at 10:52 AM


In the module setting of the categorylist module there is an option clalled "Skip Empty Categories:", this will skip any empty categories, unfortunatly a cascade product selection to include all sub categories, is not available at the moment, but is planned for a future release.



Apr 19, 2010 at 5:00 AM


I am download and install the new version 2.0.11. And I not found the function to "shows all the products in this category, including all sub-categories". :(

Option "Skip Empty Categories:" I am used, but this is not what I want.

Apr 19, 2010 at 6:24 AM
Hi, The cascade option is still not available in v2.0.11, be best you can do at the moment is place each product in the parent category and in the sub category. This will give the effect your after I think?....but it is quite a bit of work if you have a lot of products. I'm cuurent doing the alpha of the next release and I see if I can fit in the cascade option, although I can;t make any promises. Regards, Dave.
Apr 20, 2010 at 12:57 AM

Thank you for your prompt response.
Yes, move the products I can not. Because the products I import from another program.
On this issue, too, will make a separate question
I'll try to remake SQL procedure NEvoweb_NB_Store_Products_GetList :)

Apr 20, 2010 at 6:07 AM

I am make it. Maybe someone will need

1. Create the function NB_Store_GetCategoryChildIDs:

CREATE FUNCTION {databaseOwner}[NB_Store_GetCategoryChildIDs] (@CategoryID int)
      RETURNS @tbl TABLE (number  int NOT NULL) AS
      DECLARE @pos      int
		INSERT @tbl (number) VALUES (@CategoryID)

		INSERT @tbl (number) 
			SELECT [CategoryID]
			FROM {databaseOwner}[{objectQualifier}NB_Store_Categories]
			WHERE [ParentCategoryID] = @CategoryID

		SET @pos = 1
		WHILE @pos <= 4
			INSERT @tbl (number)
				SELECT [CategoryID]
				FROM {databaseOwner}[{objectQualifier}NB_Store_Categories],
					@tbl ss
				WHERE [ParentCategoryID] = ss.number
			SET @pos = @pos + 1


2. Modify the procedures NEvoweb_NB_Store_Products_GetList, NEvoweb_NB_Store_Products_GetListSize


if (@CategoryID > 0 and @Filter = '')
		set @SQL = @SQL + ' and PC.CategoryID = ' + convert(nvarchar(5),@CategoryID)


if (@CategoryID > 0 and @Filter = '')
		set @SQL = @SQL + ' and PC.CategoryID IN (select * from NB_Store_GetCategoryChildIDs(' + convert(nvarchar(5),@CategoryID) + '))'


Apr 20, 2010 at 6:34 AM
Hi, Thanks for posting your solution, while you where doing this, I been putting in the functionaity for the next release...I've gone for the approach of creating the categorylist in and passing it to the procedure, because I think it'll be less load on the DB and therefore a bit quicker, plus I can also then easily add an option to the productlist setting to turn cascade on or off. This solution should work nicely for anyone that needs this functionality before the next release. Thanks, Dave.
Feb 13, 2011 at 2:05 PM

Where exactly is the Skip Empty Categories setting? What node in the Settings tree is it at? I need to skip empty categories.


Feb 14, 2011 at 8:14 AM
ccaspers wrote:

Where exactly is the Skip Empty Categories setting? What node in the Settings tree is it at? I need to skip empty categories.


That's in the category module settings. Look near the end for "Skip Empty Categories". It's the 8th setting from the bottom - The bottom being the "Product List Tab"



Feb 14, 2011 at 12:59 PM

Yes, I did manage to find late last night sometime after posting. I was so used to looking in back office that I didn’t think to check module settings.

Thanks for pointing it out.