The JavaScript used by Commerce Reference Store is stored in external .js files that are loaded by the store.war/includes/pageStartScript.jsp file, which is included in most Commerce Reference Store pages. In addition, a subset of these .js files is loaded by the store.war/includes/popupStartScript.jsp file, which is included in popup windows. Using .js files avoids having JavaScript behavior or logic hardcoded into the JSPs.

For a given page, only the JavaScript functions that are required are run. The JavaScript files contain logic that checks the rendered HTML for specific IDs and runs only the functions for which the associated ID is found. This makes the UI code modular and easily transportable between pages.

The Commerce Reference Store JavaScript files include:

Core Dojo Libraries

Commerce Reference Store uses the Dojo 1.6.1 JavaScript library, which is distributed with the ATG platform in the WebUI module. This library consists of three JavaScript namespaces:

Note that the Dojo library included with the ATG platform is not optimized. Before you go live with any web application built with Commerce Reference Store, you should create an optimized Dojo build. The Dojo build scripts are included in this directory:


For information about Dojo, including instructions for building an optimized Dojo library, go to:
Rich Shopping Cart Widget

In addition to the widgets that are included in the Dojo libraries, Commerce Reference Store has a rich shopping cart user interface that is implemented as a custom Dojo widget. This widget, which is available on most pages, creates a drop-down display that shows the products in the shopping cart, information about promotions that have been applied, links to the full shopping cart page and checkout page, and a subtotal for the order. For example:

This illustration is described in the preceding text.

This widget makes it possible for customers to view the items in their cart without leaving the current page. It is implemented through .js files that extend the standard Dojo widget classes. The main files are:

Each of these files has a corresponding template file in the store.war/javascript/widget/template/ directory.

Other Commerce Reference Store JavaScript

Commerce Reference Store also includes a number of other JavaScript functions. Some of these are implemented as Dojo widgets, but a few are not. These functions are stored in the JavaScript files in the store.war/javascript/ and store.war/javascript/widgets/ directories. These files include implementations of features such as the SKU pickers on product detail pages.

Copyright © 1997, 2013 Oracle and/or its affiliates. All rights reserved. Legal Notices