Yeah, not really the sub categories, more all. Was hoping it wouldn't anything too convoluted, or that someone had already done this. Guess I'll just have to get more fiddly with the xslt.
XSLT is particular about the way bool values are passed. You need to use true() instead of True. Basically True is interpreted as a string, which is in turn interpreted as a false value because everything other than 1 is considered false. I know it's a little weird, but just change the code to the following and you're good to go:
Yes, I am using a catalog name. I have three top-level catelogs and want to list these and all categories below them. Do I need to restructure my products (ie change the catalogs as categories) to be able to list this?
>>You can use the name though. Works just as well.
The xslt is taking the number from the url not the category name. I want to do a comparison. eg. only list subcategories for the selected category
Ah I think what's tripping you up is the fact the the XML returned is hierarchical. Your foreach loop is only grabbing the root categories but not looking at the childcategories elements.
Try outputting the XML structure to see what I'm talking about.
So how can I identify a parent category? I can show child categories when a parent is selected, but as soon as I click on a child all the siblings disappear
Creating an 'all categories' naviagation list
I want to build a heirarchical list of all categories to be on all pages of the store? Any opinions on best practise for this?
I'm still finding my way with uCommerce. Building a store based on the example store
Hi Tony,
Wonderful. I'm glad to hear that you're getting your feet wet with uCommerce :)
CommerceLibrary:GetRootCategories has an option to include all sub categories in the XML. It might be just what you're looking for.
Yeah, not really the sub categories, more all. Was hoping it wouldn't anything too convoluted, or that someone had already done this. Guess I'll just have to get more fiddly with the xslt.
It actually includes the full category hierarchy. Just pass in true for the second argument.
CommerceLibrary:GetRootCategories(string catalogName, bool includeFullStructure)
Cool will have a mess about with it
So changing the RootCategories xslt to this
Should list all categories in the catalog? Doesn't seem to
XSLT is particular about the way bool values are passed. You need to use true() instead of True. Basically True is interpreted as a string, which is in turn interpreted as a false value because everything other than 1 is considered false. I know it's a little weird, but just change the code to the following and you're good to go:
Hmmm. That's not making any difference.
As an aside: When I use GetAllCatalogs() is there a value that represents the 'number' id for the catalog? e.g. @catalogid?
There is in 2.0, but not in 1.5 unfortunately.
You can use the name though. Works just as well.
It's a silly question, but I have to ask: Are you using a catalog name as opposed to a category name in the call to GetRootCategories?
Are you getting some output or nothing at all?
Yes, I am using a catalog name. I have three top-level catelogs and want to list these and all categories below them. Do I need to restructure my products (ie change the catalogs as categories) to be able to list this?
>>You can use the name though. Works just as well.
The xslt is taking the number from the url not the category name. I want to do a comparison. eg. only list subcategories for the selected category
I just tried out this piece of code, which grabs the category XML for all categories in the uCommerce catalog. Works fine:
I modified the uCommerce Store code to test. Maybe you could try it and see how it works out.
The XSLT supports both names and ids in place of each other. Take a look at the reference for more options.
Hope this helps.
Still only giving me the top level categories
Ah I think what's tripping you up is the fact the the XML returned is hierarchical. Your foreach loop is only grabbing the root categories but not looking at the childcategories elements.
Try outputting the XML structure to see what I'm talking about.
OK, think we're getting somewhere.
So how can I identify a parent category? I can show child categories when a parent is selected, but as soon as I click on a child all the siblings disappear
Once you find the category you want by name or id, you can navigate up the XML structure by using the .. operator.
is working on a reply...