Skip to content

Cart Processor

Christine White edited this page May 20, 2015 · 10 revisions

The Add to Cart functionality is available as of Geoportal Server version 1.2.2. When enabled, it allows users to select items from the search results to store in a "cart", manage the contents of the cart, and then carry out some action on the group. A sample of cart functionality is provided, but the idea is that you can write your own processor for your own organization's purposes. Read how NOAA's NODC office used a custom processor for helping their users in access data.

Table of Contents

How to Enable the Add to Cart Processor

The Add to Cart Processor is only available if your organization has configured in the gpt.xml file that the Cart functionality should appear.

To configure the Cart Processor - or a custom processor - in the geoportal:

  • First open the \\geoportal\WEB-INF\classes\gpt\config\gpt.xml file.
  • Find the section for the Item cart parameters.
  • Update the parameters in that section as desired:
    • catalog.cart.enabled: Set to "true" to enable cart functionality.
    • catalog.cart.maxItems: maximum number of items that can be saved to a cart. Consider what your geoportal is going to do once a user initiates the processing; if you've configured a processor to for example, download data from the FTP URLS from the metadata XML, then you may want not want users adding hundreds of items to the cart and initiating the processing.
    • catalog.cart.processor: the Java class used to process items. An example is provided out of the box, using a class called 'com.esri.gpt.control.cart.ZipXmls'. This class will process the list of metadata XMLs in the cart by zipping them up and providing the .zip file to the user. This is just a sample processor - you can write your own processor for custom functionality that will be initiated when the user clicks the "Process" button in the cart. One example is the NOAA's NODC office's custom processor.
  • After changing these settings, save the gpt.xml file.
  • Now, consider if you want to change the cart icon. The default cart icon looks like this:cart.png. You will likely want to choose a more intuitive icon to display on your user interface, especially if you are using a custom processor that does a specific task. To change the icon, go to the \\geoportal\catalog\images folder and make a backup copy of the cart.png file. Then, move your more suitable icon - size should be 16 X 16 pixels - the this folder. Delete the cart.png (but not the backup), and rename your new icon to cart.png.
  • Update any strings associated with the customized cart functionality as desired in the \\geoportal\WEB-INF\classes\gpt\resources\gpt.properties file. The Cart Processor strings are in the "catalog.cart" section. Save the gpt.properties file when finished.
  • Restart your geoportal web application to see the changes take effect.

How to Use the Cart Processor

When enabled, the Cart Processor will result in several user interface changes. First, there will be a "Cart" link at the top of the Geoportal user interface. You can click this Cart button from any page in the geoportal to see the items in your cart. Also when you do a Search or look at results on the Browse tab, you will see an icon and a checkbox next to each search result. When you hover over the icon and checkbox, you will see a message indicating that the user should check the box to add an item to the cart. Once a user has checked the maximum number of items allowable in the cart, the checkboxes are disabled and a message saying that the maximum has been reached appears.

When a user clicks the Cart link at the top, their cart displays. The user can remove items by clicking the "X" next to the cart item. The user can go back to the search results or Browse tab and continue to add items to the cart, or they can choose to initiate Processing their items by clicking the "Process" button.

In the sample provided out of the box for the geoportal, clicking the "Process" button will result in a .zip file of the selected items being displayed for the user to open or save. This processing functionality can vary though, if an organization has implemented a custom processor.

NOAA NODC Example

The NOAA NODC office has implemented a custom processor that allows users to designate a list of items to be passed to their in-house data download tool. The geoportal side extracts the FTP URLs from the selected metadata XMLs, and passes them to the NODC tool for processing.

Custom "Volume" for Cart

Perhaps your organization wants to have some kind of volume setting on the cart, beyond simply the number of items a user can put in the cart. For example, if the backend Cart Processor is customized to extract and deliver data, then there may be a limit to how much data a user should be allowed to extract. The sum of the data size for items described by metadata in the cart might be limited in this case. To set such a limit, the gpt.xml file has a setting for the 'tryhandler' class. The example below shows a configuration in gpt.xml, where 'catalog.cart.volumetryhandler.commaSeparatedFields' is the index (or indices, if more than one should be considered) to be used when summing the items in the cart and determining its volume and the 'catalog.cart.volumetryhandler.max' is the maximum the cart should be allowed to accommodate. When the volume of the cart reaches capacity, a user can no longer select items to place in the cart. Note, this example points to the existing dcat.size index for the volume, but this could be set to any existing numeric index in your property-meanings.xml file.

gpt.xml tryhandler settings
parameter key="catalog.cart.tryhandler.class" value="com.esri.gpt.control.cart.VolumeTryHandler"
parameter key="catalog.cart.volumetryhandler.commaSeparatedFields" value="dcat.size"
parameter key="catalog.cart.volumetryhandler.max" value="100000"

Back to Customizations
Clone this wiki locally