ATG
commerce catalog can be customised in customCatalog.xml. All custom
repository is defined in this xml file. To access respository ATG
provides CustomCatalogTools OOTB class which is an extension of
atg.commerce.catalog.CatalogTools that modifies the behavior so it works
with custom catalogs.
This class has many methods, which can be used for:
findProduct
findSKU
findCatalogItem
etc...
public class CustomCatalogTools
extends CatalogTools
implements atg.commerce.catalog.CMSConstants
$class=atg.commerce.catalog.custom.CustomCatalogTools
transactionManager=/atg/dynamo/transaction/TransactionManager
profileCatalogPropertyName=catalog
categorysInfosMapProperty=categoryInfos
productsInfosMapProperty=productInfos
skusInfosMapProperty=skuInfos
catalogsProperty=catalogs
baseCatalogItemType=catalog
catalogItemTypes=catalog
catalogProperties=/atg/commerce/catalog/custom/CatalogProperties
trackState=true
The component /atg/registry/ContentRepositories/ProductCatalog/ has OOTB entry for customCatalog.xml
definitionFiles
CONFIGPATH filename: /atg/commerce/catalog/custom/customCatalog.xml
CONFIGPATH filename: /atg/commerce/pricing/pricingModels.xml
The customCatalog.xml can be further customized to have multiple customCatalog.xml file from multiple project in atg layering structure
/atg/commerce/order/OrderRepository/
definitionFiles
CONFIGPATH filename /atg/commerce/order/orderrepository.xml
/atg/commerce/inventory/InventoryRepository/
definitionFiles
CONFIGPATH filename /atg/commerce/inventory/inventory.xml
/atg/commerce/invoice/InvoiceRepository/
definitionFiles
CONFIGPATH filename /atg/commerce/invoice/invoiceRepository.xml
/atg/registry/ContentRepositories/MediaRepository/
definitionFiles
CONFIGPATH filename /atg/content/media/media.xml
/atg/userprofiling/ProfileAdapterRepository/
definitionFiles
CONFIGPATH filename /atg/userprofiling/userProfile.xml
pricingModel.xml contains the promotion specific extensions to product catalog. OOB this is used as one of the constituting ProductCatalog repository definition files but if you want to separate out your promotions repository you can remove it from ProductCatalog repository definition files and instead specify it as repository definition for /atg/commerce/pricing/Promotions.
catalogMigration.xml is defined within DCS.CustomCatalogMigration sub-module and is used while migrating a standard catalog to custom catalog. You are seeing it because you may have included DCS.CustomCatalogMigration while assembling your application.
Some common syntax mostly used:
CustomCatalogProperties catalogProperties = (CustomCatalogProperties) getCatalogTools().getCatalogProperties();
List<RepositoryItem> product = getCatalogTools().findProduct(productId);
String productType = (String) getCatalogTools().getPropertyValueFromRepositoryItem(product,"TYPE");
List<RepositoryItem> skus = (List<RepositoryItem>) product.getPropertyValue(catalogProperties.getChildSkusPropertyName());
String color = sku.getPropertyValue(catalogProperties.getSkuColorPropertyName());
RepositoryItem defaultColorItem = (RepositoryItem) sku.getPropertyValue(catalogProperties.getColorPropertyName());
Condition to check the typed property:
catalogProperties.getSkuAccessoryPropertyName().equals(sku.getPropertyValue(catalogProperties.getTypePropertyName
()))
sku-type
type
<item-descriptor name="sku-type" display-property="displayName" display-name-resource="itemDescriptorSku"
super-type="sku" sub-type-value="sku-type" cache-mode="simple">
Get sku for product id
RepositoryItem skuItem = getCatalogTools().getProductBySku(pItem.getRepositoryId(), "product");
Get product repository from sku
RepositoryItem prodItem = getCatalogTools().getItem(skuItem.getRepositoryId(), "product");
get brand repository from product repository item
RepositoryItem brandItem = (RepositoryItem)prodItem.getPropertyValue("brandItem");
Get brand name from brand repository item
String brandNameSor = (String) brandItem.getPropertyValue("brandName");
get repository item
RepositoryItem customSellerItem = (RepositoryItem)getCustomSellerRepository().getItem(pItem.getRepositoryId(),"customSeller");
Get the repository item from respository xml
RepositoryItem item = getCustomContentRepository().getItem(productId, catalogProperties.getCustomContentItemDescriptorName());
Read the data from table:
Object obj = getCatalogTools().getPropertyValueFromRepositoryItem(item, catalogProperties.getCustomContent());
Remove item:
getCustomContentRepository().removeItem(productId,"content");
Create Item:
MutableRepositoryItem reviewItem = getCustomContentRepository().createItem
(catalogProperties.getCustomContentItemDescriptorName());
Add item row:
getBvReviewContentRepository().addItem(customItem);
Jsp syntax to get all child SKU IDs of given product id
<dsp:droplet name="/atg/commerce/catalog/ProductLookup">
<dsp:param name="id" value="ProductId" />
<dsp:oparam name="output">
<dsp:droplet name="/atg/dynamo/droplet/ForEach">
<dsp:param name="array" param="element.childSKUs"/>
<dsp:param name="elementName" value="sku"/>
<dsp:oparam name="output">
Sku Id: <dsp:valueof param="sku.repositoryId"/>
</dsp:oparam>
</dsp:droplet>
</dsp:oparam>
</dsp:droplet>
Syntax in java
StoreCatalogTools storeCatalogTools = (StoreCatalogTools) getCatalogTools();
Repository productCatalog = (Repository) storeCatalogTools.getCatalog();
RepositoryItem productItem = productCatalog.getItem(productId,"product");
List<RepositoryItem> skuList = productItem.getPropertyValue("childSKUs");
for(RepositoryItem sku : skuList){
String id = sku.id();
}
VZWCommonRepositoryInventoryManager
RepositoryItem skuItem = getCatalogRefItem(skuId);
String itemFulfillmentStatus = getRepository().getItem(inventoryId, getItemFulfillmentStatusItemName());
This class has many methods, which can be used for:
findProduct
findSKU
findCatalogItem
etc...
public class CustomCatalogTools
extends CatalogTools
implements atg.commerce.catalog.CMSConstants
$class=atg.commerce.catalog.custom.CustomCatalogTools
transactionManager=/atg/dynamo/transaction/TransactionManager
profileCatalogPropertyName=catalog
categorysInfosMapProperty=categoryInfos
productsInfosMapProperty=productInfos
skusInfosMapProperty=skuInfos
catalogsProperty=catalogs
baseCatalogItemType=catalog
catalogItemTypes=catalog
catalogProperties=/atg/commerce/catalog/custom/CatalogProperties
trackState=true
The component /atg/registry/ContentRepositories/ProductCatalog/ has OOTB entry for customCatalog.xml
definitionFiles
CONFIGPATH filename: /atg/commerce/catalog/custom/customCatalog.xml
CONFIGPATH filename: /atg/commerce/pricing/pricingModels.xml
The customCatalog.xml can be further customized to have multiple customCatalog.xml file from multiple project in atg layering structure
/atg/commerce/order/OrderRepository/
definitionFiles
CONFIGPATH filename /atg/commerce/order/orderrepository.xml
/atg/commerce/inventory/InventoryRepository/
definitionFiles
CONFIGPATH filename /atg/commerce/inventory/inventory.xml
/atg/commerce/invoice/InvoiceRepository/
definitionFiles
CONFIGPATH filename /atg/commerce/invoice/invoiceRepository.xml
/atg/registry/ContentRepositories/MediaRepository/
definitionFiles
CONFIGPATH filename /atg/content/media/media.xml
/atg/userprofiling/ProfileAdapterRepository/
definitionFiles
CONFIGPATH filename /atg/userprofiling/userProfile.xml
pricingModel.xml contains the promotion specific extensions to product catalog. OOB this is used as one of the constituting ProductCatalog repository definition files but if you want to separate out your promotions repository you can remove it from ProductCatalog repository definition files and instead specify it as repository definition for /atg/commerce/pricing/Promotions.
catalogMigration.xml is defined within DCS.CustomCatalogMigration sub-module and is used while migrating a standard catalog to custom catalog. You are seeing it because you may have included DCS.CustomCatalogMigration while assembling your application.
Some common syntax mostly used:
CustomCatalogProperties catalogProperties = (CustomCatalogProperties) getCatalogTools().getCatalogProperties();
List<RepositoryItem> product = getCatalogTools().findProduct(productId);
String productType = (String) getCatalogTools().getPropertyValueFromRepositoryItem(product,"TYPE");
List<RepositoryItem> skus = (List<RepositoryItem>) product.getPropertyValue(catalogProperties.getChildSkusPropertyName());
String color = sku.getPropertyValue(catalogProperties.getSkuColorPropertyName());
RepositoryItem defaultColorItem = (RepositoryItem) sku.getPropertyValue(catalogProperties.getColorPropertyName());
Condition to check the typed property:
catalogProperties.getSkuAccessoryPropertyName().equals(sku.getPropertyValue(catalogProperties.getTypePropertyName
()))
sku-type
type
<item-descriptor name="sku-type" display-property="displayName" display-name-resource="itemDescriptorSku"
super-type="sku" sub-type-value="sku-type" cache-mode="simple">
Get sku for product id
RepositoryItem skuItem = getCatalogTools().getProductBySku(pItem.getRepositoryId(), "product");
Get product repository from sku
RepositoryItem prodItem = getCatalogTools().getItem(skuItem.getRepositoryId(), "product");
get brand repository from product repository item
RepositoryItem brandItem = (RepositoryItem)prodItem.getPropertyValue("brandItem");
Get brand name from brand repository item
String brandNameSor = (String) brandItem.getPropertyValue("brandName");
get repository item
RepositoryItem customSellerItem = (RepositoryItem)getCustomSellerRepository().getItem(pItem.getRepositoryId(),"customSeller");
Get the repository item from respository xml
RepositoryItem item = getCustomContentRepository().getItem(productId, catalogProperties.getCustomContentItemDescriptorName());
Read the data from table:
Object obj = getCatalogTools().getPropertyValueFromRepositoryItem(item, catalogProperties.getCustomContent());
Remove item:
getCustomContentRepository().removeItem(productId,"content");
Create Item:
MutableRepositoryItem reviewItem = getCustomContentRepository().createItem
(catalogProperties.getCustomContentItemDescriptorName());
Add item row:
getBvReviewContentRepository().addItem(customItem);
Jsp syntax to get all child SKU IDs of given product id
<dsp:droplet name="/atg/commerce/catalog/ProductLookup">
<dsp:param name="id" value="ProductId" />
<dsp:oparam name="output">
<dsp:droplet name="/atg/dynamo/droplet/ForEach">
<dsp:param name="array" param="element.childSKUs"/>
<dsp:param name="elementName" value="sku"/>
<dsp:oparam name="output">
Sku Id: <dsp:valueof param="sku.repositoryId"/>
</dsp:oparam>
</dsp:droplet>
</dsp:oparam>
</dsp:droplet>
Syntax in java
StoreCatalogTools storeCatalogTools = (StoreCatalogTools) getCatalogTools();
Repository productCatalog = (Repository) storeCatalogTools.getCatalog();
RepositoryItem productItem = productCatalog.getItem(productId,"product");
List<RepositoryItem> skuList = productItem.getPropertyValue("childSKUs");
for(RepositoryItem sku : skuList){
String id = sku.id();
}
VZWCommonRepositoryInventoryManager
RepositoryItem skuItem = getCatalogRefItem(skuId);
String itemFulfillmentStatus = getRepository().getItem(inventoryId, getItemFulfillmentStatusItemName());
No comments:
Post a Comment