10 Replies Latest reply: Sep 3, 2013 3:06 PM by Nitin Dubey RSS

    how to associate a default catalog to CatalogTools in 10.2

    945765

      Hi Guys,

       

      Can you throw your ideas.

      how to associate a default catalog to CatalogTools in 10.2.

       

      can i associate catalog to user through scenario in ATG10.2 ?

       

      Thank you.

        • 1. Re: how to associate a default catalog to CatalogTools in 10.2
          vgk2716

          This logic is already built in OOTB. Refer: Oracle ATG Web Commerce - Assigning a Catalog to a User

           

          By default, ATG takes all items of type catalog and considers 0th element as default.

           

          Gopi

          • 2. Re: how to associate a default catalog to CatalogTools in 10.2
            945765

            Thank you for your response.

             

            I am seeing null value to the 'defaultCatalog' property in catalogtools at dyna admin console.

             

            if ATG do the default association, I assume, the 'defaultCatalog' property value in catalogtools should not be empty.

            • 3. Re: how to associate a default catalog to CatalogTools in 10.2
              vgk2716

              Default Catalog derivation logic could have build in doStartService() method of CustomCatalogTools Class.

               

              1. Check whether you have overridden doStartService() method in your code base. If you have overridden, add super.doStartService() to get this logic executed.

              2. Verify there is atleast one catalog item present in your Product Catalog with item-descriptor 'catalog'.

              • 4. Re: how to associate a default catalog to CatalogTools in 10.2
                945765

                i did't overridden any component.

                 

                I created the 2 catalogs and i logged in to the application.

                checked the catalog property in profile. it is empty.

                • 5. Re: how to associate a default catalog to CatalogTools in 10.2
                  Karanthakural

                  You can associate a default catalog through CatalogTools component.You can add in the properties file

                  defaultCatalogId=Your_catalog_id

                   

                  Generally,we attach default catalog through BCC.

                   

                  Karan

                  • 6. Re: how to associate a default catalog to CatalogTools in 10.2
                    ClareR-Oracle

                    Gopi's first reply to your question was not quite correct.  ATG, more specifically CatalogTools, sets the default catalog automatically only if there is exactly one item of type catalog in the repository.  If you have two catalog items, CatalogTools does not attempt to guess which one would make sense as the default, which leaves you with an empty defaultCatalog property.  As Karan said, you have the option of configuring the default catalog ID by hand in the properties file.  If you want to set defaultCatalog at startup and have more than one catalog item, you have to write some custom code to apply whatever logic is appropriate to select the default.

                     

                    It is possible to associate a catalog with a user in a scenario.  That ability has existed for many releases and should still work.  Depending on what event you want to use to trigger the scenario, you might want to set the user.catalog property or user.myCatalog.  The catalog property is request scoped, meaning it has to be reset for every request.  The myCatalog property persists in the database.  If you write a scenario to set myCatalog, you probably also need to set catalog to make sure catalog is filled in for the duration of the request that triggers the scenario.

                    • 7. Re: how to associate a default catalog to CatalogTools in 10.2
                      945765

                      Hi Clare R,

                       

                      Thank you, you have given worthy information.

                       

                      When i am trying to do the catalog association by using scenarios, the catalog is not getting saved to the profile and if i query the data base, i am getting a empty results.

                      I will update this post once after i do the catalog association to user's myCatalog property using the scenarios.

                       

                      let me try that.

                       

                      Thank you

                      • 8. Re: how to associate a default catalog to CatalogTools in 10.2
                        user8729783

                        Hi

                        Below is the Code Snippet to Associate a Catalog to Profile Write one Servlet in pipeline place below code.

                        Profile profile = (Profile) atg.servlet.ServletUtil.getCurrentUserProfile();

                         

                                Object userCatalog = profile.getPropertyValue(CATALOG_PROPERTY_NAME);

                         

                                if ((userCatalog == null)) {

                                    try {

                                        RepositoryItem catalog = (RepositoryItem) getProductCatalog().getItem(getCatalogId(),

                                                CATALOG_PROPERTY_NAME);

                                        profile.setPropertyValue(CATALOG_PROPERTY_NAME, catalog);

                                    }  catch (RepositoryException e) {

                                        getLogger().logError(ApplicationConstants.ERR_CORE_CATALOG_ASSOCITOR_FAIL, e.getCause());

                                    }

                                }

                        In component properties file mention

                        catalogId=catalog600000

                         

                        It will Assign above Catalog to Profile as Default.

                         

                        -user8729783

                        • 9. Re: how to associate a default catalog to CatalogTools in 10.2
                          vgk2716

                           

                          By default enabled property is false on /atg/userprofiling/CatalogProfilePropertySetter. Change this to true, it will set catalog to Profile

                          • 10. Re: how to associate a default catalog to CatalogTools in 10.2
                            Nitin Dubey

                            I am guessing the reason you want to set catalog in profile is that u r not able to access it.

                             

                            Check whether anonymous user is able to access the catalog or or not.

                            If not do run catalog maintenance service(Basic Maintenance) in Commerce Administration->Basic Maintenance (/dyn/admin/atg/commerce/admin/en/index.jhtml).

                             

                            If yes, There can be multiple approaches to set default catalog in profile.

                            1) Using Scenario

                            2) postLogin method changes to set defaultcatalog in profile.

                            3) postregistration method changes to set defaultcatalog in profile.

                            3) CatalogProfilePropertySetter component.

                             

                            I think ATG 10.2 automatically doesn't assigns default catalog in profile.