Code to Hide Searchable Categories

For some sites, searchable categories have been defined that reflect product types that are valid across various departments. These categories are intended to facilitate searching, and are different from the hierarchy of categories that are shown to users. Displaying searchable categories on the site could confuse your users.

When displaying categories on the site, your code should first check to see whether the category has the IsSearchable attribute set to True. If so, that category should not be shown. The following example filters the "Shoes" category to remove any searchable child categories. Your code should have similar filters wherever categories are going to be displayed.

' oCatalog is an existing ProductCatalog object.
Dim rsCategories
Set rsCategories = oCatalog.GetCategory("Shoes").ChildCategories

' Remove searchable categories from the recordset.
rsCategories.filter "IsSearchable = FALSE"

After running this code, the rsCategories recordset contains only shoe categories that are appropriate for display.

Copyright © 2005 Microsoft Corporation.
All rights reserved.