Monday, October 15, 2012

How to Add Custom Repositories into Merchandising UI in ATG 10.x BCC


Upon releasing ATG 10, the ATG BCC has been changed from its predecessors drastically by adding Flex UI enhancements into it. Now by default you will be able to see the following repositories using Merchandising UI.
  • Catalog
  • Promotions and Coupons
  • Media

If you are adding any custom repository, then you need to edit it through Content Administration Project, but of course the UE is not that great.
Then how can we get our custom repository to Merchandising UE? Is there any way to do that?
Yes, there is a way. ATG documentation doesn’t talk about that, but as we know ATG BCC, everything is run by configuration XMLs and components; you need to spend some time and identify which file you have to modify.
The following configuration changes will help you to bring your custom repository into Merchandiser UI.
Check the /atg/remote/commerce/browse/MerchandisingBrowseHierarchy.xml available in the DCS-UI module.
This XML defines the Browse Hierarchy of the Merchandising UE. This will have a root element called <browse-hierarchy> and this will define a root called home
Home is nothing but another browse-item element and this will define other browse items coming under the Home.
Consider the below example, Home will have Catalog and Catalog will have Product etc.
Home à Catalog à Product à SKU.
If you want to add your Custom Repository under home, then you need to add a browse-item reference over here. Don’t forget that ATG’s XML-COMBINE method is applicable here as well.
<browse-item reference-id="MyCustom"/>
Ok, I have added a link to my repository under the Home link. What I need to do now, how my items will come over there.
Create a new browse-item called MyCustom(the name I have given under home page>
<browse-item id=" MyCustom"
    label-resource=" MyCustom"
    is-root="true"
    icon-resource=" ">
      <browse-item reference-id="MyCustomItem1"/>
      <browse-item reference-id="MyCustomItem2"/>
     
     </browse-item>
Create other browse-items for each of my items.
<browse-item id=" MyCustomItem1"
               label-resource=" MyCustomItem1"
               is-root="true"
               icon-resource=" ">
    <list-definition id="Item1" retriever="query" child-type="/test/MyCustom/ MyCustomRepository:MyCustomItem1">
      <retriever-parameter name="query" value="ALL"/>
    </list-definition>
  </browse-item>
<browse-item id=" MyCustomItem2"
               label-resource=" MyCustomItem2"
               is-root="true"
               icon-resource=" ">
    <list-definition id="Item1" retriever="query" child-type="/test/MyCustom/ MyCustomRepository:MyCustomItem2">
      <retriever-parameter name="query" value="ALL"/>
    </list-definition>
  </browse-item>
This will add your items into the browse view of Merchandising UI. If you want this in the Find view also, then you have to use another configuration XML file, i.e. \atg\remote\commerce\find\MerchandisingFindConfiguration.xml.
<find-configuration site-filtering="true">
   
    <asset-family id=" MyCustomItem1" site-filtering="false">
    <display-name-resource> MyCustomItem1</display-name-resource>
    <enable-default-query>true</enable-default-query>
    <enable-filter-as-you-type>true</enable-filter-as-you-type>
    <result-list page-size="500"/>
    <default-asset-type> MyCustomItem1</default-asset-type>
    <asset-type
      id=" MyCustomItem1"
      site-filtering="false">
      <enable-default-query>true</enable-default-query>
      <enable-filter-as-you-type>true</enable-filter-as-you-type>
      <repository-path="/test/MyCustom/ MyCustomRepository </repository-path>
      <repository-item-type> MyCustomItem1</repository-item-type>
    </asset-type>

  </asset-family>
</ find-configuration>
This will bring the MyCustomItem1 in you Find view of Merchandising UI.
Along with this, you may need to check the /atg/remote/commerce/toolbar/MerchandisingToolbar.xml for defining the scope etc. for your custom repository in Merchandising UE.