Tuesday, 1 March 2016

Sample Program for customizing Product Catalog in ATG

We can customize any out of the box item descriptor provided by ATG in its product catalog. Example here is shown for extending "product" item descriptor. (for theory on catalogs and custom catalog click here)

Step 1: In config folder of your application create a file in the below specified path. create folder structure, if not  present in your config folder.
\atg\commerce\catalog\custom\customCatalog.xml

Step 2: extend the "product" item descriptor similar to the code shown below

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<gsa-template xml-combine="append">
 <header xml-combine="replace">
  <name>Extention to Product Catalog</name>
  <author>atg-tips.blogspot.com</author>    
 </header>
  
    <item-descriptor name="product" xml-combine="append">
  <table name="CUSTOM_PRODUCT" type="auxiliary" id-column-name="PRODUCT_ID">
   <property name="bestSoldCount" data-type="int" column-name="BEST_SOLD_COUNT" category="Custom Properties" display-name="Best Sold Count"/>
  </table>
 </item-descriptor>
</gsa-template>

Step 3: create SQL tables for the custom table specification mentioned in the above step.

           As product catalog is a version repository we have to create SQL scripts for CatalogA, CatalogB, and publishing repositories:

sample SQL scripts for Publishing Repository:



CREATE TABLE CUSTOM_PRODUCT (
 PRODUCT_ID   varchar2(254) NOT NULL,
 asset_version   INTEGER NOT NULL,
 BEST_SOLD_COUNT  INTEGER NULL,
 PRIMARY KEY(PRODUCT_ID, asset_version)
);


sample SQL scripts for catalog Repositories:

CREATE TABLE CUSTOM_PRODUCT (
 PRODUCT_ID   varchar2(254) NOT NULL REFERENCES dcs_product(product_id),
 BEST_SOLD_COUNT  INTEGER NULL,
 PRIMARY KEY(PRODUCT_ID)
);


Step 4: Run the SQL scripts created in the appropriate repositories

Step 5: Rebuild the application again. and Restart the servers.

0 comments:

Post a Comment

 
;