Closed bdgeorge closed 12 years ago
Thanks for your report. The issue occurs because the layer model uses the root category as the default current category. A bit longer explanation:
The exception is triggered because in effect a non-existant root category is assigned to the current store.
There is no easy way to change this behavior, besides making it impossible to hide root categories. In most cases this would be no problem, since the root category is rarely used in stores besides it's function as a container for all normal categories. It would certainly break your setup since you seem to rely on having the root hidden.
I suggest you rework your rules so you don't hide the root category, but instead rely only on regular categories.
Thanks Vinai, hiding the root category seemed like the most elegant architecture for a members only store, I'll see how else I can go about this.
The problem only occurs if the root category is hidden and you the try to use the product list block. If there where an easy way to fix this I would be happy to do it, but so far I can't think of a clean way to do so.
If I have a root category that is visible only to a certain group, but then I choose to remove all restrictions from a sub-category under it I'm finding that I still can' t access that subcategory from within a custom layout or {{block}} rule. I can access the sub-category via it's URL but I can't access it from XML or {{block}} syntax.
So as an example, say I have a CMS page which contains some new products called up like this:
Then I set the root category to be visible only to logged in users and this new products category is set to be visible to all. If I then visit the CMS page that holds the block it triggers an "Invalid category" exception.
In the stack trace there's no sign of Groups catalog , but I can work around the problem by disabling Groups catalog so I'm sure it's coming from here.
My current solution is to set a registry key from my layout xml files that I then use to disable groups catalog on specific pages, so a tweak in Data.php like this
Then I create a new block to set/unset registry keys so I can trigger it from a theme.
So I'm not sure if this is a bug or a feature request: 1) having an exception triggering response to inserting a {{block}} or seems like a bug,
2) being able to deliberately 'punch holes' in the groups catalog system from the layout files feels very much like a useful new feature that themes can make use of.