Share via


Code to Activate or Deactivate a Product

Normally, catalog data is visible to users as soon as it is placed in the Product Catalog System. It is possible to activate or deactivate a product in a catalog, that is make it visible or hide it from users, by adding an additional property to that product, and then filtering on that property.

The following provides steps on how to implement this scenario:

  1. Define a new property of type number and call it "IsActive" and set the AssignToAll attribute to True and the DisplayOnSite attribute to False. Set the default value to either 0 (not available) or 1 (available).

  2. When creating or editing products, a value can be specified for this property, either 0 (not available) or 1 (available).

  3. Filter any recordsets of products, such as those returned from the Category.ProductsCatalogManager.QueryCatalogManager.FreeTextSearchProductCatalog.GuaranteedSpecificationSearchProductCatalog.PerformSpecificationSearch methods by specifying an ActiveX Data Object (ADO) filter on the recordset as "IsActive=1".

For example, wherever you have code similar to the following:

rsProducts = oCatalog.GetCategory(strCategoryName).Products

You need to follow it with:

rsProducts.filter = "IsActive=1"

Ee797348.note(en-US,CS.10).gif Note

  • Caching of HTML may prevent products from appearing on the Web site until the cache is flushed.


All rights reserved.