Jaa


How to Delete a Product

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

You can delete products from a base catalog or a virtual catalog by using the DeleteProduct method of the BaseCatalog object. This method deletes the product from the catalog and stores the ProductId to support exporting deleted items. This method does not delete the product from the catalog database. You must use the PurgeDeletedItems method to remove the category from the catalog database.

To delete a product from a catalog

  1. Get the catalog that contains the product to be deleted.

  2. Delete the product by using the DeleteProduct method.

Example

This example deletes a product with a specified productId from an existing catalog named "Outdoor Equipment."

public static void DeleteProduct(CatalogContext context)
{
    // Get the catalog.
    BaseCatalog baseCatalog = (BaseCatalog)CatalogContext.GetCatalog("Outdoor Equipment");
    // Delete the product with the specified productId.
    baseCatalog.DeleteProduct("IR0874");    
}

See Also

Other Resources

How to Create a Base Catalog by Using the Catalog API