Monday, November 30, 2015

Make Thumbnails on BCC use the image you want (ATG Oracle Commerce)

ATG 11 OOTB uses thumbnails for the skus, and products, this is done with a view Mapping into ViewMappingRepository.

Is just matter of know which property you want to use as thumbnail and set it, on our project we decided to do similar as follows:

These 2 attribute are AmAvPrdtPrImagePropName and AmAvSkuPrImagePropName for product and sku respectively

Product will use the thumbnail of the first childSku

The Sku will use the it's own thumbnail Image.
OOTB is kind of different for product, it uses it's own thumbnailImage
This can be found at DCS-UI/install/data/viewmapping.xml

All these xml needs to be executed at /atg/web/viewmapping/ViewMappingRepository which is a Repository that CA/BCC instance have.

PropertyDescriptor That set values on other properties (ATG Oracle Commerce)

As you already know PropertyDescriptors are great tool to make repository properties return or set a value based on your code logic instead of getting/setting this directly into the DB.

There are some good posts about PropertyDescriptors out there, like these:

And also Oracle Documentation is fine:

Recently I had a requirement that required change some properties based on the value of other property.
Then the first thing that came into my mind was: "a PropertyDescriptor could do this"

Since Property Descriptor methods have the RepositoryItemImpl and the value as parameter for both methods setPropertyValue and getPropertyValue
So is as easy as simply get the property you want to set, and it is great that it works for other items if those are related, an example of this are childSkus.

Below is an example of how to set skuProperties based on product Properties, meaning that the this PropertyDescriptor will Set some properties on childSkus based product's value and some configuration.

The code above can be used when Setting a value on a BCC project, and it will affect all the assets that were involved into the change, this is due we are working with CurrentVersionItem.
And also if a property happens to be null this can be catch by

skuValue instanceof RepositoryItemImpl.NullObject

Share contextRoot on multi Site environment (ATG Oracle Commerce 11.x)

ATG does support multisite out of the box, you need to set up your sites to make this happen, as you can see on CRS.

Once you have your sites set up there is an important configuration that needs to happen in order your application understand that the sites are gonna share contextRoot as it happens on a multi-site environment.
That can be set in a single component /atg/dynamo/service/VirtualContextRootService/, just enable this component and the multi site will works sharing the same contextRoot.
This is configured OOTB at CRS.

This can be found at Oracle Documentation at

Similar for previous versions are documented at 

Special Thanks to Adolgo who found this :)