Archive for July, 2009
How to Add Products to Categories using Content Groups
by Frank Kim on Jul.31, 2009, under Commerce, Personalization
Typically after you create a category in your catalog you then add products to the category. The simple way to do that in ATG eCommerce is to use the ACC and add products to the child products property of the category. However there is another way.
In the ATG Commerce Guide to Setting Up a Store documentation you can see in the Viewing the Product Catalog section that a category can have child products but also child product groups.
Child product groups are actually content groups which are described in the Creating Content Groups chapter of the ATG Personalization Guide for Business Users.
Though the documentation shows a content group composed of features you can easily create a content group using the ProductCatalog as a content source and product as a content type.
To create a content group follow the steps in the ATG documentation for Creating New Content Groups except use an item from the ProductCatalog when specifying the Content Type. Then create the targeting rules for this Content Group. Now you can specify this group in the Child products (group) property of a category.
ATG Product Bundles
by Frank Kim on Jul.29, 2009, under Commerce
Out of the box ATG eCommerce does not support product bundles. It does support SKU bundles, i.e. a product can consist of multiple SKU’s.
To support product bundles is pretty simple to implement.
First you create a new type of product for bundles in /atg/commerce/catalog/productCatalog.xml.
<item-descriptor name="product"> <table name="dcs_product"> <property name="type" data-type="enumerated" default="regular"> <attribute name="useCodeForValue" value="false"/> <option value="regular" code="0"/> <option value="bundle" code="1" /> </property> </table>
Then you define your bundles product to have the new products property. This property is simply a list of products that the bundle contains, e.g. Costco organic cotton polo shirt and Nike athletic shorts.
<item-descriptor name="bundle" super-type="product" sub-type-value="bundle"> <table name="betweengo_product_bundle" multi-column-name="seq_num" type="multi" id-column-names="product_bundle_id"> <property name="products" column-name="product_id" data-type="list" component-item-type="product" display-name="Products" category="Bundle" /> </table> </item-descriptor>
A few years ago I did a more advanced version of this implementation which allowed for different numbers of products in one bundle, e.g. two different kinds of shirts and one pair of pants. I did this using the concept of product links which is similar to SKU links that ATG supports.
If you are interested in wanting to implement a more advanced version please contact us.
How to Debug No Output for ATG ForEach
by Frank Kim on Jul.28, 2009, under Page Development
Today I added a feature in my shopping cart JSP page but nothing was showing up. This was because the output of ATG ForEach droplet was blanks.
To debug this I did the following steps.
- I added an empty oparam to see if the ForEach droplet thought the collection was empty.
<dsp:oparam="empty">Empty?</dsp:oparam>
It did not.
- I outputted the count in the output oparam to see if it was looping through the collection.
<dsp:oparam="output"><dsp:valueof param="count"/> <dsp:valueof param="element"/></dsp:oparam>
It was looping through the collection.
- Finally I debugged using Eclipse the ForEach code. The ForEach code can be found in <ATG>/DAS/src/Java/atg/droplet/ForEach.java.
Using the debugger I realized that the element name of the loop was being set to something else which is why <dsp:valueof param=”element”/> was blank.
It turned out that the ForEach droplet was inside another ForEach droplet and in that droplet they set the element name like this.
<dsp:param name="elementName" value="CommerceItem" />
By setting the elementName parameter to something else in my ForEach droplet and then referencing it properly I was finally able to get the expected output.
<dsp:droplet name="/atg/dynamo/droplet/ForEach"> <dsp:param name="array" param="CommerceItem.auxiliaryData.productRef.dvds"/> <dsp:param name="elementName" value="dvd" /> <dsp:oparam name="output"> <dsp:valueof param="dvd.name" /> </dsp:oparam> </dsp:droplet>
By the way ATG documentation suggests not using elementName.
elementNameandindexNameallow you to provide a parameter name other thanelementandindex, respectively. A better way to provide a different parameter name is to use thedsp:setvaluetag.
In our example we would do this instead of setting the elementName param.
<dsp:setvalue param="dvd" paramvalue="element" />
betweenGo now on Twitter
by Frank Kim on Jul.27, 2009, under Consulting
betweenGo is now on Twitter so you can follow us there too.
I used the following image of an Apple aluminum MacBook keyboard from William Hook on Flickr as my icon.
http://www.flickr.com/photos/williamhook/2971294143/
I was going to use this image called “ATG on Red and Pink” from bixentro as my Twitter background but it didn’t look very good as a background.
I finally chose this one simply titled “ATG” by delete08 because it was more striking.
Debug ATG running on JBoss with Eclipse
by Frank Kim on Jul.27, 2009, under Programming
With Eclipse debugging an ATG application running on JBoss is fairly straightforward.
- Configure JBoss to start up with Java options for debugging.
On UNIX you do this by uncommenting this line in <JBoss>/bin/run.conf.
#JAVA_OPTS="$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"
On Windows you do this by uncommenting this line in <JBoss>/bin/run.bat.
rem set JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y %JAVA_OPTS%
- Create a remote Java application debug configuration using the port you specified in step 1. The default port is 8787.
For further reading please see Debugging Nucleus components in JBoss with Eclipse or Remote Debugging with Eclipse. There is also a very complete tutorial from O’Reilly Media called Configuring Eclipse for Remote Debugging.
ATG ForEach Output with Separators Between Items
by Frank Kim on Jul.24, 2009, under Page Development
Sometimes you want to list each item in the collection with a separator in between like a comma or slash. However the trick is to have the separator only in between items.
In ATG DSP you can use the ForEach droplet to iterate through each item in a collection. However to put a separator between each item is not straight-forward with this droplet. To do this I used JSTL to test if we are at the end of the collection. If we are then I don’t add the separator, otherwise I do.
Here is an example.
<dspel:droplet name="/atg/dynamo/droplet/ForEach">
<dspel:param name="array" param="dvds"/>
<dspel:setvalue param="dvd" paramvalue="element" />
<dspel:oparam name="outputStart">
<dspel:getvalueof var="size" param="size" />
</dspel:oparam>
<dspel:oparam name="output">
<dspel:valueof param="dvd.title" valueishtml="true"/>
<dspel:getvalueof var="count" param="count" />
<c:if test="${size != count}"> , </c:if>
</dspel:oparam>
</dspel:droplet>
And here is the output for this example.
The Incredibles, Ratatouille, Cars
Do you have a better or more elegant solution? Please feel free to let me know in the comments?
How to Get Permission to Create Scenarios in ACC
by Frank Kim on Jul.22, 2009, under ACC
Sometimes you will find that you cannot create or duplicate scenarios. You keep clicking on the grayed out New Scenario button and right-clicking on scenarios you want to duplicate but nothing happens.
Fortunately the solution is rather simple and is alluded to in the ATG Personalization Programming Guide – Configuring the Process Editor Server.
First you create a scenarioManager.xml file in your <ATG>/home/localconfig/atg/scenario directory like the following.
<?xml version="1.0" encoding="ISO-8859-1" ?>
<process-manager-configuration>
<process-editor-server>
<server-name>foobar:8850</server-name>
</process-editor-server>
</process-manager-configuration>
Next you replace foobar:8850 with the value of /atg/dynamo/service/ServerName.serverName. You may want to configure the serverName value to something you want because sometimes it might change if for example when you connect via VPN.
Then you restart ATG and reconnect or restart the ACC and you should be able to create and duplicate scenarios.
(Note that when you create the workflowProcessManager.xml file in your <ATG>/home/localconfig/atg/epub/workflow/process directory it can have the exact same contents as the scenarioManager.xml file.)
NameNotFoundExceptions during start up of ATG application on JBoss
by Frank Kim on Jul.21, 2009, under Configuration
When you start up your ATG application on JBoss and see NameNotFoundExceptions like the following it could be because you did not configure your ATG datasources correctly.
Unable to start service "/atg/dynamo/service/jdbc/JTDataSource": atg.nucleus.ServiceException: Unable to resolve reference to JNDI component: java:/atgcore_ds ERROR [nucleusNamespace.atg.dynamo.service.jdbc.JTDataSource] javax.naming.NameNotFoundException: atgcore_ds not bound
To properly configure it create an atg-oracle-ds.xml file. I have a sample one below. atgcore_ds is the datasource for most of the ATG repositories. You will probably need to configure datasources for Catalog A and Catalog B if you are doing eCommerce, e.g. atgcataloga_ds and atgcatalogb_ds. The atg-oracle-ds.xml file will go into your server’s configuration, e.g. <jboss>/server/betweengo/deploy.
<?xml version="1.0" encoding="UTF-8"?> <datasources> <local-tx-datasource> <jndi-name>atgcore_ds</jndi-name> <!-- <connection-url>jdbc:oracle:oci:@Dynamo</connection-url> --> <connection-url>jdbc:oracle:thin:@localhost:1521:orcl</connection-url> <driver-class>oracle.jdbc.driver.OracleDriver</driver-class> <user-name>foo</user-name> <password>bar</password> <min-pool-size>1</min-pool-size> <max-pool-size>4</max-pool-size> </local-tx-datasource> </datasources>
Note that the connection URL should be the same as what you configured in your tnsnames.ora file. If you installed Oracle with a Microsoft Loopback Adapter and pointed the host in your tnsnames.ora configuration to the loopback connection, e.g. 192.168.1.200, then you should do the same in your atg-oracle-ds.xml file.
For further reading please see Getting Started with ATG – jBoss and Oracle and Create Additional JBoss Application Server Configurations.
Create Additional JBoss Application Server Configurations
by Frank Kim on Jul.20, 2009, under JBoss
I thought to create an additional JBoss application server configuration one would have to use some kind of administration tool.
It turned out to be much simpler.
cp -R server/default server/betweengo
If you want to create an ATG application server configuration you can do this.
cp -R server/atg server/betweengo
The only difference between the default server configuration and the atg server configuration is that the latter has two additional datasource XML files for communicating with the SOLID database.
atg/deploy/atg-apps-solid-ds.xml atg/deploy/atg-solid-ds.xml
For further reading please see JBoss configurations to run an application (need active ATG support contract to see this document) or Building Your Own JBoss Configuration or Using JBoss Application Server.
How to Import and Create Users in Oracle
by Frank Kim on Jul.17, 2009, under Oracle
When you do an import sometimes you will find you will need to also create a user for this new set of data. Today I find myself in that situation as I imported data from Bell Canada and set up a new user for that data.
- Create a new user for the data.
This example creates a user named "foo" with the password "foo". Foo is a typical user that can create sessions, synonyms, procedures and tables.
CREATE USER FOO IDENTIFIED BY FOO DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp QUOTA UNLIMITED ON users; GRANT CREATE SESSION to FOO; GRANT CREATE SYNONYM TO FOO; GRANT CREATE PROCEDURE TO FOO; GRANT CREATE TABLE TO FOO; GRANT CREATE VIEW TO FOO;
For more information please read Oracle’s CREATE USER documentation.
If you want this user to be a DBA you can grant that to her too
GRANT DBA TO FOO;
- Import the dump using the new user.
This example imports the dump from the file "dump.dmp". This dump was created using the user "foo" and is being imported to the user "foo". The dump will be logged in the file "dump.log".
imp system/system@example file=dump.dmp log=dump.log fromuser=foo touser=foo
For more information please read Oracle’s Import Export FAQ.
- To redo recreate user and then import again.
If you need to redo an import the easiest thing to do is to drop the user, recreate her and then do the import again. When you drop the user specify CASCADE to drop all the objects in the user’s schema.
DROP USER FOO CASCADE;
For more information please read Oracle’s DROP USER documentation.








