views:

1569

answers:

2

I have many sites that use the same root category of the Main Site. Each product that is added is added to the site it was added to (wow.) and also the Main Site. However, I would like categories on a per site basis to only appear if there are products on that site.

If I have:

Category1
Category2
Category3

But Site1 only has products in Category1 and Category2, whereas Site2 and Site3 have products in Category2 and Category3; I only want Category1/2 to appear on Site1 and only Category2/3 to only appear on Site2 and Site3.

However, because all products in Site1/2/3 are also added to the Main Site; the Main Site would list Category1/2/3.

No products are added directly to the Main Site. It simply serves as a repository for the other sites.

Now, if there is no really easy way to enable this (as I'm sure), would it be as simple as writing my own theme that lists categories that only have products on the site that the template is being displayed on?

I am not a novice in the technologies that Magento uses; so writing custom code is no problem. I would, however, not like to edit it that much so that upgrading my code base would be easier in the future with later versions of Magento.

Thanks,
-nelson

+1  A: 

Well, what you can do is, create your own helper with a collection (through a model), and then filter the collection based on product count.

Only a rough draft, but I've posted some code in another magento related question: Magento products by categories. You can see how and when it adds the products count, I'd filter again when this is done.

I don't think this is extremely "great" in terms of performance, so instead of using their model classes, you could write your own, extending it and adding default filters, or shortcutting directly to the database.

As long as you stay in your skin/template, there are no larger issues with updating.

Till
A: 

Take a look at how it is done here for your self http://www.tycrodepot.com

Jim