The class for the ContextValueRetriever component is atg.commerce.util.ContextValueRetriever, which holds most of the logic for determining which catalog to assign to each user. It performs a parallel function for price lists – see PriceListManager for more information. It has one property, useProfile, which is a boolean that defaults to false. The main method, retrieveValue, goes through the following steps. The method does not continue to the next step if it finds a non-null value.

  1. It calls the shouldUseProfile method (see below). If this method returns true, it retrieves the requested property from the profile.

  2. If a site was provided, it retrieves the requested property from the site. See Assigning Price Lists and Catalogs in a Multisite Configuration for more information.

If ContextValueRetriever returns null, CustomCatalogTools.determineCatalog picks up the default catalog and returns that to the CatalogProfilePropertySetter.

The out-of-the-box implementation of the shouldUseProfile method simply returns the value of the useProfile property. By default this property is set to false, which is appropriate for most multisite environments. The false value means that anything that might already be set in the profile is ignored, and values are retrieved instead from the current site or the global (CatalogTools) default. If you assign catalogs or price lists via your own pipeline servlet or a scenario, set useProfile to true to prevent your profile settings from being overridden with the global defaults.

If your business requires different choices for different customers, you can override shouldUseProfile. For example, assume some special customers (for example employees and sales reps) have values pre-set in their profiles, while most customers should get site defaults. The shouldUseProfile method can look at any profile property to decide if a customer is special or not and return true for the special customers and false for everyone else. In addition, if you want to add another source for catalogs or price lists, beyond profiles and sites, you can override the retrieveValue method.

Note that Oracle ATG Web Commerce provides a single component that handles both catalogs and price lists. This configuration assumes you want to apply the same logic for both types of values, which is common. If you want to apply different logic for catalogs and price lists, you can configure a second Nucleus instance of the ContextValueRetriever component, change its configuration or implementation class, and reconfigure either CatalogTools or PriceListManager to refer to the new instance.

Copyright © 1997, 2012 Oracle and/or its affiliates. All rights reserved. Legal Notices