Tuesday, June 23, 2015

How to know which ATG modules are running on your server (ATG Oracle commerce)

There is an easy way to know which modules are started along with your server, without going into the logs or every single MANIFEST.MF file, that can be done within /dyn/admin

Just need to go to https://server:port/dyn/admin/atg/dynamo/admin/en/running-products.jhtml

Then you will find everything that is running with your server, in a screen as below:




This information is good for you if you are having odd issues, maybe a needed module did not started correctly and you can spot that in this page.

Thursday, June 18, 2015

How to configure a property to use a range of values on xml repository definition (ATG Oracle Commerce)

There are some things that you can do with xml definition file to define a range of values for a property into a repository.

Let's talk about the following scenario, we need a property that will hold the hour of the day which will be used to determine the released hour for a new product.

So we define this as a number property on our ATG xml repository as follows:



Since this is a property to hold the hour of the day, we need to restrict the field to be just from 0 to 23 if we use 24 hours format.

having said this we have some options that ATG does provide OOTB

One is an enumerated the code is as follows:

The other option is a java Class to create a Property Descriptor class that extends GSAPropertyDescriptor in order to restrict the data entered by the user, an example of how to do this can be found here.

Both options are ATG solutions, however there is an easier way to configure this and is not on ATG side, but on the Database as a constraint level that ATG will be forced to use, and that is a simple DB constraint as follows:

And that's it.
We used the Constraint on our last project, since is easier and less invaise in terms of code, feel free to use the option that fit better for your client needs.

Tuesday, June 16, 2015

How to change locale on your Store app (ATG Oracle commerce)

ATG does provide a mechanism to change locale on your application very easily with a component called RequestLocale, this componet can change the locale of the application and it is a session component, just need to change localeString Property to use the locale you want.

Inside a jsp can change the locale, below is an example of how to change it when switchTo parameter is send:
Once this is done the application will read the resource bundles from the new locale, so the site will be on the new locale. Important Note: For the Repository translations it will be needed to set
 /atg/dynamo/servlet/pipeline/DynamoHandler.generateRequestLocales to true.

This will serve repository translated properties by locale.

This can be found on documentation at: http://docs.oracle.com/cd/E24152_01/Platform.10-1/ATGPlatformProgGuide/html/s1807allowinguserstochoosealocale01.html and http://docs.oracle.com/cd/E23095_01/Platform.93/ATGProgGuide/html/s1808characterencodingandlocaleconfig01.html

It is important to note that if there is a missing key on resourceBundle the site will display this ????theBundle.key?????

And also if there is not translation or resourceBundle associated with the locale provided, ATG will use the default one which is en_US.

Here are some screenshot examples of the above code working on a store header.





This post is related to this translations post, which shows how to configure a Repository to use different locales.