atg

Version 9.1 ATG Commerce Programming Guide
ATG One Main Street Cambridge, MA 02142 USA www.atg.com

ATG Commerce Programming Guide Document Version
Doc9.1 COMMPROGv1 7/31/09

Copyright
Copyright © 1998-2009 Art Technology Group, Inc. All rights reserved. This publication may not, in whole or in part, be copied, photocopied, translated, or reduced to any electronic medium or machine-readable form for commercial use without prior consent, in writing, from Art Technology Group, Inc. (ATG). ATG does authorize you to copy documents published by ATG on its website for non-commercial uses within your organization only. In consideration of this authorization, you agree that any copy of these documents which you make shall retain all copyright and other proprietary notices contained herein.

Trademark and Copyright Information
ATG and Art Technology Group are registered trademarks of Art Technology Group, Inc. ATG Dynamo Application Server, ATG Adaptive Scenario Engine, ATG Scenario Personalization, ATG Portal, ATG Commerce, ATG Content Administration, ATG Data Anywhere Architecture, ATG Search, ATG Response Management, ATG Merchandising, ATG Knowledge, ATG Self Service, ATG Commerce Assist, ATG Advisor, ATG Forum and ATG Business Control Center are trademarks of Art Technology Group, Inc. Microsoft, Windows, Word, and Excel are the trademarks or registered trademarks of Microsoft Corporation in the United States and other countries. IBM, AIX, and MQ-Series are the trademarks or registered trademarks of IBM Corporation in the United States and other countries. Oracle is a registered trademark, and other Oracle product names, service names, slogans or logos referenced in this document are trademarks or registered trademarks of Oracle Corporation. Adobe Acrobat Reader is a registered trademark of Adobe. CORBA is a trademark of the OMG (Object Management Group). Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. Primus, and its respective logo, and Primus Knowledge Solutions, are trademarks, registered trademarks, or service marks of Primus. All other product names, service marks, and trademarks mentioned herein are trademarks of their respective owners. This publication may not, in whole or in part, be copied, photocopied, translated, or reduced to any electronic medium or machine-readable form for commercial use without prior consent, in writing, from Art Technology Group (ATG), Inc. ATG does authorize you to copy documents published by ATG on the World Wide Web for non-commercial uses within your organization only. In consideration of this authorization, you agree that any copy of these documents which you make shall retain all copyright and other proprietary notices contained herein. Portions of this product may contain the following: EditLive Authoring Software Copyright © 2004 Ephox Corporation. All rights reserved. Some code licensed from RSA Security, Inc. Some portions licensed from IBM, which are available at http://oss.software.ibm.com/icu4j/. This product may include software developed by the Apache Software Foundation (http://www.apache.org/). Spell checking software from Wintertree Software Inc. The Sentry Spell Checker Engine © 2000 Wintertree Software Inc.

Patent Protection
ATG products and services are protected by one or more of the following U.S. patents and other patents pending: 6,574,790; 6,587,849; 6,560,717; 6,883,014; 6,539,494; 7,024,462; 7,353,189; 7,075,921; 6,914,899; 6,791,974; 6,707,811; 7,203,188; 7,315,518; 7,328,201; 7,367,051.

No Warranty
This documentation is provided “as is” without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. The contents of this publication could include technical inaccuracies or typographical errors. Changes are periodically added to the information herein; these changes will be incorporated in the new editions of the publication. ATG may make improvements and/or changes in the publication and/or product(s) described in the publication at any time without notice.

Limitation of Liability
In no event will ATG be liable for direct, indirect, special, incidental, economic, cover, or consequential damages arising out of the use of or inability to use this documentation even if advised of the possibility of such damages. Some states do not allow the exclusion or limitation of implied warranties or limitation of liability for incidental or consequential damages, so the above limitation or exclusion may not apply to you. Contact: ATG • One Main Street, Cambridge, MA 02142, USA • phone 617.386.1000 • fax 617.386.1111 • www.atg.com

ATG Commerce Programming Guide

µ

Contents

1

Introduction
Commerce Overview Product Catalog Purchasing and Fulfillment Services Inventory Management Pricing Services Targeted Promotions Merchandising Services Finding What You Need In This Guide

1
1 1 2 3 3 3 4 5 6

2

Configuring and Populating a Production Database
Configuring ATG Commerce with CIM Creating Database Tables Creating Tables for Core ATG Commerce Creating Tables for ATG Consumer Commerce Creating Tables for ATG Business Commerce Using ATG Commerce with an Oracle Database Configuring Storage Parameters Configuring a Catalog for Oracle Full Text Searching Using ATG Commerce with an MSSQL Database Transferring Product Catalog and Price List Data Using Copy and Switch Configuring a Database Copy Performing a Database Copy Configuring a Database Switch Performing a Database Switch Transferring Demo Data Exporting the Demo Data from SOLID Importing the Demo Data to Your Database Destroying Database Tables for ATG Commerce Destroying Tables for Core ATG Commerce Destroying Tables for ATG Consumer Commerce Destroying Tables for ATG Business Commerce

9
9 10 11 12 13 14 14 15 17 19 19 25 26 28 29 29 29 30 30 31 32

3

Integrating Third-Party Software With ATG Commerce
Integrating Payflow Pro with ATG Commerce Setting up Payflow Pro

35
35 36

iii
Contents

µ

ATG Commerce Programming Guide

Pre-Configuring the Integration Using ATG Commerce with Payflow Pro Integrating CyberSource with ATG Commerce Installing the CyberSource Distribution Initializing the CyberSource Integration Configuring ATG Commerce to Use CyberSource Moving the System to Production Designating Tax Status of Products Specifying Sales Origin and Shipment Location Information Calculating Taxes on the Item Level Specifying States and Provinces without Tax Obligations Integrating TAXWARE with ATG Commerce Before You Begin Integrating with TAXWARE TAXWARE Classes Configuring ATG Commerce to Use TAXWARE Using the SALES/USE and WORLDTAX Integration Customizing ATG Commerce’s TAXWARE Integration Customizing TaxWareCalculateTax Methods TaxResult and TaxRequest Fields VERAZIP Integration Customizing ATG Commerce’s VERAZIP Integration Customizing TaxWareVerifyZipInfo Methods

36 36 37 37 37 38 38 38 39 39 40 40 40 40 41 42 42 43 43 44 44 45

4

Using and Extending the Standard Catalog
Catalog Repository Categories and Products Category Properties Product Properties Defining a Root Category Defining Relationships between Categories and Products Specifying Template Pages for Categories and Products Associating Products with SKUs Extending the Repository for Internationalization Extending the Category and Product Item Types SKU Items and SKU Links SKU Properties SKU Link Properties Using SKU Media Properties Using SKU Price Properties Using the SKU Fulfiller Property Creating SKU Bundles Extending the SKU Item Type Configurable SKUs Folders and Media Items Folder Properties Media Item Properties Using Media-External Properties

47
47 48 49 50 52 52 54 55 56 58 59 60 60 61 61 62 62 62 63 63 64 64 65

iv
Contents

ATG Commerce Programming Guide

µ
65 65 66 67 69

Using Media-Internal Properties Designing a Multi-Locale Product Catalog Designing the Catalog Repository Setting Up Multiple Product Catalogs Setting Up a Single Product Catalog

5

Using Custom Catalogs
Using ATG Commerce with Custom Catalogs Converting from Standard to Custom Catalogs The Custom Catalog Repository Defining Root Categories Catalog Properties Category Properties categoryInfo Properties Product Properties productInfo Properties SKU Properties SKUInfo Properties Custom Catalog Security Custom Catalog Navigation Looking Up Items in the Catalog Using the parentCategory Property Custom Catalog Searching Overview of Custom Catalog Searching Configuring the Custom Catalog’s Search Form Handler Configuring Custom Catalog Search Types and Specifying Search Criteria Combining Custom Catalog Search Types Preconfigured Custom Catalog Search Components Processing and Displaying Custom Catalog Search Results Searching Custom Catalogs in Development Mode Using Search Form Handler with Internationalized Catalogs Assigning a Custom Catalog to a User

73
73 74 76 77 77 79 83 84 87 88 89 90 90 90 91 91 92 93 94 98 98 99 100 100 101

6

Using the Catalog Maintenance System
Batch Services Dynamic Services

103
103 110

7

ATG Commerce Profile Extensions
Profile Repository Extensions Promotions Address Books Credit Card Collection Gift Lists and Wish List Other Features Profile Form Handler Extensions Profile Tools and Property Manager Extension

113
113 113 114 114 114 115 115 115

v
Contents

µ
8 Configuring Merchandising Services

ATG Commerce Programming Guide

117
117 118 127 129 130 133 136 137 138 139 147 148 149 149 150 150 151 154

Setting Up Gift Lists and Wish Lists Gift List Form Handlers Gift List Servlet Beans Gift List Business Layer Classes Gift List Repository Purchase Process Extensions to Support Gift Lists Extending Gift List Functionality Disabling the Gift List Repository Setting Up Product Comparison Lists Understanding the Product Comparison System Extending the Product Comparison System Using TableInfo to Display a Product Comparison List Setting Up Gift Certificates and Coupons The Claimable Repository The ClaimableTools Component The ClaimableManager Component Setting Up Gift Certificates Setting Up Coupons

9

Using and Extending Pricing Services
Overview of Pricing Services Common Terms in Pricing Services How Pricing Services Generate Prices Deciding Between Dynamic and Static Product Pricing Public Pricing Interfaces and Classes The Base Pricing Engine Pricing Interfaces Pricing Classes Price Holding Classes Pricing Engine Classes Pricing Calculator Classes Qualifier Class QualifiedItem Class PricingTools Class Other Classes The Pricing Servlet Beans Default Pricing Engines Default Item Pricing Engine Default Order Pricing Engine Default Tax Pricing Engine Default Shipping Pricing Engine Default Pricing Calculators Default Item Discount Calculator Default Item Discount Multiplier Calculator Default Order Discount Calculator

159
160 161 162 163 164 164 166 169 169 175 177 188 193 193 196 199 199 200 200 201 202 203 203 204 205

vi
Contents

ATG Commerce Programming Guide

µ
206 207 208 208 209 209 210 210 212 213 213 214 216 216 216 216 217 217 224 224 225 229 230 231 232 233 234 234 235 237 238 238 240

Default Shipping Discount Calculator Default Qualifier Service Extending and Creating Pricing Engines Extending a Pricing Engine Replacing a Pricing Engine Creating a New Pricing Engine Extending and Creating Pricing Calculators Adding a New Pricing Calculator Extending Calculators Extending the Qualifier Class Adding a Helper Method for a New Calculator Adding New Criteria to the Filter Methods Replacing the Way a PMDL Rule Is Evaluated Replacing the Way the Qualifier Determines the Result Set Accessing FilteredCommerceItems Creating Promotions Types of Promotions Using PMDL Rules PromotionStatus Repository Items Using the Discount Rule Editor to Create PMDL Rules Examples of PMDL Rules Performance Issues Related to Promotion Delivery Using Price Lists Overview of Setting Up Price Lists Description of Volume Pricing Setting up Price List Functionality in ATG Consumer Commerce PriceListManager Price List Calculators Implementing Sale Prices using Price Lists Calculating Prices with a Specific Price List Using the CurrencyConversionFormatter to Convert Currency Price List Security Policy Converting a Product Catalog to Use Price Lists

10 Working With Purchase Process Objects
The Purchase Process Subsystems Base Commerce Classes and Interfaces Address Classes Business Layer Classes OrderTools Pipelines Order Repository Creating Commerce Objects Creating an Order Creating Multiple Orders Creating Commerce Items, Shipping Groups, and Payment Groups Adding an Item to an Order via a URL

243
243 244 248 248 249 253 254 255 255 256 257 261

vii
Contents

µ

ATG Commerce Programming Guide

Preventing Commerce Items from Being Added to Types of Shipping Groups263 Removing Commerce Objects from an Order 263 Using the SimpleOrderManager 264 Using Relationship Objects 264 Relationship Types 265 Commerce Item Relationships 269 Relationship Priority 269 Assigning Items to Shipping Groups 270 Assigning Costs to Payment Groups 271 Assigning an Order’s Total Cost to Payment Groups 272 Assigning an Order’s Component Costs to Payment Groups 273 Setting Handling Instructions 275 HandlingInstruction Objects 276 Adding Handling Instructions to a Shipping Group 276 ATG Commerce States 278 Purchase Process Class Diagrams 285 Order Interfaces Diagrams 285 Order Classes Diagram 296 Order Containment Diagram 309

11 Configuring Purchase Process Services
Loading Orders Refreshing Orders Modifying Orders Understanding the CartModifierFormHandler Modifying the Current Order Repricing Orders Saving Orders Updating an Order with the OrderManager Canceling Orders Checking Out Orders Preparing a Simple Order for Checkout Preparing a Complex Order for Checkout Checking Out an Order Processing Payment of Orders Overview of the Payment Process Extending the Payment Operations of a Payment Method Extending the Payment Process to Support a New Payment Method Extending Order Validation to Support New Payment Methods Scheduling Recurring Orders Understanding the scheduledOrder Repository Item Submitting Scheduled Orders Creating, Modifying, and Deleting Scheduled Orders Setting Restrictions on Orders Understanding the Order Restriction Classes Implementing Order Restrictions Tracking the Shopping Process

315
316 317 321 321 327 329 331 331 333 334 334 336 348 354 355 356 357 371 375 376 377 380 384 384 386 387

viii
Contents

ATG Commerce Programming Guide

µ
387 388 389 389 389 390 390 391 392

Shopping Process Stages Working with Shopping Process Stages Shopping Process Recorder Turning Off Recording of Shopping Process Tracking Troubleshooting Order Problems Handling Returned Items Working with ATG Commerce Form Handlers Managing Transactions in the ATG Commerce Form Handlers Extending the ATG Commerce Form Handlers

12 Customizing the Purchase Process Externals
Purchase Process Event Messages Integrating with Purchase Process Services Purchase Process Integration Points Adding Credit Card Types to ATG Commerce Extending the Purchase Process Adding a Subclass with Primitive Data Type Properties Adding a Subclass with Object Data Type Properties Manipulating Extended Objects Merging Orders

393
393 394 394 395 397 397 404 423 423

13 Processor Chains and the Pipeline Manager
Pipeline Manager Overview Using the Pipeline Editor Accessing the Pipeline Editor Opening an Existing Pipeline Definition Creating a New Pipeline Definition Editing Existing Pipeline Definitions Printing a Pipeline Definition Activating Verbose Mode Pipeline Debugging Changing the Display Font of the Pipeline Editor Reinitializing the Pipeline Manager Running a Processor Chain Creating a Processor Pipeline Configuring a Pipeline Manager Creating Processors Pipeline Definition Files Creating and Editing Processor Chains Programmatically Extending the PipelineChain and PipelineResult Classes Pipelines and Transactions Processor Transaction Management Spanning Transactions over a Chain Subset Extending the Processor Pipeline Classes Adding a Commerce Processor Using XML Combination Executing Processor Chains from Processors within Other Chains

425
425 426 427 427 428 430 431 431 432 433 433 433 434 435 435 435 440 443 446 446 447 447 448 449

ix
Contents

µ

ATG Commerce Programming Guide

Commerce Processor Chains updateOrder Pipeline Chain loadOrder Pipeline Chain refreshOrder Pipeline Chain processOrder Pipeline Chain validateForCheckout Pipeline Chain validatePostApproval Pipeline Chain validatePaymentGroupsPostApproval Pipeline Chain validateNoApproval Pipeline Chain recalcPaymentGroupAmounts Pipeline Chain repriceOrder Pipeline Chain moveToConfirmation Pipeline Chain moveToPurchaseInfo Pipeline Chain validateShippingInfo Pipeline Chain sendScenarioEvent Pipeline Chain

449 450 453 454 456 460 463 464 464 464 465 465 466 466 466

14 Inventory Framework
Overview of the Inventory System Using the Inventory System Inventory System Methods Inventory Classes InventoryManager InventoryException MissingInventoryItemException InventoryManager Implementations AbstractInventoryManagerImpl NoInventoryManager RepositoryInventoryManager CachingInventoryManager LocalizingInventoryManager Examples of Using the Inventory Manager Allocating Items for an Order Canceling or Removing an Item from an Order Displaying an Item’s Availability to a Customer Filling Partial Orders Preventing Inventory Deadlocks Handling Bundled SKUs in the Inventory Inventory Repository Inventory JMS Messages Configuring the SQL Repository Caching the Inventory Inventory Repository Administration Using the InventoryLookup Servlet Bean Building a New InventoryManager Configuring a New Inventory Manager

469
470 470 471 473 473 475 476 476 476 476 476 480 482 482 483 484 485 485 485 486 489 490 491 491 492 493 495 496

x
Contents

ATG Commerce Programming Guide

µ
497
498 501 501 510 514 561 563 564 564 565 567 571 574 575 575 577 577 578 579 580

15 Configuring the Order Fulfillment Framework
Overview of Fulfillment Process Running the Fulfillment Server Order Fulfillment Classes Fulfillment Pipelines Descriptions and Diagrams of Fulfillment Pipelines Using Locking in Fulfillment Using the OrderFulfiller Interface Using the Fulfiller Notifying the HardgoodFulfiller of a Shipment HardGoodFulfiller Examples Creating a New Fulfiller Configuring a New Fulfiller Order Fulfillment Events Fulfillment Server Fault Tolerance Fulfillment Message Redelivery Replacing the Default Fulfillment System Integrating the Order Fulfillment Framework with an External Shipping System Changing Payment Behavior in Fulfillment Server Using Scenarios in the Fulfillment Process Questions & Answers

16 Managing the Order Approval Process
Understanding the Order Approval Process Modifying the Order Approval Process Servlet Beans and Form Handlers for Approving Orders ApprovalRequiredDroplet Servlet Bean ApprovedDroplet Servlet Bean ApprovalFormHandler Pipeline Chains in the Order Approval Process approveOrder checkRequiresApproval orderApproved orderRejected checkApprovalComplete checkApprovalCompleteError JMS Messages in the Order Approval Process

583
583 588 588 588 589 589 589 590 592 593 594 595 597 598

17 Using Abandoned Order Services
An Overview of Abandoned Orders Abandonment States Order Repository Extensions Profile Repository Extensions The AbandonedOrderLogRepository Defining and Detecting Abandoned Orders Defining Abandoned and Lost Orders

601
601 603 603 604 605 605 606

xi
Contents

µ

ATG Commerce Programming Guide

Detecting Abandoned and Lost Orders Configuring AbandonedOrderService Configuring AbandonedOrderTools Scenario Events and Actions Scenario Events Scenario Actions Tracking Abandoned Orders of Transient Users AbandonedOrderEventListener TransientOrderRecorder Turning Off Transient Order Tracking Customizations and Extensions Defining Additional Types of Abandoned and Lost Orders Modifying the Criteria Used to Identify Abandoned and Lost Orders

606 608 610 615 615 618 621 621 622 622 622 622 624

18 Generating Invoices
Overview Invoices in Checkout Invoice Payment Enabling the InvoiceRequestProcessor Using the Invoice Manager Invoice Pipelines The Invoice Repository Invoice Repository Item DeliveryInfo Repository Item PaymentTerms Repository Item Sending Invoice JMS Messages

627
627 628 629 629 629 630 631 631 632 633 633

19 Using Requisitions and Contracts
Requisitions Contract Repository Items Using Contracts

635
635 636 636

20 Preparing to Use Commerce Reporting
Setting Up Commerce Reporting Environments Setting up the Asset Management Environment Setting Up the Production Environment Setting Up the Data Loading Environment Configuring a Parent Catalog Logging Data for Commerce Reporting Site Visit Data Logging Order Submit Data Logging Commerce Search Data Logging Product Catalog Data Logging User Data Logging Segment Data Logging Data Logging Configuration

639
639 640 640 640 640 641 642 642 643 643 644 645 646

xii
Contents

ATG Commerce Programming Guide

µ
647 648 650 650 654 655 655

Initial Data Logging for Catalogs, Users, and Segments JMS Message Information for Data Logging Loading Data for Commerce Reporting Data Loader Components Data Warehouse Loader Repository Handling Errors Pipeline Drivers and Processors

21 Customizing Reporting Data
Adding an Attribute to a Dimension Adding a New Dimension

667
668 669

22 ATG Commerce Web Services
Order Management Web Services addCreditCardToOrder Web Service addItemToOrder Web Service addItemToShippingGroup Web Service addShippingAddressToOrder Web Service cancelOrder Web Service createOrder Web Service createOrderForUser Web Service createOrderFromXML Web Service getCurrentOrderId Web Service getDefaultPaymentGroupId Web Service getDefaultShippingGroupId Web Service getOrderAsXML Web Service getOrdersAsXML Web Service getOrderStatus Web Service moveItemBetweenShippingGroups Web Service removeCreditCardFromOrder Web Service removeItemFromOrder Web Service removeItemQuantityFromShippingGroup Web Service removePaymentGroupFromOrder Web Service removeShippingGroupFromOrder Web Service setItemQuantity Web Service setOrderAmountToPaymentGroup Web Service submitOrderWithReprice Web Service Order Management Web Services Example Pricing Web Services calculateOrderPrice Web Service calculateOrderPriceSummary Web Service calculateItemPriceSummary Web Service Pricing Web Services Example Promotion Web Services claimCoupon Web Service getPromotionsAsXML Web Service

673
673 674 675 676 676 677 678 678 679 680 680 681 682 682 683 684 685 686 686 687 688 689 689 690 691 691 692 692 693 694 694 695 696

xiii
Contents

µ

ATG Commerce Programming Guide

grantPromotion Web Service revokePromotion Web Service Promotion Web Services Example Inventory Web Services getInventory Web Service getInventoryStatus Web Service setStockLevels Web Service setStockLevel Web Service Inventory Web Services Example Catalog Web Services catalogItemViewed Web Service getProductSkusXML Web Service getProductXMLByDescription Web Service getProductXMLById Web Service getProductXMLByRQL Web Service Catalog Web Services Example Profile Web Services getDefaultShippingAddress Web Service getDefaultBillingAddress Web Service getDefaultCreditCard Web Service setDefaultBillingAddress Web Service setDefaultCreditCard Web Service setDefaultShippingAddress Web Service Profile Web Services Example Commerce Web Services Security Using the Order Owner Security Policy

696 697 698 698 699 699 700 701 701 702 702 703 704 705 705 706 707 707 708 708 709 710 710 711 712 713

Appendix A: ATG Commerce and Session Backup Appendix B: ATG Commerce Databases
Core ATG Commerce Functionality Tables Product Catalog Tables Commerce Users Tables Claimable Tables Shopping Cart Events Table Inventory Tables Order Tables Promotion Tables User Promotion Tables Gift List Tables Price List Tables Custom Catalog Tables Abandoned Order Services Tables Order Markers Table ATG Business Commerce Tables ATG Business Commerce Product Catalog Tables

715 717
717 718 740 742 745 746 747 782 790 792 796 801 815 818 819 820

xiv
Contents

ATG Commerce Programming Guide

µ
822 828 834 839 843

ATG Business Commerce Order Tables ATG Business Commerce Organizational Tables ATG Business Commerce User Profile Extensions ATG Business Commerce Invoice Tables ATG Business Commerce Contract Tables

Appendix C: ATG Commerce Messages
Base ATG Commerce Messages Fulfillment System Messages Abandoned Order Messages ATG Business Commerce Messages

847
847 847 856 857

Appendix D: ATG Commerce Scenario Recorders
dcs dcs-analytics shoppingprocess

861
861 862 864

Index

867

xv
Contents

µ

ATG Commerce Programming Guide

xvi
Contents

ATG Commerce Programming Guide

µ

1 Introduction

Welcome to the ATG Commerce Programming Guide. The ATG Commerce application serves as the foundation for your online store. It contains everything you need to manage your product database, pricing, inventory, fulfillment, merchandising, targeted promotions, and customer relationships. ATG Commerce is available in two versions. ATG Consumer Commerce is used for developing standard business-to-consumer (B2C) online stores. ATG Business Commerce is used for sites oriented more toward business-to-business (B2B) uses. You will occasionally see the text “ATG Business Commerce only” or “ATG Consumer Commerce only” in this manual. This comprehensive guide covers ATG Business Commerce and ATG Consumer Commerce concepts for programmers. This chapter includes the following sections: Commerce Overview Finding What You Need In This Guide

Commerce Overview
This chapter introduces you to the major features of ATG Commerce: • • • • • • Product Catalog Purchasing and Fulfillment Services Targeted Promotions Inventory Management Pricing Services Merchandising Services

Product Catalog
The product catalog is a collection of repository items (categories, products, media, etc.) that provides the organizational framework for your commerce site. ATG Commerce includes a standard catalog implementation, based on the ATG SQL Repository, that you can use or extend as necessary. You can create and edit all of your repository items through the ATG Control Center, which also allows you to create page templates to display these items.

1
1 - Introduction

Invoicing (ATG Business Commerce Only). multiple payment methods and shipping addresses. and validating credit card information. the fulfillment framework takes over processing. such as a computer that can be purchased with different hard drive capacities. Order Approvals (ATG Business Commerce only). Scheduled Orders. such as when an order limit is exceeded. the fulfillment framework can be customized to meet the needs of your site. then stop so the company can review its needs and perhaps change the standard order. and check for the conditions that trigger an approval for an order. This feature allows you to sell items with variable components. Your customers can create template orders from a new or existing order. Cost Centers allow customers to track internal costs by designating parts of their organization as cost centers. B2B applications often require that customers’ orders be reviewed by authorized persons who can approve or reject them. Configurable Commerce Items. The system is designed for flexibility and easy customization. Like the purchase process.µ ATG Commerce Programming Guide Custom Catalogs. Notifying the fulfillment system that an order has been shipped to the customer. CyberSource. if approved. and TAXWARE. ensuring items are shipped by the customer’s preferred method. This system includes a collection of standard services which coordinate and execute the order fulfillment process. Purchasing and Fulfillment Services ATG Commerce provides tools to handle pre-checkout order-processing tasks such as adding items to a shopping cart. New classes in ATG Commerce allow you to export customer orders in XML for easy integration with your other systems. You can display different versions of your product catalog for different viewers. a company could set up a scheduled order to buy certain supplies on a monthly basis for the next year. Cost Centers (ATG Business Commerce only). enabling them to track costs by department and run related reports. the order proceeds through checkout. For example. ATG Commerce also includes an HTML-based Fulfillment Administration page that you can use for: • • • • Viewing orders that are ready to be shipped. 2 1 . Export an Order Via XML. if a corporate customer only wants its employees to order certain items from your store. After an approver has reviewed the order. you can create sites that support multiple shopping carts for a single user. The approval process in ATG Business Commerce can identify customers for whom approvals are required. You can integrate with third-party authorization and settlement tools such as Payflow Pro. As soon as a customer submits an order. Printing order information. This new feature gives your customers the option of being invoiced for orders they place. you can confine them to viewing and ordering only those products.Introduction . then create a schedule for the same order to be placed regularly during the time frame they specify. For example. Notifying the fulfillment system that a shipping group has changed and needs to be reprocessed.

ATG Commerce Programming Guide µ Requisitions (ATG Business Commerce only). backorder. Price Lists. The pricing calculator performs the actual price calculation based on information from the pricing engine. allowing you to associate a particular catalog. Price lists are managed through a single interface in the ACC. individual item. Targeted Promotions Business managers can use ATG Commerce promotions to highlight products and offer discounts as a way of encouraging customers to make purchases. Determine when a specific item will be in stock. Contracts tie together several important new features of ATG Business Commerce. It allows you to: • • • • • Remove items from inventory. Make a specific number of items available for customers to purchase. and edit their property values. or tax. enabling your customers to attach requisition numbers to orders. or preorder.Introduction . For example. You can use the ATG Control Center to view. improving your customers’ ability to track internal activities. price lists can be used to implement business-to-business pricing where each customer can have its own unique pricing for products based on contracts. and notify the system of inventory updates. add and delete inventory items. Requisitions work with the order approval process. These services make it possible to generate prices dynamically under constantly changing business conditions. which is separate from the product catalog. shipping charge. based on a customer’s profile. Notify the store of a customer’s intent to purchase an item that is not currently in stock (backorder) or has never been in stock (preorder). or preorder. Inventory Management The inventory framework facilitates inventory querying and inventory management for your site. then submit them for approval within their organization. manipulate the various properties of each item. Inventory information is stored in the Inventory repository. Promotions typically fall into the following categories: 3 1 . and payment terms with a specific organization. This feature allows you to target a specific set of prices to a specific group of customers. backorder. RFQ and pre-negotiated prices. ATG Commerce also includes an HTML-based administration interface for the Inventory Manager. The pricing engine determines the correct pricing model for an order. Contracts (ATG Business Commerce Only). Administrators can use this interface to view the results of the inventory query operations. Determine and modify the number of items available for purchase. Pricing Services ATG Commerce pricing services revolve around pricing engines and pricing calculators. price list(s).

Coupons are similar to gift certificates. Customers can access their wish lists and purchase items from it at any time. Wish lists allow customers to save lists of products without actually placing the items in their shopping cart. wrapping and shipping.µ • • • • • • • • Specific amount off a particular product Specific amount off a whole order Percentage amount off a whole order Free product or free order ATG Commerce Programming Guide Percentage amount off a particular product Specific amount or percentage off a product based on an attribute Substitution (buy product A for the price of product B) Free shipping for a specific product You can create promotions through a simple interface in the ATG Control Center. • Comparison lists Comparison lists enable customers to select multiple product SKUs and compare them side-by-side. • Gift Certificates and Coupons You can set up gift certificates as an item in your product catalog. Part of the purchase process allows special handling instructions for gift purchases. and gift certificate repository items. You can use the ATG Control Center to manage gift-list. for example) sent to specific customers. in turn. it is delivered via e-mail to the recipient. such as a birthday or wedding. except that they are a type of promotion (20% of an order over $100. • Gift Lists and Wish Lists Gift lists allow customers to register for an event. 4 1 . Merchandising Services ATG Commerce provides services for implementing a variety of merchandising features on your commerce site. except that it is only accessible to the person who created it.. and create a list of products that other site visitors can view.Introduction . such as address security. who. can use it to pay for purchases on the site. Customers redeem gift certificates and coupons entering a claim code during the checkout process. coupon. Customers can create an unlimited number of gift lists for themselves. When a customer purchases a gift certificate. A wish list is similar to a gift list.

products and SKUs. Audience Programmers Instructions in this Guide Covered in several chapters in this guide. price list. abandon order. Configuring the fulfillment and inventory tools provided out-the-box ATG Commerce. Programmers See the Integrating Third-Party Software With ATG Commerce chapter in this guide.Introduction . Developing a catalog and its categories. Installing ATG Commerce databases in a production environment. Working with the out-of the-box promotion. Integrating ATG Commerce with Payflow Pro. Page Developers ATG Commerce Guide to Setting Up a Store ATG Commerce Guide to Setting Up a Store Business Users Business Users ATG Commerce Guide to Setting Up a Store Business Users ATG Merchandising User Guide Site Administrators ATG Programming Guide Site Administrators See Configuring and Populating a Production Database in this guide. products.ATG Commerce Programming Guide µ Finding What You Need ATG Commerce is a comprehensive product that provides the tools you need to create a commerce Web site that’s customized to meet the particular needs of your business. CyberSource. Instructions for working with ATG Commerce live in a variety of books. Users who also have ATG Merchandising should see the ATG Merchandising User Guide instead. Building JSPs that use Commerce servlet beans. ATG Merchandising User Guide Installing database tables in support of ATG Merchandising Site Administrators 5 1 . Communicating with ATG Commerce through Web Services. and cost center tools. Creating a catalog and populating it with categories. SKUs in a publishing environment that uses projects to manage the tasks you perform and maintains versions of the commerce assets you edit. and TAXWARE. Assembling applications that include ATG Commerce and reference application modules. Here’s a key to finding the information you need:: Tasks Extending ATG Commerce programmatically by creating subclasses and modifying repositories. Setting up scenarios and creating charts.

Working with the Motorprise Business Commerce Reference Application. (Programmer) 6 1 . wish lists. and recorders. (Programmer) Customizing the Purchase Process Externals Explains how to customize the purchase process. and work with custom catalogs. configure. (Programmer) Using Custom Catalogs Describes how to create. CyberSource. (Programmer) Working With Purchase Process Objects Provides instructions for configuring the purchase process subsystem. Working with the ATG Commerce Sample Catalog. (Programmer) Using and Extending Pricing Services Describes pricing services and provides instructions for extending them.Introduction . and TAXWARE with ATG Commerce. (Programmer) Configuring Purchase Process Services Instructs you to configure how your site presents and processes orders. product comparisons. Working with the Pioneer Cycling Consumer Commerce Reference Application. ATG Business Commerce Reference Application Guide ATG Consumer Commerce Reference Application Guide Page Developers. and coupons. (Site Administrator) Using and Extending the Standard Catalog Explains how to set up a standard catalog and its content. (Programmer) ATG Commerce Profile Extensions Describes the extensions made to the Profile repository and form handlers by ATG Commerce. (Site Administrator) Integrating Third-Party Software With ATG Commerce Details how to integrate Payflow Pro. JMS messages. All All ATG Commerce Programming Guide Site Administrators See the appendices in this guide. session backup procedures.µ Review database tables. Programmers ATG Commerce Guide to Setting Up a Store In This Guide This guide is divided into the following chapters: Configuring and Populating a Production Database Provides instructions on creating and configuring Commerce tables in a non-SOLID database. gift certificates. (Programmer) Configuring Merchandising Services Describes how to set up gift lists.

Business Commerce only) Preparing to Use Commerce Reporting Describes configuration and data logging and loading for Commerce Reporting. (Programmer) Managing the Order Approval Process Details the handler methods. (Programmer) Appendix A: ATG Commerce and Session Backup Describes the Commerce session backup strategy. (Programmer) Generating Invoices Describes how invoices are generated at checkout and the repository. (Programmer) 7 1 .ATG Commerce Programming Guide µ Processor Chains and the Pipeline Manager Explains how the Pipeline Manager works with pipelines.Introduction . servlet beans. (Programmers . (Programmer) ATG Commerce Web Services Describes the Web Services that support Commerce features. (Programmer) Inventory Framework Describes the parts of the Inventory framework that you can customize. (Programmer) Appendix D: ATG Commerce Scenario Recorders Explains the recorder elements provided in support of Commerce scenarios. and pipelines used in that process. components. and pipelines used in the order approval process. describes Commerce pipelines.(Programmer) Appendix B: ATG Commerce Databases Lists the Commerce database tables and their contents. (Programmer) Appendix C: ATG Commerce Messages Describes the JMS messages included with ATG Commerce. (Programmers . (Programmers .Business Commerce only) Using Requisitions and Contracts Explains how to track orders by requisition ID and associate Commerce items to a contract.Business Commerce only) Using Abandoned Order Services Provides instructions on detecting and tracking abandoned orders. (Programmer) Configuring the Order Fulfillment Framework Describes how to work with and extend the Order Fulfillment framework. Also.

µ ATG Commerce Programming Guide 8 1 .Introduction .

The following sections describe how to create and configure your production database: Configuring ATG Commerce with CIM Creating Database Tables Using ATG Commerce with an Oracle Database Using ATG Commerce with an MSSQL Database Transferring Product Catalog and Price List Data Using Copy and Switch Transferring Demo Data Destroying Database Tables For ATG Commerce The information in this chapter focuses specifically on ATG Commerce databases. including those for the ACI data ware house.Configuring and Populating a Production Database . CIM handles the following configuration steps: • Creates database tables and imports initial data as described in this chapter. working installation running quickly and easily. Once you buy ATG Commerce.. You can use CIM to get a basic. requirements. For general information on production database configurations. instructions for creating the database tables you need are in the Configuring a Production Database section in the ATG Merchandising User Guide. Note: If your product stack includes ATG Commerce. and performance enhancements. refer to the ATG Installation and Configuration Guide. Configuring ATG Commerce with CIM ATG’s Configuration and Installation Manager (CIM) helps to simplify ATG product configuration by walking you through the required steps. Do not configure your production database following the steps provided in this chapter. 9 2 .ATG Commerce Programming Guide µ 2 Configuring and Populating a Production Database The SOLID database included with the ATG platform is provided so that potential customers can sample the ATG products and determine whether they want to purchase it. you will need to install a production-ready database before you can begin building your Web application. ATG Content Administration and ATG Merchandising. This ensures that all necessary steps are completed and are done in the correct order.

including a lock manager (as described in the ATG Installation and Configuration Guide and the ATG Programming Guide) and a data warehouse loader server. such as whether you plan to index by product or by SKU. To start CIM. CIM does handle some configuration options. do the following: 1. 5. • Creating Database Tables When you want to run ATG Commerce on a database other than SOLID. Select add-ons (such as Search or Reporting). but you will most likely have to do additional configuration. Your Commerce store and IndexingOutputConfig component. See the CIM help and the ATG Installation and Configuration Guide for additional information on CIM. You must manually configure these components to start automatically. Install your applications and the appropriate license files. See the Setting Up an ATG Content Administration Server chapter of the ATG Content Administration Programming Guide. Note that CIM does not configure the following: • • Your Content Administration topography. 10 2 . go to <ATG9dir>/home/bin and type: cim 4.Configuring and Populating a Production Database . Continue through CIM according to the prompts. Creates and configures ATG servers. you need to create and configure the database tables for the following products: 1. See the ATG Commerce Search Guide. 6. Automatic startup for the ProductCatalogOutputConfig components on either production or staging servers.µ • • • • ATG Commerce Programming Guide Creates data sources according to the database connection information you supply (as described in the ATG Installation and Configuration Guide). 2. Assembles your application EAR files for each ATG server (as described in the ATG Programming Guide). To configure Commerce using CIM. Install your application server. including those needed for the ACI data warehouse. Deploys EAR files to your application server. Create tables for ATG Adaptive Scenario Engine by following the instructions provided in the Configuring Databases and Database Access chapter of the ATG Installation and Configuration Guide. Type H at any prompt for additional information. 3. Select the products you want to configure.

ATG Consumer Commerce users should also see the Creating Tables for ATG Consumer Commerce section.sql Purpose Configures the schema for the ATG Commerce Claimable repository Creates tables for ATG Commerce credit card profile extensions Creates a table for handling shopping cart events Creates tables for the ATG Commerce inventory system Creates tables for the ATG Commerce purchase process Defines the tables that contain order markers commerce_user.ATG Commerce Programming Guide µ 2. you can run these subscripts individually from the following directory: <ATG9dir>/DCS/sql/db_components/database-vendor Script name claimable_ddl. see the sections provided in this chapter for configuring your database.sql 11 2 . Creating Tables for Core ATG Commerce First. To create the database tables for core ATG Commerce.sql order_ddl. If necessary.sql dcs_mappers. See Using ATG Commerce with an Oracle Database and Using ATG Commerce with an MSSQL database respectively. and ATG Consumer Commerce database tables. Create the ATG Commerce tables necessary for your product suite: All ATG Commerce users should see the Creating Tables for Core ATG Commerce section. run the dcs_ddl. you can skip all steps defined here and follow the instructions provided in their respective sections. See Creating Pioneer Cycling Reference Application Tables and Creating Motorprise Reference Application Tables respectively. For descriptions of core ATG Commerce.sql order_markers_ddl. Note that if you want to run Pioneer Cycling Reference Application or Motorprise Reference Application.Configuring and Populating a Production Database . see Appendix B: ATG Commerce Databases. Pioneer Cycling and Motorprise users can skip this step if they want to install tables for all products at once as described below.sql script is derived from the subscripts listed in the table below. If you are using an Oracle or MSSQL database with ATG Commerce. ATG Business Commerce. create the core ATG Commerce tables and then refer to the sections that follow for information on configuring the database tables that are specific to the version of ATG Commerce you are using.sql inventory_ddl. ATG Business Commerce users should also see the Creating Tables for ATG Business Commerce section.sql script from the following directory: <ATG9dir>/DCS/sql/install/database-vendor The dcs_ddl.

sql script is derived from the subscripts described in Creating Tables for Core ATG Commerce as well as subscripts listed in the table below.sql Description Creates tables for Pioneer Cycling catalog extensions Create tables for Pioneer Cycling profile extensions Creates tables for the French Pioneer Cycling product catalog 12 2 . run the pioneercycling_ddl. You do not need to configure any additional database tables.sql user_promotion_ddl. from the following directory: <ATG9dir>/PioneerCyclingJSP/sql/install/database-vendor Alternatively.sql b2c_user_profile_ddl. and the Pioneer Cycling reference application by running a single script.sql script from the same directory. to configure just the database tables for the Pioneer Cycling reference application. ATG Consumer Commerce.sql french_product_catalog. The pioneercycling_ddl. as described in Creating Tables for Core ATG Commerce.s ql promotion_ddl.sql product_catalog_ddl.sq l ATG Commerce Programming Guide Creates tables for price lists Creates tables for the ATG Commerce product catalog Creates tables for ATG Commerce pricing promotions Defines views for reporting Defines additional views for reporting Defines additional views for reporting Defines additional views for reporting Creates tables for ATG Commerce Giftlist services Creates tables for ATG Commerce promotion profile extensions Creating Tables for ATG Consumer Commerce To configure your database to work with ATG Consumer Commerce. core ATG Commerce. Creating Pioneer Cycling Reference Application Tables You can configure your database to work with the ATG Adaptive Scenario Engine.sql reporting_views1.sql reporting_views2.sql. pioneercyclingall_ddl.sql reporting_views3.Configuring and Populating a Production Database .sql user_giftlist_ddl.µ priceLists_ddl.sql reporting_views. you can run these subscripts individually from the following directory: <ATG9dir>/PioneerCyclingJSP/sql/db_components/database-vendor File Name b2c_product_catalog_ddl. you only need to configure the core ATG Commerce tables. If necessary.

core ATG Commerce.Configuring and Populating a Production Database . Some subscripts are part of the core ATG Commerce product and are described in the Creating Tables for Core ATG Commerce section.sql b2b_user_ddl. configure the core ATG Commerce tables first. If necessary.sql Creating Tables for ATG Business Commerce When you want to configure your database to work with ATG Business Commerce. from the following directory: <ATG9dir>/MotorpriseJSP/sql/install/database-vendor 13 2 .sql. you can create the ATG Business Commerce tables by running the b2bcommerce_ddl.ATG Commerce Programming Guide µ Creates tables for the Japanese Pioneer Cycling product catalog japanese_product_catalog. motorpriseall_ddl.sql script executes subscripts in a particular order to create the schema used by the ATG Business Commerce product.sql contracts_ddl. as described in Creating Tables for Core ATG Commerce. and the Motorprise reference application by running a single script. ATG Business Commerce.sql Creating Motorprise Reference Application Tables You can configure your database to work with the ATG Adaptive Scenario Engine.sql b2b_reporting_views. Then . The remaining subscripts are described in the table below.sql script from the following directory: <ATG9dir>/B2BCommerce/sql/install/database-vendor The b2bcommerce_ddl.sql invoice_ddl.sql organization_ddl. you can run an individual subscript from the following directory: <ATG9dir>/B2BCommerce/sql/db_components/database-vendor Script name b2b_order_ddl.sql Description Creates tables for ATG Business Commerce order repository extensions Creates tables for ATG Business Commerce product catalog extensions Defines views for reporting Creates tables for ATG Business Commerce profile extensions Creates tables for the ATG Business Commerce contracts repository Creates tables for the ATG Business Commerce invoice repository Creates tables for ATG Business Commerce organization extensions b2b_product_catalog_ddl.

you need to specify the initial extent and the incremental extent for the tables that are likely to expand significantly.µ ATG Commerce Programming Guide Alternatively. The incremental extent limits the additional space that is reserved when the segment’s initial data blocks become full.sql b2b_custom_catalog_ddl. and the expected transaction volume. The size of the extents for the tablespaces needed to store ATG Commerce tables depends on your specific requirements in terms of the catalog items you have. you can run these subscripts individually from the following directory: <ATG9dir>/MotorpriseJSP/sql/db_components/database-vendor Script name b2b_auth_cc_ddl. To allocate space.sql script from the same directory.sql b2b_user_orddet_ddl.sql script is derived from the subscripts that are described in the Creating Tables for ATG Business Commerce section as well as other subscripts listed in the table below. and more space is required. you need to configure the storage parameters for several tables and configure your ATG Commerce catalog for full text searching. run the motorprise_ddl. to configure just the database tables for the Motorprise reference application. This section covers these configuration tasks: • • Configuring Storage Parameters Configuring a Catalog for Oracle Full Text Searching Configuring Storage Parameters The SQL scripts that configure ATG Commerce databases on Oracle do not set storage parameters to control how free database space is allocated.sql Using ATG Commerce with an Oracle Database To use ATG Commerce with an Oracle database. the expected number of user profiles and Web site visitors.sql german_catalog_ddl.sql Purpose Creates tables for Motorprise profile extensions for authorization Creates tables for Motorprise custom catalog extensions Creates tables for Motorprise profile extensions for order details Creates tables for the Motorprise product catalog extensions for German content Creates tables for the Motorprise product catalog extensions for Japanese content japanese_catalog_ddl. You should spread your tablespaces across several disk drives and disk controllers.Configuring and Populating a Production Database . If necessary. 14 2 . The motorprise_ddl. The initial extent parameter limits the amount of space that is reserved initially for a table’s data segment.

you should configure the storage parameters for the following ATG Commerce tables: Table Name DCS_CATEGORY DCS_PRODUCT DCS_SKU DCS_MEDIA_BIN DSS_SCENARIO_INFO Initial Extent 1M 1M 1M 4M 4M Note: These storage parameters are guidelines only. Configuring a Catalog for Oracle Full Text Searching If your product catalog is stored in an Oracle database. To enable full text searching on columns. see your Oracle documentation. To specify a storage parameter. To prevent this. you must create ConText indexes for the columns. the optimal settings for your database may vary depending on the expected number of user profiles. 2. you must configure the catalog to properly handle full text searching. As previously mentioned. Note: By default. which processes queries and returns information based on the content or themes of text stored in a text column of an Oracle database. you should configure ConText indexing to occur at regular intervals. Set up the proper ConText full text indexes on the appropriate columns in the database. you can set the extent sizes for the tablespaces to be 512K with pctincrease equal to 50. See your Oracle documentation for information about how to do this. and catalog items. There are two main steps involved in this configuration: 1. Make sure the simulateTextSearchQueries property of each product catalog repository component is set to false.Configuring and Populating a Production Database . If you are loading the Pioneer Cycling reference application or Motorprise reference application on an Oracle database. include it in the STORAGE clause of the CREATE TABLE statement for these tables. These steps are described in more detail in the sections that follow. using the following format: 15 2 .ATG Commerce Programming Guide µ Incremental Extent 1M 1M 1M 2M 2M To begin. as well as the expected transaction volume. Setting Up the ConText Indexes The SQL Repository has built-in support for Oracle’s ConText full text search engine. This behavior can cause a full deployment to hang indefinitely. an Oracle database rebuilds a full-text index after each commit. For additional information about configuring storage parameters. Web site visitors.

CONTEXT PARAMETERS('SYNC (EVERY "interval-string" '). Configuring the Repository Components for Full Text Searching To enable a SQL Repository to use full text searching in an Oracle database. index these tables: DCS_PRODUCT DCS_CATEGORY DFR_PRODUCT DFR_CATEGORY DJP_PRODUCT DJP_CATEGORY If you have imported the Motorprise product catalog into Oracle. the simulateTextSearchQueries property of the SQL Repository component must be set to false. If you have exported the Pioneer Cycling catalog into Oracle. LONG_DESCRIPTION. create a ConText index on the DESCRIPTION. there are three SQL Repository components for the catalog: • • • /atg/commerce/catalog/ProductCatalog /atg/commerce/catalog/FrenchProductCatalog /atg/commerce/catalog/JapaneseProductCatalog 16 2 .µ DCS_PRODUCT DCS_CATEGORY ATG Commerce Programming Guide CREATE INDEX schema-index-name ON schema-table (column) INDEXTYPE IS CTXSYS. index these tables: If you have imported the Pioneer Cycling product catalog into Oracle. the SQL Repository component for the catalog has the Nucleus address /atg/commerce/catalog/ProductCatalog. If you are using the default product catalog.Configuring and Populating a Production Database . If you are using the default product catalog. and DISPLAY_NAME columns. Make sure this property is set to false for any SQL Repository component that connects to an Oracle database. index these tables: DCS_PRODUCT DCS_CATEGORY DBC_CATEGORY_DE DBC_PRODUCT_DE In each of these tables.

DESCRIPTION and DISPLAY_NAME columns.ATG Commerce Programming Guide µ Using ATG Commerce with an MSSQL Database If your ATG Commerce product catalog is stored in a Microsoft SQL Server database. See the subsections that follow for information on completing each step. 4. you must configure the database and catalog to properly handle full text searching. Setting Up the MS SQL Full Text Indexes To enable full text searching on columns. Set the simulateTextSearchQueries property of each product catalog repository component to false. 3. There are four steps involved in the configuration process: 1. 17 2 . Set up the proper full text indexes on the appropriate columns in the database. Configure each search form handler component. If you are using the default ATG Commerce product catalog. Modify the template definition file. you must create full text indexes for the columns.Configuring and Populating a Production Database . create an index for the LONG_DESCRIPTION. 2. index these tables: DCS_PRODUCT DCS_CATEGORY DFR_PRODUCT DFR_CATEGORY DJP_PRODUCT DJP_CATEGORY If you have imported the Motorprise product catalog into MS SQL. index these tables: DCS_PRODUCT DCS_CATEGORY If you have imported the Pioneer Cycling product catalog into MS SQL. See your Microsoft SQL Server documentation for specific information on performing this step. index these tables: DCS_PRODUCT DCS_CATEGORY DBC_CATEGORY_DE DBC_PRODUCT_DE For each of these tables.

ATG Commerce includes five instances of this class in /atg/commerce/catalog/: • • • • • AdvProductSearch CatalogSearch CategorySearch ProductSearch ProductTextSearch If you’ve created your own instances of this class. be sure to also set the properties of those components as described above. there are three SQL repository components for the catalog: • • • /atg/commerce/catalog/ProductCatalog /atg/commerce/catalog/FrenchProductCatalog /atg/commerce/catalog/JapaneseProductCatalog Configuring the Search Form Handlers If your site uses components of class atg. you must configure these components to generate full-text queries in the appropriate form.commerce. see the ATG Repository Guide. the simulateTextSearchQueries property of the SQL repository component must be set to false.µ Modifying the Template Definition File <query-items item-descriptor="product"> ATG Commerce Programming Guide If you include any full text search queries in the XML template definition file (using the <query-items> tag). each component must be configured as follows: 1. Set the searchStringFormat property to MSSQL_TSQL.custom. the SQL repository component for the catalog has the Nucleus address /atg/commerce/catalog/ProductCatalog.catalog. If you are using the default product catalog. verify that the queries use the appropriate format for MS SQL Full Text Query.commerce.SearchFormHandler (or atg.catalog. 18 2 . Set the allowEmptySearch property to false. By default. If you have exported the Pioneer Cycling catalog into MS SQL. For example: description MATCHES "Ethernet" USING "MSSQL_TSQL" </query-items> For more information on template definition files. To do this. 2.CatalogSearchFormHandler for custom catalogs) to build search forms for full-text searching. Configuring the Repository Components for Full Text Searching To enable a SQL repository to work with a full text search engine.Configuring and Populating a Production Database .

The database Switch feature enables you to switch the product catalog and price lists on your Web site to use a different data source.) This chapter describes how to perform a database copy and switch of the ATG Commerce product catalog and price list repositories. which are included with ATG Commerce. Refer to the database client’s documentation for more information. which is located in Nucleus at /atg/projects/b2bstore/catalog/SearchCompare. If you have imported the Motorprise product catalog into MS SQL. see the ATG Installation and Configuration Guide. (See the configuration sections in this chapter for more information on the configuration processes. You must complete this process before performing an initial database copy.Configuring and Populating a Production Database . However. The database Copy feature enables you to copy product catalog and price lists data from one database to another. It includes the following sections: • • • • Configuring a Database Copy Performing a Database Copy Configuring a Database Switch Performing a Database Switch Note: For additional information about copying and switching databases and setting up your database servers. 19 2 . configure this component as described above as well. you don’t need to complete this process before subsequent database copies as long as the source and destination databases remain the same. Transferring Product Catalog and Price List Data Using Copy and Switch The database Copy and Switch features assist you in moving your product catalog and price lists data from one environment to another. for example.custom. The differences are in the configuration of the environment within which ATG Commerce is running. Note: While the process used in this section assumes the data is in a SOLID database. Configuring a Database Copy This section describes the configuration steps you must take before performing a database copy of your product catalog and price lists data. from a staging environment to a “live” production environment.commerce. Both database Copy and database Switch are Dynamo Application Framework (DAF) features that can be used with any database. see Appendix B: ATG Commerce Databases in this manual. For information about ATG Commerce database tables. ATG Commerce provides a user interface for performing a database copy or switch. This user interface requires initial configuration before you perform each type of update for the first time. the mechanisms are the same regardless of what kind of database is used.ATG Commerce Programming Guide µ Also note that the Motorprise Store Solution Set uses its own instance of atg.catalog. Some database clients require additional configuration to perform the database copy.CatalogSearchFormHandler. However.

The following are some SOLID-specific configuration settings: $SOLIDDIR should be defined in the environment in which Dynamo is running. but the DBCopier in this process instead uses native commands according to the database manufacturer. It executes a new process and uses the vendor’s bulk copy tools to copy the tables from one database to another. For more information on these DBCopier classes. Create a DBCopier component with which to copy the product catalog and price lists data.µ 1. For more information on the maxTextOrImageSize property.DBCopier and are in package atg. therefore.Configuring and Populating a Production Database . They are: ProductCatalogMsSqlDBCopier Note: By default. [Data Sources] SOLID=TCP/IP localhost 1313. Verify that the environment is set up correctly. Make sure that all the necessary environmental variables are set as specified by the vendor. you can refer to the ATG API Reference. The class from which you instantiate the DBCopier depends on the database you are using. The names of the servers to use when performing the database copy should be defined in the solid. the JVM running Dynamo must have the proper environment set up as specified by the vendor.maxTextOrImageSize property is set to a negative value (-1) in order to force the copier not to use the –T option with the bcp utility.gsa: BcpDBCopier (for Microsoft and Sybase) DB2DBCopier OracleDBCopier SolidDBCopier 3. Most interactions between the ATG Commerce and a database are done through JDBC. See your vendor documentation for these specifications. you can refer to the ATG API Reference and the ATG Installation and Configuration Guide. 2.adapter. the –T option does not work with MS SQL.gsa. the ProductCatalogMsSqlDBCopier. Alternatively. ATG Commerce Programming Guide Follow these configuration steps to prepare to copy the product catalog and price lists data from one database to another: Create the destination database and all destination tables. Verify that all the necessary drivers or client tools are installed. The following are subclasses of atg. refer to the BcpDBCopier class (from which ProductCatalogMsSqlDBCopier is instantiated) in the ATG API 20 2 .adapter. For information on the API for the specific DBCopier you are using. you can use one of the preconfigured DBCopier components that are included with ATG Commerce.SOLID Note that “SOLID” is a valid server name. This means that the DBCopier and.ini file.

# directory=d:/copytmp # # The name of the file that gets created to delete # data from the destination.adapter. There are 3 sets of tables listed here: product catalog. The tables are updated in the order they appear in this list.gsa. and price lists.ATG Commerce Programming Guide µ Reference. refer to your database vendor documentation. Copy will overwrite these tables.Configuring and Populating a Production Database . promotions. ProductCatalogOracleDBCopier ProductCatalogDB2DBCopier ProductCatalogSybaseDBCopier ProductCatalogSolidDBCopier These DBCopier components are located in Nucleus at /atg/commerce/jdbc/. Only list static tables that do not change.sql # # # # # # # # # # # # # # # # # # # # # The list of tables that will actually be copied. If there are references between tables. These are the product catalog tables: dcs_folder dcs_media dcs_media_ext dcs_media_bin dcs_media_txt dcs_category dcs_category_acl 21 2 . $class=atg. # deleteDataFileName=del_dest_data.SolidDBCopier # # The directory where temporary files are stored. The following code example is taken from the properties file of ProductCatalogSolidDBCopier: # This is an instance of the DBCopier specific for copying # ProductCatalog data from one Solid instance to another. make sure they appear in the correct order. For more information on the bcp utility.

Configuring and Populating a Production Database . you should also add these files: # 22 2 .µ ATG Commerce Programming Guide # dcs_product # dcs_product_acl # dcs_sku # dcs_cat_groups # dcs_cat_chldprd # dcs_cat_chldcat # dcs_cat_ancestors # dcs_cat_rltdcat # dcs_cat_keywrds # dcs_cat_media # dcs_cat_aux_media # dcs_prd_keywrds # dcs_prd_media # dcs_prd_aux_media # dcs_prd_chldsku # dcs_prd_skuattr # dcs_prd_groups # dcs_prd_rltdprd # dcs_prd_ancestors # dcs_sku_attr # dcs_sku_link # dcs_sku_bndllnk # dcs_sku_media # dcs_sku_aux_media # dcs_sku_replace # dcs_sku_conf # dcs_config_prop # dcs_conf_options # dcs_config_opt # dcs_foreign_cat # # These are the promotion tables: # # dcs_promotion # dcs_promo_media # dcs_discount_promo # # These are the price list tables: # # dcs_price_list # dcs_complex_price # dcs_price # dcs_price_levels # dcs_price_level # dcs_gen_fol_pl # dcs_child_fol_pl # dcs_plfol_chld # # If you are using custom catalogs.

\ dcs_prd_media.\ dcs_cat_keywrds.\ dcs_sku.\ dcs_prd_keywrds.\ dcs_media_bin.\ dcs_cat_rltdcat.\ dcs_prd_skuattr.\ dcs_media.ATG Commerce Programming Guide µ # dcs_catalog # dcs_root_cats # dcs_allroot_cats # dcs_root_subcats # dcs_sub_catalogs # dcs_category_info # dcs_product_info # dcs_sku_info # dcs_cat_subcats # dcs_cat_subroots # dcs_cat_catinfo # dcs_catinfo_anc # dcs_prd_prdinfo # dcs_prdinfo_rdprd # dcs_prdinfo_anc # dcs_sku_skuinfo # dcs_skuinfo_rplc # dcs_gen_fol_cat # dcs_child_fol_cat # dcs_catfol_chld # # tables= \ dcs_folder.\ dcs_prd_chldsku.\ dcs_media_ext.\ dcs_cat_chldcat.Configuring and Populating a Production Database .\ dcs_cat_media.\ dcs_product_acl.\ dcs_prd_rltdprd.\ dcs_category_acl.\ dcs_prd_ancestors.\ dcs_cat_ancestors.\ dcs_cat_chldprd.\ dcs_prd_groups.\ dcs_prd_aux_media.\ 23 2 .\ dcs_cat_aux_media.\ dcs_cat_groups.\ dcs_media_txt.\ dcs_sku_attr.\ dcs_category.\ dcs_product.

If you want to use a different database for the database copy.µ dcs_sku_link. and therefore a different DBCopier.\ dcs_promotion.\ dcs_conf_options.\ dcs_promo_media.\ dcs_discount_promo.\ dcs_price_levels.DBCopyFormHandler $scope=request 6. # $class=atg. 7. Check that the directory specified in the directory property of the DBCopier exists in the file system used by Dynamo.adapter.gsa.\ dcs_price_level. Verify that the tables property of the DBCopier component includes all the necessary tables to copy in the correct order.\ dcs_sku_bndllnk. It is located in Nucleus at /atg/commerce/jdbc/ProductCatalogCopierForm.DBCopyFormHandler to handle the database copy.\ dcs_sku_conf. 5. 4. note that the ProductCatalogOracleDBCopier and ProductCatalogSolidDBCopier components specify additional tables because Pioneer Cycling uses additional tables for its product catalog. 24 2 .\ dcs_child_fol_pl. you’ll need to manually add these tables to the DBCopier. Alternatively. The following code example is taken from the properties file of ProductCatalogCopierForm: # # This is an instance of the DBCopyFormHandler that is specific # to copying product catalog and price lists data.\ dcs_foreign_cat.Configuring and Populating a Production Database .\ dcs_plfol_chld ATG Commerce Programming Guide Note: If you are running Pioneer Cycling.\ dcs_price.\ dcs_sku_media.droplet. you can use the preconfigured DBCopyFormHandler included with ATG Commerce.\ dcs_config_opt. The tables in the destination database will be updated according to the list of tables in this property.sql. Create an instance of atg.\ dcs_sku_replace. to obtain information on the activity of the DBCopier.\ dcs_price_list. you can set the loggingDebug property of the DBCopier component to true.\ dcs_gen_fol_pl.\ dcs_sku_aux_media.\ dcs_config_prop.\ dcs_complex_price. Optionally.

6. and Password for the Destination database. It can be used. Perform the database copy from the Copy Product Catalog and Price Lists page. The system displays the Product Catalog and Price Lists Copy/Switch page.ATG Commerce Programming Guide µ # # This is the DBCopier to use. and Password for the Source database. Note that the time it takes to perform the database copy depends on the size of the database. as described in Performing a Database Copy. ask your database administrator to copy the database. The contents of the Source database are copied into the Destination database. Click the Copy/Switch Commerce Data link. For example. (See Configuring a Database Copy for a code example of a DBCopier configuration file. Note: your application must include the Dynamo Administration UI in order for you to access it. Performing a Database Copy This section describes the process to copy the contents of one database to another database. Note: You must have read. 4. 25 2 . To perform a database copy of the product catalog and price lists data: 1. to copy the updated contents of the product catalog/price lists database on an Administration server to the product catalog/price lists database on a Staging server. on JBoss the default URL is: http://hostname:8080/dyn/admin/atg/commerce/admin 2. Enter the Server Name. If you do not have the appropriate permissions. The class used depends on the # brand of database being used. Make sure the configuration file of the DBCopier you are using has been updated to account for any database tables you have created or deleted. Enter the Server Name.Configuring and Populating a Production Database . as well as import and export permissions. to perform the database copy. Username. 3. The system displays the Copy Product Catalog and Price Lists page. 5. Username. See the ATG Installation and Configuration Guide to find the default port. 7. Click the Copy button. # DBCopier=/atg/commerce/jdbc/ProductCatalogSolidDBCopier 8. Click the Copy link. write and delete permissions. for example.) Access the main Commerce Administration page of the Dynamo Administration UI using the port appropriate for your application server.

Follow these configuration steps to prepare to switch the data source used by the product catalog and price lists repositories: 1. Alternatively. However.FakeXADataSource driver=solid. 3. By default. In an actual database switch. The dataSource property contains a reference to the data source that stores information for connection to a database.Configuring and Populating a Production Database .jdbc.dataSource is set to ProductCatalogFakeXADataSourceB. ProductCatalogDataSourceA. you can use the data sources provided with the default configuration of ATG Commerce. By setting this property for ProductCatalogDataSourceA and ProductCatalogDataSourceB.service. both FakeXADataSource data sources have the same configuration. The Nucleus components used in this example are located at /atg/commerce/jdbc. you control to what database each data source points. Note: In this example. Alternatively. For example. These data sources are used as the example data sources in this procedure. and ProductCatalogDataSourceB. you don’t need to complete this process before subsequent database switches as long as the data sources involved remain the same. Both of these FakeXADataSource data sources are configured as follows: $class=atg. You must complete this process before performing an initial database switch.jdbc. you can use ProductCatalogSwitchingDataSource. 2.SolidDriver URL=jdbc:solid://hostname:port user=user password=password The port for SOLID is typically 1313. Create a SwitchingDataSource. Create the underlying data sources. The SwitchingDataSource can switch from one underlying data source to another. the configuration of the two data sources would be different. When you perform a database switch. you use a SwitchingDataSource to switch between two product catalog/price lists data sources. which is located in Nucleus at 26 2 .dataSource is set to ProductCatalogFakeXADataSourceA. They are: /atg/commerce/jdbc/ProductCatalogDataSourceA and /atg/commerce/jdbc/ProductCatalogDataSourceB. Note: While the process used in this section assumes the data is in a SOLID database. the method could switch from a test database to a production database.µ Configuring a Database Switch ATG Commerce Programming Guide This section describes the configuration steps you must take before performing a database switch of the data source used by the product catalog and price lists on your Web site. the mechanisms are the same regardless of what kind of database is used. Configure the dataSource property in each of the data sources.

service. 4. The Switch UI uses the ProductCatalogSwitcher form handler to perform the database switch. so you must add the following to the PriceLists. This SwitchingDataSource is provided with the default configuration of ATG Commerce. In a SwitchingDataSource. Configure the switchingDataSource property of the ProductCatalogSwitcher form handler (class atg. By default.properties file at localconfig/atg/commerce/pricing/priceLists/: dataSource=/atg/commerce/jdbc/ProductCatalogSwitchingDataSource 6. $class=atg.SwitchingDataSource # # A map from data source names to data sources # dataSources=\ DataSourceA=/atg/commerce/jdbc/ProductCatalogDataSourceA.properties file at localconfig/atg/commerce/catalog/: dataSource=/atg/commerce/jdbc/ProductCatalogSwitchingDataSource 5.droplet. all DataSource method calls are passed through to the DataSource specified in the currentDataSource property. so you must add the following to the ProductCatalog. Configure the PriceLists repository to use the SwitchingDataSource.jdbc. For more information on SwitchingDataSource. see the ATG API Reference and the ATG Installation and Configuration Guide.\ DataSourceB=/atg/commerce/jdbc/ProductCatalogDataSourceB # # The name of the data source that should be used # initialDataSourceName=DataSourceA The dataSources property of a SwitchingDataSource is a mapping of data source names to the Nucleus path of each data source. The following example shows the configuration for the ProductCatalogSwitchingDataSource included with ATG Commerce. the ProductCatalog repository does not use this data source.Configuring and Populating a Production Database . A SwitchingDataSource is a DataSource that can switch between two or more underlying data sources. Perform the database switch.ATG Commerce Programming Guide µ /atg/commerce/jdbc/.SwitchDataSourceFormHandler) to use the SwitchingDataSource. 27 2 . 7. By default.sql. which is defined at run time. The initialDataSource is the data source used. the PriceLists repository does not use this data source. Configure the ProductCatalog repository to use the SwitchingDataSource. as described in Performing a Database Switch. the switchingDataSource property specifies the specific SwitchingDataSource controlled by the form handler.

See the ATG Installation and Configuration Guide to find the default port. the page displays the following message: “You have finished switching the data source used by the Product Catalog and the Price Lists. The system displays the Switch the Product Catalog’s and Price List’s Data Source: Prepare page. Each repository performs any functions needed to prepare for a switch.µ Performing a Database Switch ATG Commerce Programming Guide This section describes the process of switching the data source used by the product catalog and price lists on your Web site. you must do so on each DRP server instance in a Dynamo server cluster. When you perform a database switch. The system displays the Product Catalog and Price Lists Copy/Switch page.” 6. you can finish the switch. 3. The system prepares for the switch by sending events to each of the repositories that are using the switching data source. on JBoss the default URL is: http://hostname:8080/dyn/admin/atg/commerce/admin/en/index. When preparation is complete. 2. access the Commerce Administration UI. you need to connect to the server’s Admin port.Configuring and Populating a Production Database . When the switch is complete. Access the main Commerce Administration page of the Dynamo Administration UI using the port appropriate for your application server. Click the Prepare for Switch button.jhtml Note: your application must include the Dynamo Administration UI module in order for you to view this URL. the following message displays at the top of the Switch the Product Catalog’s and Price List’s Data Sources: Switch page: “Now that you have prepared the data source. 28 2 . 1. 4. Click the Copy/Switch Commerce Data link. for each DRP server instance. Follow these steps to switch the data source currently used by the product catalog and price lists on your Web site. and perform the database switch. Click the Switch button to complete the switch. Select the name of the data source to which you want to switch from the drop-down list at the bottom of the page. Consequently. The data source currently being used by your site is displayed below the table.” The data source to which you just switched is now listed as the current data source. For example. 5. This is necessary because the SwitchingDataSource components on separate instances do not synchronize themselves. The names and paths of the available data sources are listed. Click the Switch link.

Oracle users: Before importing the demo data. or that they are pointing to the demo SOLID database. go to the <ATG9dir>/home directory. refer to the Configuring Databases and Database Access section of the ATG Installation and Configuration Guide.xml Motorprise For more information. you must update your connection pool service to use the new database. See your MS SQL documentation for instructions. set the useSetCharacterStream property of all SQL repository components to true so that non-8859 characters are displayed correctly.xml bin/startSQLRepository -m MotorpriseJSP -exportRepositories all all. You can export that data to your production database to test the demos against your production environment. All Dynamo supported databases can import all.xml. Demo Application Pioneer Cycling Command bin/startSQLRepository -m PioneerCyclingJSP -exportRepositories all all.xml. 29 2 . if necessary Import the demo data Microsoft SQL users: In order to run the ATG demos with a Microsoft SQL database. Importing the Demo Data to Your Database Your connection pool properties file must be pointing to the new target database. Start the SOLID database and use the commands below (on one line. You can set this property in your localconfig/GLOBAL.xml to your target database. with no line breaks) to export the demo data to an XML file called all.Configuring and Populating a Production Database . you must configure the database to be case-sensitive. Exporting the Demo Data from SOLID Make sure that either there are no connection pool properties files. see the ATG Installation and Configuration Guide. you must do the following: • • • Export the demo data Reset your production database. Your connection pool properties file must be pointing to the new target database. To transfer the demo data to your production database. For more information on configuring connection pools. Use the commands below (on one line.properties file: useSetCharacterStream=true From the command line. with no line breaks) to import the data contained in all. Once you have exported the data to your database.ATG Commerce Programming Guide µ Transferring Demo Data You can move the Pioneer Cycling and Motorprise demo data from the SOLID database to another database using the ATG startSQLRepository utility.

If necessary. and ATG Consumer Commerce database tables.sql drop_dcs_mappers. Destroying Tables for Core ATG Commerce To destroy all core ATG Commerce tables.xml For more information about the startSQLRepository utility. followed by the ATG Adaptive Scenario Engine tables. ATG Business Commerce. then the core ATG Commerce. If you want to remove all tables for ATG Business Commerce. you would destroy first the ATG Business Commerce tables. run the drop_dcs_ddl. see Appendix B: ATG Commerce Databases.sql script is derived from the subscripts listed in the table below. This section includes the following subsections: • • • Destroying Tables for Core ATG Commerce Destroying Tables for ATG Consumer Commerce Destroying Tables for ATG Business Commerce For descriptions of core ATG Commerce.sql 30 2 . for example. When you destroy database tables.µ Demo Application Pioneer Cycling Motorprise Command ATG Commerce Programming Guide bin/startSQLRepository -m PioneerCyclingJSP -import all. you need to destroy them in the opposite order you used for creating them. see the ATG Repository Guide. you can run these subscripts individually from the following directory: <ATG9dir>/DCS/sql/uninstall/database-vendor File Name drop_claimable_ddl.sql Description Destroys the schema for the ATG Commerce Claimable repository Destroys the tables for the ATG Commerce credit card profile extensions Destroys the table for handling shopping cart events drop_commerce_user. Destroying Database Tables for ATG Commerce This section describes how to destroy the ATG Commerce database tables.sql script from the following directory: <ATG9dir>/DCS/sql/install/database-vendor The drop_dcs_ddl.Configuring and Populating a Production Database .xml bin/startSQLRepository -m MotorpriseJSP -import all.

from the following directory: <ATG9dir>/PioneerCyclingJSP/sql/install/database-vendor Alternatively. The drop_pioneercycling_ddl.sql drop_order_ddl.sql script from the same directory. If necessary.sql script is derived from the subscripts that are described in Destroying Tables for Core ATG Commerce section as well as those listed in the table below.sql.sql drop_order_markers_ddl. core ATG Commerce.sql drop_product_catalog_ddl.sql drop_user_promotion_ddl. as described in Destroying Tables for Core ATG Commerce. Destroying Pioneer Cycling Reference Application Tables You can destroy the database tables for the ATG Adaptive Scenario Engine. you only need to destroy the core ATG Commerce tables. ATG Consumer Commerce. You do not need to destroy any additional database tables.sql drop_reporting_views1. and the Pioneer Cycling reference application by running a single script.sql Destroying Tables for ATG Consumer Commerce To destroy all ATG Consumer Commerce tables. you can run these subscripts individually from the following directory: <ATG9dir>/PioneerCyclingJSP/sql/uninstall/database-vendor 31 2 .sql drop_user_giftlist_ddl.sql drop_reporting_views. run the drop_pioneercycling_ddl.sql drop_priceLists_ddl.sql drop_promotion_ddl.sql drop_reporting_views3.Configuring and Populating a Production Database . to destroy just the database tables for the Pioneer Cycling reference application.sql drop_reporting_views2.ATG Commerce Programming Guide µ Destroys the tables for the ATG Commerce inventory system Destroys the tables for the ATG Commerce purchase process Destroys the tables that contain order markers Destroys the tables for the ATG Commerce price lists Destroys the tables for the ATG Commerce product catalog Destroys the tables for the ATG Commerce promotions Destroys the views for reporting Destroys additional views for reporting Destroys additional views for reporting Destroys additional views for reporting Destroys the tables for the ATG Commerce Giftlist Services Destroys the tables for the ATG Commerce promotions profile extensions drop_inventory_ddl. drop_pioneercyclingall_ddl.

you can run each subscript individually from the following directory: <ATG9dir>/B2BCommerce/sql/uninstall/database-vendor Script name drop_b2b_order_ddl. If necessary.sql drop_japanese_product_catalog.sql Purpose Destroys the tables for the ATG Business Commerce order repository extensions 32 2 . six views that are created by ATG Consumer Commerce are removed because they are not applicable in ATG Business Commerce. destroy first the core ATG Commerce tables. as described in Destroying Tables for Core ATG Commerce and then run the ATG Business Commerce script appropriate for your product suite.sql script is derived from subscripts described in Destroying Tables for Core ATG Commerce as well as subscripts listed in the table below.sql script from the following directory: <ATG9dir>/B2BCommerce/sql/install/database-vendor The drop_b2bcommerce_ddl.Configuring and Populating a Production Database .sql drop_b2c_user_profile_ddl. as described in Destroying Tables for Core ATG Commerce. The views involved are listed below: • • • • • • View DRPT_PRODUCTS View DRPT_CATEGORY View DRPTW_CAT_SALES View DRPTM_CAT_SALES View DRPTQ_CAT_SALES View DRPTA_CAT_SALES To destroy all ATG Business Commerce tables. This is not an error. During the installation of ATG Business Commerce.µ Script name drop_b2c_product_catalog_ddl. Note: While dropping these tables you may see error messages indicating that six views could not be removed.sql drop_french_product_catalog.sql ATG Commerce Programming Guide Purpose Destroys tables for the Pioneer Cycling catalog extensions Destroys tables for the Pioneer Cycling profile extensions Destroys tables for the French Pioneer Cycling catalog Destroys tables for the Japanese Pioneer Cycling catalog Destroying Tables for ATG Business Commerce To destroy all ATG Business Commerce tables. and then run the drop_b2bcommerce_ddl. destroy the core ATG Commerce tables.

sql drop_german_catalog_ddl.sql script from the same directory. and the Motorprise reference application by running a single script.sql Destroying Motorprise Reference Application Tables You can destroy the database tables for ATG Adaptive Scenario Engine. to destroy just the database tables for the Motorprise reference application. drop_motorpriseall_ddl.sql drop_invoice_ddl.sql script is derived from the Destroying Tables for ATG Business Commerce as well as subscripts listed in the table below.sql 33 2 . ATG Business Commerce.sql drop_b2b_user_orddet_ddl. core ATG Commerce. The drop_motoprise_ddl. from the following directory: <ATG9dir>/MotorpriseJSP/sql/install/database-vendor Alternatively. run the drop_motorprise_ddl. you can run each subscript individually from the following directory: <ATG9dir>/MotorpriseJSP/sql/uninstall/database-vendor Script name drop_b2b_auth_cc_ddl.sql drop_b2b_user_ddl.sql drop_organization_ddl.sql Purpose Destroys tables for the Motorprise profile extensions for authorization Destroys tables for the Motorprise custom catalog extensions Destroys tables for the Motorprise profile extensions for order details Destroys tables for the Motorprise product catalog extensions for German content drop_b2b_custom_catalog_ddl.sql drop_b2b_reporting_views.sql drop_contracts_ddl.Configuring and Populating a Production Database .sql. If necessary.ATG Commerce Programming Guide µ Destroys the tables for the ATG Business Commerce product catalog extensions Destroys the views for reporting on ATG Business Commerce Destroys the tables for the ATG Business Commerce profile extensions Destroys the tables for the ATG Business Commerce contracts repository Destroys the tables for the ATG Business Commerce invoice repository Destroys the tables for the ATG Business Commerce organization extensions drop_b2b_product_catalog_ddl.

sql ATG Commerce Programming Guide Destroys tables for the Motorprise product catalog extensions for Japanese content 34 2 .µ drop_japanese_catalog_ddl.Configuring and Populating a Production Database .

To use CyberSource for credit verification and TAXWARE instead of CyberSource for tax information. The order of the modules affects their precedence. 3. such as address verification. When you assemble your application. 35 3 . To use Payflow Pro with ATG Commerce. follow these steps: 1. Assemble an application that includes ATG Commerce and Payflow Pro. See Using ATG Commerce with Payflow Pro. 2. Install and register Payflow Pro. 4. and crediting. See Setting Up Payflow Pro. then the address verification implementation of the module with the highest precedence is used. If two application modules each implement the same capability. include the following modules: • • For ATG Business Commerce: B2BCommerce Cybersource Taxware For ATG Consumer Commerce: B2CCommerce Cybersource Taxware Integrating Payflow Pro with ATG Commerce The Payflow Pro payment object handles credit card authorization. be sure to specify the module for the third party software you want to use. As an example. settlement. CyberSource and TAXWARE both have a tax calculation feature.ATG Commerce Programming Guide µ 3 Integrating Third-Party Software With ATG Commerce This chapter describes how to integrate ATG Commerce with the following third party software applications: Integrating Payflow Pro with ATG Commerce Integrating CyberSource with ATG Commerce Integrating TAXWARE with ATG Commerce Note: You can use more than one third-party application module. See Pre-Configuring the Integration. and the module with the highest precedence is at the end of the line. Start Payflow Pro Provide property values to two Nucleus components.Integrating Third-Party Software With ATG Commerce .

payflowpro. Although it’s recommended to set a value for all properties. The registration process has two parts: setting up a Payflow Pro account and obtaining a Merchant account. For information on ATG modules and application assembly. You need to set up this service manually.PaymentManager $scope=global creditCardProcessor=/atg/commerce/payment/PayFlowProConnection Using ATG Commerce with Payflow Pro When you use ATG Commerce with Payflow Pro. Refer to the documentation and information available at http://www. you need to provide property values to two existing components.commerce. such as <ATG9dir>/home/localconfig. PayFlowProConnection.properties in a local configuration directory.Integrating Third-Party Software With ATG Commerce . such as <ATG9dir>/home/localconfig. be sure to install and configure Payflow Pro SDK. proxyLogon. create a file called PaymentManager.PayFlowProConnection $scope=global partner= vendor= user= password= hostAddress= hostPort= timeout= proxyAddress= proxyPort= proxyLogon= proxyPassword= Provide the same value to each property that you provided when you registered for Payflow Pro. Also. 36 3 . Pre-Configuring the Integration Before you assemble your application. Keep track of the registration information you specify because you’ll need to provide some of it to the ATG Commerce.verisign.µ Setting up Payflow Pro ATG Commerce Programming Guide Before using Payflow Pro.payment. or proxyPassword. Set the vendor property to the merchant name. with the following contents: $class=atg. Create a file called PayFlowProConnection. and registering with VeriSign.properties in a local configuration directory. ATG Commerce automatically configures the Payflow Pro integration as long as the following PayFlowPro module is specified during application assembly. with the following contents: $class=atg. is a service that enables all Payflow Pro activities. The first. which involves downloading the product. setting several environment variables. you are not required to provide values for proxyAddress.com/. see the ATG Programming Guide.integrations. proxyPort.

your e-commerce site must: • • • Establish an appropriate business arrangement with CyberSource Inc.props file contains name=value pair information for communication with the CyberSource test payment server.com Installing the CyberSource Distribution The CyberSource ZIP file contains a set of test certificates and keys that can be used to test the system. settlement. Initializing the CyberSource Integration Before using CyberSource. For example: # file with the location of your cert required myCert=ICS2Test. For example. Download and uncompress the CyberSource ICS Java Client distribution file Refer to the documentation and information available in the CyberSource PDF file at http://www. myCert for CyberSource must be changed as follows: • • On Windows: myCert=<CyberSource Install Dir>\\keys\\ICS2Test.properties file in the following directory: 37 3 . Before using CyberSource.jar and copy it to the <ATG9dir>/Cybersource/lib directory. Rename the jar file to cdkjava_cybersource.ATG Commerce Programming Guide µ Integrating CyberSource with ATG Commerce CyberSource performs the following tasks: • • • Credit card authorization. The configuration ICSClient.crt On UNIX: myCert=<CyberSource Install Dir>/keys/ICS2Test.Integrating Third-Party Software With ATG Commerce . Create the CyberSourceConnection.props to change the relative path of the keys and certificates to absolute path to make sure they will be properly located and loaded by the integration. your machine will have the configuration file ICSClient. you must set up the CyberSource integration. and crediting Tax calculations Address verification This section describes the process of enabling the CyberSource integration with ATG Commerce.props in the properties folder of the CyberSource installation directory. After uncompressing the distribution file.crt Edit ICSClient.crt The test keys and certificates are installed in the keys directory.cybersource.

see the ATG Programming Guide. Designating Tax Status of Products CyberSource allows you to flag items with different product codes that indicate whether the product should be taxed. 2. you must specify the Cybersource module as well as either ATG Business Commerce or ATG Consumer Commerce modules during application assembly.props file not being found. ATG Commerce automatically configures the CyberSource integration. Moving the System to Production When your system is ready to go into production. For more information. If you receive errors about the ICSClient. then the ICS Java libraries JAR file was not properly named or was not placed in the right location. Add a taxStatus property to the SKU repository definition. refer to the CyberSource documentation.props file.props file: csConfigFile=<CyberSource Install Dir>\\properties\\ICSClient. Fix this problem by using the ATG Control Center to edit the /atg/commerce/payment/CyberSourceConnection component.µ • • On Windows: On UNIX: ATG Commerce Programming Guide <ATG9dir>/home/localconfig/atg/commerce/payment This file should contain one line that sets the csConfigFile property to the absolute path of the ICSClient.Integrating Third-Party Software With ATG Commerce . Edit ICSClient. In order to use CyberSource. Generate a new set of keys and certificates. 1.props Configuring ATG Commerce to Use CyberSource When you use ATG Commerce with CyberSource. Set the csConfigFile property to the correct path of the ICSClient. If you receive a ClassDefNotFound exception about any ICS classes not being found. perform the following steps: 1.props csConfigFile=<CyberSource Install Dir>/properties/ICSClient. the path in CyberSourceConnection.properties file is incorrect. You can configure ATG Commerce to use these tax codes at the SKU level and then you can configure the tax calculators to extract the tax codes from the SKU and place into the TaxableItem. For example: <property name="taxStatus" data-type="enumerated" default="default" column-name="tax_status" queryable="false"> 38 3 . running routines that set up CONFIGPATH and CLASSPATH and add libraries to the system’s path.props to replace the test data set with the live set. See the Installing the CyberSource Distribution section for more information. For information on ATG modules and application assembly. The ATG Commerce tax data structure allows this information to be propagated to the integration. Re-assemble your ATG application after fixing the problem.

Specifying Sales Origin and Shipment Location Information The CyberSourceTax component includes properties that represent information about the selling agency. Note: The tax_status column is already defined in the dcs_sku table. you need to configure ATG Commerce to calculate taxes individually. If it is not. shipFromCity: The city from which the product will be shipped. When you create a SKU. The properties are: • • • • • • • • originCity: The city from which the sale originated. See Designating Tax Status of Products. CyberSource will not calculate tax correctly. originState: The city from which the sale originated. shipFromCountry: The city from which the product will be shipped. Set the taxStatusProperty property on the /atg/commerce/pricing/calculators/TaxProcessorTaxCalculator service to taxStatus. See Calculating Taxes on the Item Level for more information. Calculating Taxes on the Item Level When taxes are determined for a shipping group as a whole. If some or all items should be taxed. 3. 39 3 . shipFromState: The state from which the product will be shipped. originZip: The zip code of the area from which the sale originated. ATG Commerce assumes that all item in the group are taxable. The CyberSourceTax component is located in the /atg/commerce/payment/ directory. 2. 4. Set CyberSource to calculate taxes on the item level. by following these instructions: • Specify which products are not to be taxed. This is the default behavior. originCountry: The country from which the sale originated.ATG Commerce Programming Guide µ <attribute name="useCodeForValue" value="false"/> <option value="default" code="0"/> <option value="beverages" code="1"/> <option value="clothing" code="2"/> <option value="electronic_software" code="3"/> <option value="groceries" code="4"/> <option value="physical_software" code="5"/> </property> Important: useCodeForValue must be set to false.Integrating Third-Party Software With ATG Commerce . shipFromZip: The zip code of the area from which the product will be shipped. flag it with the appropriate taxStatus flag.

Integrating TAXWARE with ATG Commerce TAXWARE’s SALES/USE.dll. Before You Begin Integrating with TAXWARE Before you begin integrating TAXWARE with ATG Commerce.dll) from the TAXWARE CD into the following directory: <ATG9dir>\Taxware\os_specific_files\i486-unknown-win32 • On UNIX: Copy the shared object files (libtaxcommon.class file into your <ATG9dir>/Taxware/lib directory.dll. and avpzip.so) from the TAXWARE CD. and ZIP code information.so.class file is in the TAXWARE installation directory. The . The CyberSourceTax component is located in the /atg/commerce/payment/ directory.NY. TAXWARE’s VERAZIP system provides a means of verifying city. noNexus=MA. and determining when additional information is needed to accurately assess taxes (such as county or city-limits information).useProductCode property to true.so. and libverazip.0-hp-hpux11.00 Solaris users: <ATG9dir>/Taxware/os_specific_files/sparc-sun-solaris2 TAXWARE Classes ATG Commerce’s TAXWARE SALES/USE and WORLDTAX integration consists of several classes: 40 3 . The taxcommon. libworldtax. libstep. STEP and WORLDTAX systems provide an accurate means of calculating applicable taxes.dll.NJ. • On Windows: Place the shared objects files (taxcommon. libsalesusetax. avptax.dll.µ • ATG Commerce Programming Guide Specify the item calculation mode by setting the /atg/commerce/payment/CyberSourceTax. copy the taxcommon. state. libtaxcommono. taxcommono.Integrating Third-Party Software With ATG Commerce . For example. avpstep.so files are in the TAXWARE installation directory: Copy the files into the appropriate directory: HP-UX users: <ATG9dir>/Taxware/os_specific_files/hppa1.so.so.so. Specifying States and Provinces without Tax Obligations The noNexus property in the CyberSourceTax component lists states and provinces that do not have tax obligations. This value is passed to the CyberSource tax system.

Integrating Third-Party Software With ATG Commerce . SalesTaxService The persistent service that TaxWareCalculateTax calls. ship-from. 41 3 . WorldTaxService This service represents one ship-from location. You can choose this execution by toggling the useVerazip property in TaxWareCalculateTax. This class calls to the TAXWARE VERAZIP system. and origin information. TaxRequest TaxResult Configuring ATG Commerce to Use TAXWARE When you use ATG Commerce with TAXWARE. and transaction information. running routines that setup CONFIGPATH and CLASSPATH and add libraries to the system’s path. ship-from. state. ATG Commerce automatically configures the TAXWARE integration.ATG Commerce Programming Guide µ Class TaxWareCalculateTax Description TaxWareCalculateTax is an order processing class that implements the TaxProcessor interface. One SalesTaxService object represents one origin and shipping-source location and is used by TaxWareCalculateTax to create a domestic TaxRequest that contains default company. TAXWARE may report errors concerning invalid ZIP code or state information. Represents the result of tax information. and ZIP code information before taxes are calculated. specify the following module as well as the ATG Business Commerce or ATG Consumer Commerce module during application assembly: Taxware For information on ATG modules and assembling applications. It is used by TaxWareCalculateTax to create an international TaxRequest that contains default company. Represents a request for tax information. The TaxWareCalculateTax calculates taxes and returns a TaxWareStatus object (implements TaxStatus interface) that contains the results of the calculation. TaxWareVerifyZipInfo TaxWareVerifyZipInfo is an order processing class called by TaxWareCalculateTax to verify the city. To use TAXWARE. see the ATG Programming Guide. This class calls the appropriate TaxService (domestic or international) to perform the tax calculation process. This class also has an option to call to the VERAZIP system to obtain means for an extensive address verification procedure. which your users may need to correct before proceeding.

See Customizing ATG Commerce’s TAXWARE Integration for more information. You will probably want to override the modifyRequest(). 3. Use the ATG Control Center to perform these steps. 2. the TaxWareCalculateTax component points to SalesTaxService. ATG Commerce Programming Guide Using the SALES/USE and WORLDTAX Integration Follow these steps to integrate SALES/USE and WORLDTAX with ATG Commerce if you want to customize the TAXWARE integration. follow the steps 2-4 above to set multiple WORLDTAX services. For more information on using the ATG Control Center. ShipFromCity. OriginCity. OriginCountry. OriginZip. The properties of the WorldTaxService should be set accordingly. ShipFromState. It is located in /atg/commerce/payment. Refer to your TAXWARE’s WORLDTAX manual for the information about these fields. set the $class property of TaxWareCalculateTax to your subclass.Integrating Third-Party Software With ATG Commerce . ShipFromCountry. See TAXWARE’s documentation of the TAXWARE taxcommon API for a description of these fields. named NYCTaxWareCalculateTax and DallasTaxWareCalculateTax) and point their salesTaxService properties to the corresponding SalesTaxServices. Customizing ATG Commerce’s TAXWARE Integration You may want to customize ATG Commerce’s TAXWARE classes if: • • • your products fall into special taxation categories you have multiple origin or ship-from locations you need to record or log additional tax information Most customizations can be completed by creating a subclass of the TaxWareCalculateTax class. If you have more than one international location. 42 3 . NYCSalesTaxService and DallasSalesTaxService). If so. If you want to perform a WORLDTAX calculation. Note: Refer to the WORLDTAX manual to install TAXWARE WORLDTAX System. ShipFromGeoCode. If you do this. Modify the following properties in SalesTaxService: companyId.. See the Customizing ATG Commerce’s TAXWARE Integration section for more information. Once you create a subclass. set the taxService property to /atg/commerce/payment/WorldTaxService. By default. you may want to create multiple /atg/commerce/payment/TaxWareCalculateTax components (for example.µ 1. OriginState. which is designated for United States or Canadian requests. Use the ATG Control Center to modify the SalesTaxService component. Check to see if any of your products fall into special taxation categories. 5. If you ship products from more than one location or origin. you may want to create multiple SalesTaxServices under separate names (for example. you will need to subclass the TaxWareCalculateTax class so that it sets taxes only when appropriate. see Customizing ATG Commerce’s TAXWARE Integration below. see the ATG Control Center online help. OriginGeoCode. and ShipFromZip. recordResult() and getAppropriateSalesTaxService() in methods. 4. If you created more than one SalesTaxService.

where TTTT is the type returned by that call. Examples of information you may want to add or modify include setting appropriate origin and ship-from information. see TaxRequestInfo class for more references.Integrating Third-Party Software With ATG Commerce .commerce.pricing.getCityTaxRate() actually just called returns the result of calling getDoubleFieldValue("TAXRATECITY"). you will also likely want to add additional SalesTaxService/WorldTaxService properties that getAppropriateSalesTaxService will choose between. Other fields can be accessed using the getTTTTFieldValue(). • If you have multiple items in the same order and these items fall under different tax categories. For example. TaxResult and TaxRequest Fields ATG Commerce includes convenience methods for accessing commonly used fields of TaxResult and TaxRequest. which is then passed to modifyRequest. it probably makes sense to override modifyRequest() instead.ATG Commerce Programming Guide µ Customizing TaxWareCalculateTax Methods The following TaxWareCalculateTax methods are called in the order listed. The SalesTaxService/ WorldTaxService returned by getAppropriateSalesTaxService() is used to create a request. getAppropriateSalesTaxService() returns the appropriate SalesTaxService/WorldTaxService based on the user and order. You may want your version of calculateTaxes() to make multiple calls to TaxWareCalculateTax’s version. You can set field values for fields without convenience methods by calling setFieldValue(). you may also want to override calculateTaxes() to make multiple item requests to TAXWARE based on their tax categories. and each order only involves one of those locations. If you have • multiple ship-from or origin locations.TaxProcessorTaxCalculator. getAppropriateSalesTaxService() takes a TaxRequestInfo object. 43 3 .getOrder() returns a NULL object. calculateTax and calculateTaxByShipping to check for • a null order. where CITY is the string argument passed to setShipFromCity. you may want to over-ride this method to return the appropriate SalesTaxService/WorldTaxService. TaxRequestInfo. See TAXWARE’s taxcommon API for possible field values. setShipFromCity() calls setFieldValue("SHIPFROMCITY". setting tax exemption information. If the order is NULL. the current TaxWareCalculateTax implementation creates a multiple record TAXWARE input request where each record designates a unique shipping destination group with all items in it. For example. CITY). If you have multiple shipfrom or origin locations and an order may involve more than a single location.priceTax() and override priceTax. you should override modifyRequest to set the tax category. To prevent this NULL return. the convenience method TaxResult. setting special taxcategory information. In this case. If so. Since TAXWARE supports multiple shipping destinations per order. subclass atg. assign it the order that is passed in and call the superclass. • modifyRequest() Make additional changes to the TaxRequest object before it is submitted to TAXWARE.

and US transaction price amounts are in dollars.µ ATG Commerce Programming Guide If you call setFieldValue() directly. you need a working copy of VERAZIP on the server machine. the value should be of the appropriate type for the field. If the address verification fails for a specific address. If necessary. Amount and rate values can be obtained either as doubles or as longs. without correction for place (so rate values are 100. The verifyZipInfo property of TaxWareCalculateTax should point to TaxWareVerifyZip component in /atg/commerce/payment/. set the $class variable of /atg/commerce/payment/TaxWareVerifyZip to your subclass. 44 3 . You will likely want to override the modifyRequest() method. ZipResult: Represents the result of ZIP code information. Customizing ATG Commerce’s VERAZIP Integration You may want to customize ATG Commerce’s TAXWARE VERAZIP classes if: • • • • you have additional location information you want to add to ZipRequest object you need to record or log addition ZIP code information you need to record or log additional tax information you need to specify additional fields in your TAXWARE request (if you are using WORLDTAX. VERAZIP Integration ATG Commerce’s VERAZIP integration consists of several classes: • TaxWareVerifyZipInfo is an Order Processing class that calls the VeraZipCaller class to perform the city. Since the VERAZIP Java interface calls into the TAXWARE VERAZIP libraries. The TaxWareVerifyZipInfo class adds ZIP amount information to the current order. Once you have created a subclass. VERAZIP must be installed and functioning on the server machine. You can examine the field definitions to determine which fields are available and what type they are. To install ATG Commerce’s TAXWARE VERAZIP integration.000 larger and US transaction price amounts are in cents when accessed as Integer). state.Integrating Third-Party Software With ATG Commerce . the sophisticated error message is returned in the TaxWareStatus object. use the Component Editor in the ATG Control Center to set the useVerazip property of TaxWareCalculateTax to false to prevent the TaxWareVerifyZip from executing. The long values represent the raw amount read for TAXWARE. The double values reflect the implicit decimal points (rates are a percentage). for example) Most customizations can be completed by creating a subclass of the TaxWareVerifyZipInfo class. it is set to false by default. • • ZipRequest: Represents a request for ZIP code information. and ZIP code verification. The fields for a TaxRequest are defined in the InputRecordDef class and the fields for TaxResult are defined in the OutputRecordDef class.

Integrating Third-Party Software With ATG Commerce . • modifyRequest() Make additional changes to the ZipRequest object before it is submitted to TAXWARE. 45 3 . • verifyZip() Accepts an object that implements the VeraZipable interface and uses that object to invoke the address verification routines.ATG Commerce Programming Guide µ Customizing TaxWareVerifyZipInfo Methods The following TaxWareVerifyZipInfo methods are called in the order listed.

µ ATG Commerce Programming Guide 46 3 .Integrating Third-Party Software With ATG Commerce .

you may want to extend or modify this catalog definition to include additional item types or properties. The standard catalog provides sufficient functionality for many sites. Categories and Products Categories and products are catalog items that organize your catalog into a hierarchy that provides a navigational framework for your commerce site. as described in the ATG Repository Guide. SKU Items and SKU Links SKU items represent the actual items that customers buy. Note: If you have ATG Business Commerce. as described in the ATG Commerce Catalog Administration chapter of the ATG Commerce Guide to Setting Up a Store. Catalog Repository ATG Commerce uses the ATG SQL Repository to define the product catalog. which are displayed in the customer’s Web browser when they visit your site. SKUs can be linked into static groups called bundles.Using and Extending the Standard Catalog . Folders organize media items. SKU links are a mechanism that enables you to create a single SKU from multiple items. Before reading this chapter. 47 4 .) This chapter includes the following sections: Catalog Repository The ATG Commerce product catalog is a ATG SQL Repository that enables your site to store objects in an SQL database and access those objects within Dynamo as Dynamic Beans. Categories can contain other categories as well as products. see also the Using Custom Catalogs chapter of this manual. However.ATG Commerce Programming Guide µ 4 Using and Extending the Standard Catalog This chapter describes the standard product catalog definition and explains how to extend it if necessary to address the requirements of your commerce site. (ATG Business Commerce sets up custom catalogs automatically. or if you have ATG Consumer Commerce and want to create custom catalogs. You create and modify catalog items through the ATG Control Center. you should be familiar with the ATG SQL Repository. Folders and Media Items Media items are files such as JSPs and GIF images. or into configurable associations. where different users see different versions of the catalog.

There are three main parts: The database schema on your SQL database server. you could have a category called Fruit. or both. The Citrus Fruit category could then include products called Lemons. change the standard repository definition file. 2. The repository component.gsa. If you use the standard product catalog without modification. To use an existing database schema. which is an XML file that defines the relationship between the SQL database and the Dynamo repository component. Oranges is an end-point. you must configure the SQL repository component appropriately. The easiest way to implement multiple catalogs is through the ATG Commerce custom catalogs feature.. sizes. The /atg/commerce/catalog/ProductCatalog repository component is configured to use this schema and repository definition. ATG Commerce comes with SQL scripts for creating the schema for the standard product catalog and the repository definition file that corresponds to this schema. Categories organize your catalog into a hierarchy that provides a navigational framework for your commerce site. and also contains another category. which is of class atg. and Oranges.xml file to specify where your new repository should appear in the ACC. you do not need to configure anything. A product can have several different SKUs associated with it.Using and Extending the Standard Catalog . write the repository definition file. Apples and Pears. Categories and Products Categories and products are the heart of the catalog structure. A product is a navigational end-point in the catalog. • • If you replace the standard repository definition file or extend it through XML file combination. If you have created additional repositories. A category can contain other categories. products do not represent the items that customers actually purchase. then use the startSQLRepository script to generate the database schema. then use the startSQLRepository script to generate the database schema. However. write a repository definition file that corresponds to that schema. 3. representing different varieties.GSARepository. edit the task property of the admins. For example: <task>CatalogManagement</task> indicates that your new repository will appear under the Catalog Management menu option. You can extend the standard catalog or create an entirely different catalog structure in several ways: • To modify the standard product catalog by adding or removing items or properties. For more information. The repository definition file. Limes. To design your catalog from scratch. In this example. if you 48 4 . For example. and colors. it cannot contain other categories or products. which contains two products. The purchased items are called stock keeping units (SKUs). products. see the ATG Repository Guide for more information. Citrus Fruit. see Using Custom Catalogs.adapter.µ 1. ATG Commerce Programming Guide A catalog repository is similar to any other SQL repository. For example. You can also achieve a similar result using additional SQL repositories instead.

and Blood Orange. List of the categories in the content group specified by the childCategoryGroup property. For more information about SKUs. List of all categories that are children of the category. a merge of fixedChildCategories and dynamicChildCategories. Additional media to be displayed with the category.Using and Extending the Standard Catalog .ATG Commerce Programming Guide µ have a product called Oranges. Name of the content group that contains the list of categories that dynamicChildCategories is set to. List of the categories in the content group specified by the relatedCategoryGroup property. The hierarchy defined by products and categories is not rigid. Category Properties The following table describes the category item properties in the standard product catalog:: Property ancestorCategories Description Generated Set of categories that are higher in the catalog hierarchy than the category. Static list of categories that are children of the category. List of all products that are children of the category. auxiliaryMedia childCategories childCategoryGroup childProductGroup childProducts creationDate description displayName dynamicChildCategories dynamicChildProducts dynamicRelatedCategorie s endDate fixedChildCategories fixedChildProducts 49 4 . List of the products in the content group specified by the childProductGroup property. a merge of fixedChildProducts and dynamicChildProducts. Name the ACC displays for the category. if a collection filter is implemented to use this property. Each category or product can be the child of one or more categories. some of the SKUs associated with it might be Valencia. Name of the content group that contains the list of products that dynamicChildProducts is set to. see SKU Items and SKU Links later in this chapter. Date the category was created. Short descriptive text for display with the category. Date the category will no longer be available. Static list of products that are children of the category. Navel.

Boolean property that indicates if the category is the start of a hierarchical structure. auxiliaryMedia brand childSKUs creationDate 50 4 . Date the category becomes available. if a collection filter is implemented to use this property. used to prevent version conflict. a merge of fixedRelatedCategories and dynamicRelatedCategories. Integer that is incremented automatically each time the category is updated. Detailed descriptive text for display with the category. Name of the content group that contains the list of categories that dynamicRelatedCategories is set to. JSP used to display the category. List of all categories that are children of the category. Date the product was created. Default parent category for the category. Large image associated with the category. Set of words that can be used in searching for the category. List of all SKUs that are children of the product. Small image associated with the category. Thumbnail image associated with the category.µ fixedRelatedCategories keywords largeImage longDescription parentCategory relatedCategories ATG Commerce Programming Guide Static list of categories related to the category. Additional media to be displayed with the product. String that provides the product brand. relatedCategoryGroup root smallImage startDate template thumbnailImage version Product Properties The following table describes the product item properties in the standard product catalog: Property ancestorCategories Description Generated Set of categories that are higher in the catalog hierarchy than the product.Using and Extending the Standard Catalog .

described below. If a startDate exists. if a collection filter is implemented to use this property. Name of the content group that contains the list of products that dynamicRelatedProducts uses. List of the products in the content group specified by the upsellProductGroup property. making it possible to calculate daysAvailable. unless disallowAsRecommendation is set to true. dateAvailable is set to that date. If not.Using and Extending the Standard Catalog . Set of words that can be used in searching for the product. List of the products in the content group specified by the relatedProductGroup property. Marks products as not recommendable by ATG Recommendations or similar recommendation services. Note: Using either the startDate or the creationDate ensures that a value exists for dateAvailable. Small image associated with the product. displayName dynamicRelatedProducts dynamicUpsellProducts endDate fixedRelatedProducts fixedUpsellProducts keywords largeImage longDescription nonreturnable parentCategory relatedProductGroup smallImage startDate 51 4 . Static list of upsell products. description disallowAsRecommendation displayableSkuAttributes List of properties of the product’s SKUs that can be displayed by the DisplaySkuProperties servlet bean. Large image associated with the product. Date the product will no longer be available. dateAvailable daysAvailable The number of days since the dateAvailable date has passed. Static list of products related to the product. Product name displayed by the ACC. Default parent category for the product. Detailed descriptive text for display with the product. Note: Products are implicitly recommendable. Date the product becomes available.ATG Commerce Programming Guide µ Property used to calculate the daysAvailable property. dateAvailable is set to the creationDate instead. if a collection filter is implemented to use this property. Marks products as not returnable. Short descriptive text for display with the product.

Defining Relationships between Categories and Products The SQL Repository allows you to define properties that return repository items.Using and Extending the Standard Catalog .NotEmptyChooserPropertyDescriptor class. Designate a category as a root category by setting the value of its root property to true. Deriving the childCategories and childProducts Properties The hierarchical relationships between categories and products are determined by their properties. Thumbnail image associated with the product. Most properties of the SQL Repository return values retrieved from the database.repository. In an ATG Commerce catalog. upsellProductGroup version Defining a Root Category With any group of categories. see the SQL Repository Item Properties chapter of the ATG Repository Guide. In the repository definition file. a starting point is called a root category. used to prevent version conflict. to allow for dynamic definition of item relationships. The childCategories property is a list of all categories that are children of the category. Integer that is incremented automatically each time the product is updated. the definition of the childCategories property looks like this: 52 4 . you need to know where to start when navigating. Properties computed dynamically are called user-defined properties. The SQL Repository also provides the ability to compute values of certain properties through Java code. which sets the value of the property by merging the lists of categories in the fixedChildCategories and dynamicChildCategories properties. The childCategories and childProducts properties of a category define the list of categories and products that are children of the category. You can use this targeter in a JSP as a way to start the navigation chain. ATG Commerce includes a targeter that finds all categories whose root property is true. but you can set it to true for categories you want to designate as the top level of the product catalog. This mechanism is used for the default definitions of several properties of the category and product items. For more information about user-defined properties. The value of this property is false by default.µ template thumbnailImage ATG Commerce Programming Guide JSP used to display the product. Name of the content group that contains the list of products that dynamicUpsellProducts uses. This mechanism enables you to define the relationship between categories and products in many ways. This is a userdefined property that is computed by the atg. See the Catalog Navigation and Searching chapter of the ATG Commerce Guide to Setting Up a Store for an example of using this targeter to find root categories. The SQL Repository can transform the ID into the repository item and return the actual object. The value of one of these items is the object ID.

Sets childProducts to the merge of the set of products in dynamicChildProducts and the set of products in fixedChildProducts. Deriving the relatedCategories and relatedProducts Properties In addition to the childCategories property. retrieves the list of categories in that content group. and set the value of childCategoryGroup to the name of this content group. you can use this relationship to display a link to the Vegetables category on the Fruit page. For example. When a user accesses a page that refers to childProducts. and sets dynamicChildProperties to that set of products. while others are seasonal. Dynamo computes the current value of childProducts as follows: 1. and some of the hats are available all year. This class looks at the childCategoryGroup property.Using and Extending the Standard Catalog .repository. which specifies the name of a content group. suppose your site has a category called Hats.repository. and childProductGroup properties. and set the childProductGroup property of the Hats category to the name of this content group. Related categories are useful for cross-selling. but which do not form a hierarchy with it. dynamicChildProducts. The dynamicChildCategories property is a user-defined property that is computed by the atg. 53 4 . if the Fruit category has Vegetables as a related category.GroupMembersPropertyDescriptor class.ATG Commerce Programming Guide µ <property name="childCategories" property-type="atg. 2. You could set the fixedChildProducts property of the Hats category to a list of the hats that are available all year. For more information about creating content groups. which contains a list of hats that changes from season to season. the category item has a property named relatedCategories. This mechanism enables you to use business rules to determine the list of child categories. and sets the value of dynamicChildCategories to that list. You could also create a content group called Seasonal Hats. using the fixedChildProducts. For example. childCategories) whose value is assembled from different sources. The fixedChildCategories property is an explicit list of categories you specify. see Part 3: Performing Business User Tasks of the ATG Commerce Guide to Setting Up a Store. The childProducts property of the category is computed in the same way. you can create a content group that consists of categories that share a particular attribute. Finds the current set of products in the content group specified in childProductGroup.NotEmptyChooserPropertyDescriptor" data-type="list" component-item-type="category" writable="false" queryable="false"> <attribute name="properties" value="fixedChildCategories. For example. This property defines a list of categories that are related to the category.dynamicChildCategories"/> <attribute name="merge" value="true"/> </property> This structure enables a page developer to refer to one named property (in this case.

you could have a single template page for displaying any product. using the fixedRelatedProducts. when the user selects a product. For example. you can remove the definitions of the childCategories.smallImage. The relatedCategories property is computed by the atg. which the atg. The product item has a relatedProducts property that is computed in the same way.NotEmptyChooserPropertyDescriptor class.µ ATG Commerce Programming Guide The relatedCategories property is a user-defined property that is derived in a similar way to the childCategories property. ATG Commerce enables you to create template pages that are filled in dynamically.lang. and childCategoryGroup properties. System performance improves when you simplify the data model to use only fixed relationships. dynamicRelatedProducts. you can remove these properties from the repository definition. along with an image and a description. which sets the value of the property by merging the lists of categories in the fixedRelatedCategories and dynamicRelatedCategories properties. which you can then rename as childCategories. Specifying Template Pages for Categories and Products Category and product items create a navigational framework for customers. For example. This enables you to display any item without knowing in advance what template the item uses. For example.repository. the page is filled in dynamically with information stored in the product’s properties. and relatedProductGroup properties. Rather than requiring you to create a separate JSP for each page on your commerce site. For example.Using and Extending the Standard Catalog .description"/> </dsp:oparam> </dsp:droplet> You specify the template to use as a property of the category or product. The dynamicRelatedCategories property is also a user-defined property. the following JSP segment uses the ProductLookup servlet bean to display the current product. You can display categories and products on your commerce site using JSPs.String"> <dsp:img src="<%=img13%>"/> </dsp:getvalueof> <dsp:valueof param="element. <dsp:droplet name="/atg/commerce/catalog/ProductLookup"> <dsp:param param="itemId" name="id"/> <dsp:oparam name="output"> <p><b><dsp:valueof param="element.repository. and just use the fixedChildCategories property. if all categories are explicitly related.displayName"/></b> <p><dsp:getvalueof id="img13" param="element. This page would have little or no static content.GroupMembersPropertyDescriptor class computes by retrieving the list of categories in the content group specified by the relatedCategoryGroup property. Removing the SQL Repository Definitions of User-Defined Properties If you do not plan to use dynamically related products or categories on your commerce site. dynamicChildCategories. the following portion of a JSP uses a CategoryLookup servlet bean to retrieve the current category.url" idtype="java. and a ForEach servlet bean to 54 4 .

and largeImage. <dsp:droplet name="/atg/commerce/catalog/CategoryLookup"> <dsp:param param="itemId" name="id"/> <dsp:oparam name="output"> <dsp:droplet name="/atg/dynamo/droplet/ForEach"> <dsp:param param="element. Associating Products with SKUs The childSKUs property of a product is a list of all the SKUs that are children of the product.ATG Commerce Programming Guide µ create links to all of the child products of the category. The product item also has a property named displayableSkuAttributes. media elements such as images and JSPs can be associated with a category or product through properties of the item. Delicious. which you can use to specify a list of the SKU properties that can be displayed using the DisplaySkuProperties servlet bean. 55 4 . such as McIntosh.childProducts" name="array"/> <dsp:oparam name="outputStart"> <p><b>Child Products:</b> </dsp:oparam> <dsp:oparam name="output"> <dsp:getvalueof id="a21" param="element. a Map property called auxiliaryMedia allows you to store any number of other media elements. You can also extend the category or product item to include additional properties. see the Displaying SKUs section of the Catalog Navigation and Searching chapter of the ATG Commerce Guide to Setting Up a Store. A product called Apples might have several different SKUs that represent different varieties of apples.repositoryId" name="itemId"/> </dsp:a></dsp:getvalueof> </dsp:oparam> </dsp:droplet> </dsp:oparam> </dsp:droplet> For more information about the CategoryLookup and ProductLookup servlet beans. as discussed in the Extending the Category and Product Item Types section.Using and Extending the Standard Catalog . For more information about this servlet bean. Media Properties As mentioned above.String"> <dsp:a href="<%=a21%>"> <dsp:valueof param="element. and Granny Smith.lang. Both item types have a template property. as well as three image properties: thumbnailImage. The URL for each link is found by looking at the template. In addition to the explicit properties that store media.template.url property of the product being linked to.displayName"/> <dsp:param param="element. see the Catalog Navigation and Searching chapter of the ATG Commerce Guide to Setting Up a Store.url" idtype="java. smallImage.

then specify alternatives to use in each catalog. In order for the XML combination to work. Now define the German version. It looks similar to the English version above (with a different “locale” attribute). one for the English display name (reusing the column above) and one for the German display name (this requires a new table). The derivation method uses this to determine the correct value. We start off with the name of the item descriptor containing the property: <item-descriptor name="sku"> Remove the old definition of displayName. As provided in ATG Commerce. do this inside the correct table tag: <table name="dcs_sku" type="primary" id-column="sku_id"> <property name="displayName" xml-combine="remove"/> To reuse the column name for the English display name (this way the English values do not need to be copied anywhere). displayName looks like this: <item-descriptor name="sku" <table name="dcs_sku" type="primary" id-column="sku_id"> <property name="displayName" column-name="display_name" data-type="string"/> </table> </item-descriptor> First. create two new properties. then close the table: <property name="displayName_en" column-name="dislpay_name" data-type="string"> <attribute name="locale" value="en"/> </property> </table> Notice there is an attribute called “locale” on this property.µ ATG Commerce Programming Guide Extending the Repository for Internationalization To aid in internationalization. You can add a derivation property to any property in the catalog. Define a new table for this: <table name="dcs_sku_de" type="auxiliary" id-column="sku_id"> <property name="displayName_de" column-name="display_name" data-type="string"> 56 4 . For example. define the English display name in the same table tag.Using and Extending the Standard Catalog . ATG Commerce includes a feature that allows you to specify alternate text for some catalog items using derived properties. you could specify different display text to appear in different languages for the same catalog item. The following example shows how to expand the displayName property to include English and German versions.

it is not used.Using and Extending the Standard Catalog . It performs the following actions: 1. If no default key is defined. if locale=fr_FR_EURO. 3. there is an extra clause on all search terms. which returns the user’s current locale as the key.ATG Commerce Programming Guide µ <attribute name="locale" value="de"/> </property> </table> Next. For example. there are no performance implications.” There is also a defaultKey. In all other cases. it first looks for a property where the locale attribute is fr_FR_EURO. 2. a subclass of FirstWithAttribute. but displayName_de is null. define the derived property.commerce. Compares this key to each expression’s <locale> value. The locale is searched in a locale-specific way. then look for “fr_FR”. If the default key is the same as the current key. The complete XML looks like this: <item-descriptor name="sku"> <table name="dcs_sku" type="primary" id-column="sku_id"> <property name="displayName" xml-combine="remove"/> <property name="displayName_en" column-name="dislpay_name" data-type="string"> <attribute name="locale" value="en"/> 57 4 . In other words. Giving it the same name as the previously English property (“displayName”) means that JSP code that references this does not have to be rewritten: <property name="displayName data-type="string"> <derivation user-method="atg. 4. then return displayName_en instead (assuming its locale is “en” and the defaultKey is “en” or “en_US”). if the real key is “de_DE” and we are looking for displayName.util.FirstWithLocale"> <expression>displayName_en</expression> <expression>displayName_de</expression> </derivation> <attribute name="derivationAttribute" value="locale"/> <attribute name="keyService" value="/atg/userprofiling/LocaleService"/> <attribute name="keySubProperty" value="locale"/> <attribute name="defaultKey" value="en"/> </property> The <derivation> tag uses a custom derivation method called FirstWithLocale. Gets the repository key service Calls RepositoryKeyService.getRepositoryKey. and finally look for “fr. which keyService uses if the if the value with the real key is null. Returns the first property whose attribute matches. Using a defaultKey may slow performance.

modify the database schema to add columns to the database tables for that item type.Using and Extending the Standard Catalog . add an option value to the product type enumeration: <property name="type" data-type="enumerated" columnname="product_type" writable="false" hidden="true"> <option value="option1"/> 58 4 .FirstWithLocale"> <expression>displayName_en</expression> <expression>displayName_de</expression> </derivation> <attribute name="keyService" value="/atg/userprofiling/LocaleService"/> <attribute name="defaultKey" value="en_US"/> </property> </item-descriptor> Extending the Category and Product Item Types By default. you may find you need to extend the catalog by creating additional properties for these item types. there is only one type of category and one type of product in the catalog. which you can use to create item sub-types: <property name="type" data-type="enumerated" column-name="product_type" writable="false" hidden="true"> </property> To create a product sub-type. or by creating additional item types.µ </property> </table> ATG Commerce Programming Guide <table name="dcs_sku_de" type="auxiliary" id-column="sku_id"> <property name="displayName_de" column-name="display_name" data-type="string"> <attribute name="locale" value="de"/> </property> </table> <property name="displayName data-type="string"> <derivation user-method="atg. and can include additional properties that are unique to the sub-type. whose definition is independent of existing types. To create additional properties for an item type. The default category and product item definitions include an enumerated property named type. These item types are sufficient for many commerce sites.util. However.commerce. you can create new item types. For greater flexibility. There are two ways to create a new item type: • • Create an entirely new type. and make the corresponding additions to the repository definition file. A sub-type inherits the properties from its parent item type. Create an item type that is a sub-type of an existing type.

and can add properties not defined for the parent item type. A product can have several different SKUs associated with it. which could include different memory or hard drives. the catalog replicates the properties in each item definition. and set its super-type attribute to the name of the parent item type: <item-descriptor name="item-name" super-type="type" sub-typevalue="option1"> <!-. and SKU item types would inherit all of their common properties (such as description and displayName). The properties of a SKU are used for display purposes. The properties are also used to integrate with other ATG Commerce systems. similar to products and category properties. SKU Items and SKU Links A product is a navigational end-point in the catalog. they purchase a SKU (stock keeping unit). In a purely object-oriented design. Instead. and colors.properties --> </item-descriptor> The new item type inherits all of the defined properties of the parent item type. See the Configurable SKUs section of this chapter. sizes.ATG Commerce Programming Guide µ <option value="option2"/> </property> Then add a new item-descriptor to the repository definition file. A SKU usually represents an indivisible unit that can be purchased. Bundles allow the product catalog to offer a SKU that can be purchased as a single item. although it is treated as multiple items in fulfillment. there would be a generic catalog item type from which the category. the standard catalog includes a SKU link item type that you can use to create SKU bundles. If you use these kinds of queries. or a car with optional features. Queries against items whose properties span multiple sub-types may require joins of all of the tables in the hierarchy. see the Item Descriptor Inheritance section of the SQL Repository Data Models chapter of the ATG Repository Guide.Using and Extending the Standard Catalog . customers do not actually purchase the product. keep in mind that performance decreases as the number of tables joined increases. such as with computers. sub-types are defined for the media item type only. You can also create SKUs as configurable if they have components that might vary depending on customer preferences. product. to avoid the performance and complexity issues associated with sub-types. Inheritance is a very convenient mechanism for creating new item types. such as pricing and fulfillment. For more information. 59 4 . representing varieties. However. you should avoid using too many levels of inheritance. However. which are virtual SKUs that are composed of several other SKUs. However. In the standard catalog. especially for creating types that are closely related to each other.

creationDate description displayName dynamicAttributes endDate fulfiller largeImage listPrice onSale replacementProducts salePrice smallImage startDate template thumbnailImage version wholesalePrice SKU Link Properties The following table describes the SKU link properties in the standard product catalog: 60 4 . Integer that is incremented automatically each time the SKU is updated. Wholesale price of the SKU. if a collection filter is implemented to use this property. List of SKU links that make up this SKU bundle. used to prevent version conflict. Date this SKU will no longer be available. Short descriptive text for display with this SKU.µ SKU Properties Property auxiliaryMedia bundleLinks ATG Commerce Programming Guide The following table describes the SKU item properties in the standard product catalog: Description Additional media to be displayed with this SKU. Thumbnail image associated with this SKU. Additional attributes of the SKU. Name used for the SKU the site. Products to suggest as replacements if this item is out of stock. if a collection filter is implemented to use this property. Fulfiller who will ship the item. if null. JSP template used to display this SKU. Price of the SKU if onSale property is true. Date on which this SKU becomes available. Default price of the SKU before any discounts or promotions. Boolean property that indicates if the item is on sale. Date this SKU was created.Using and Extending the Standard Catalog . Small image associated with the SKU. SKU is not a bundle. Large image associated with the SKU.

used to prevent version conflict. Short descriptive text for display with this SKU link. When the sale price is defined and onSale is set to true. if a collection filter is implemented to use this property. a product’s template page displays all of the child SKUs of the product. For more information. products. thumbnailImage. Date this SKU link will no longer be available. largeImage. onSale. rather than having a single set of images associated with the parent product. If your product catalog does not need to price each SKU separately. ListPrice is required. the list and sale price calculators will require a small change in configuration. 61 4 . and auxiliaryMedia. Placing the prices at the SKU level allows each individual SKU to have its own price. each SKU would not be displayed in its own template page. Categories. if a collection filter is implemented to use this property. then the listPrice. Date on which this SKU link becomes available. at most commerce sites. listPrice. see the Using and Extending Pricing Services chapter of this manual. Integer that is incremented automatically each time the SKU link is updated. if SKUs are differentiated by a visible characteristic such as color. the pricing calculators assume the SKU is on sale and adjust the price. smallImage. If each product has only one SKU. you might want to have different images for each SKU. These list and sale price calculators use these properties in the Pricing Engine. Your site may not need all of these properties.. but adds complexity to pricing administration. Name used for the SKU link on the site. and onSale properties can be moved to the product item type to simplify maintenance. Quantity of the SKU specified by the item property. item quantity startDate version Using SKU Media Properties The SKU item has the same set of media properties that categories and products have: template. WholesalePrice is not used by the pricing calculators at this time. For example. If the price properties are moved. you might want to associate certain media items with products rather than SKUs.ATG Commerce Programming Guide µ Property creationDate description displayName endDate Description Date this SKU link was created. For example. but the wholesalePrice and salePrice can be undefined. Using SKU Price Properties The SKU item has four price properties: wholesalePrice. and SKUs all have the same set of media properties in order to give you as much flexibility as possible. you could even change the repository definition to remove the product item type entirely. or vice versa. salePrice.Using and Extending the Standard Catalog . SKU that is being bundled. Depending on how your site is organized. and salePrice. More commonly.

Extending the SKU Item Type The base SKU definition does not include any configuration properties such as size. color. and length). However. For example. see the Configuring the Order Fulfillment Framework chapter. or create sub-types of the SKU item type that include additional properties.µ Using the SKU Fulfiller Property Creating SKU Bundles ATG Commerce Programming Guide The fulfillment engine uses the fulfiller property to determine how to manage the fulfillment of the purchase. When the fulfillment system recognizes that a SKU is a bundle.g. Depending on the requirements of your site. one that represents three red shirts and another that represents one black hat. it fulfills the purchase by performing the fulfillment of each quantity of items defined in the SKU link. An alternate approach. By default. you could specify the dynamicAttributes property of a SKU as {color=red. So if dynamicAttributes specifies three attributes (e. each SKU is represented by one row per attribute. If you use dynamicAttributes. Each SKU link includes a SKU and a quantity. and include that SKU link in the bundleLinks list. you must add it to the SKUItemTypes property of the /atg/commerce/catalog/CatalogTools component in order for it to be available to the PMDL rules used in promotions. this approach can become awkward if there are several different configuration variables. The property is a Map that stores a key/value pair for each attribute you define. the description of each SKU could mention the color. One disadvantage of this approach is that data is stored less efficiently than if you explicitly add configuration properties to the definition of the SKU item. The bundleLinks property designates a SKU as a bundle. The bundleLinks property is a list whose elements are of another item type called a SKU link. explicitly adding properties to the SKU item definition is a better approach. rather than an individual item. See Extending the Category and Product Item Types for information about extending catalog item types. This property is an enumerated value. if you need to define a large number of attributes. If you create a sub-type. For example.size=small}. each property corresponds to a column in a table. A SKU bundle can include any number of SKU links. because it allows each SKU to have its own set of configuration attributes. etc. For more information. If the SKU is not a bundle. you can create a SKU link whose quantity is 1. Note that the bundleLinks property of the SKU item holds only SKU links. 62 4 . This mechanism is very flexible. if the SKUs are differentiated only by color.. then bundleLinks is null.. If you add properties. the SKU will be represented by three rows in a table. so each SKU can be represented by a single row in the table. Therefore. For example. For more information. you may be able to differentiate the SKUs for a product through the description properties of the SKUs. not SKU items.Using and Extending the Standard Catalog . is to store configuration information in the dynamicAttributes property. see the Configuring the Order Fulfillment Framework chapter. color. The additional rows can have a negative effect on performance. size. which does not require modifying the SKU item definition. However. You may want to add properties to the SKU item type. For example. a SKU bundle might consist of two SKU links. it defines a HardgoodFulfiller. a SKU link might represent three red shirts.

and description. A category of subSKUs. The item type is marked as abstract by tagging it as expert in the repository definition file. a SQL Repository can be configured as a content repository. As part of this abstract definition. 63 4 . configurableProperty configurationOption foreignCatalog Folders and Media Items As described in the SQL Content Repositories chapter of the ATG Repository Guide.Using and Extending the Standard Catalog . Both the folder and media items define several administrative properties: version. The media item includes a property named type that is used to specify the media sub-type of the item. hard drive types. The media item is similar to an abstract Java object.ATG Commerce Programming Guide µ Configurable SKUs A configurable SKU holds other SKUs. etc. such as a computer. startDate. You can use folders to organize media elements. customers can order them with varying amounts of memory. Configurable items consist of a “base SKU” and a number of optional subSKUs for the user to choose among. endDate. An external system with which ATG Commerce communicates. media-internal-binary: This item type can be used to store binary objects (such as images) in the catalog database. such as a particular model of hard drive. These properties are intended to be overridden in the sub-types. The content can be either be either a binary file or a text file. These properties are used as an aid to catalog administrators. not in the commerce site itself. creationDate. The standard product catalog defines folder and media item types that correspond to these two parts of the repository. video cards. in a different way than linked SKUs do. The configurableProperty holds the list of configurationOptions. two properties are defined: data and url. The SKU representing the actual product option. An example of a configurable item is a computer. A content repository is composed of folder and content repository items. The standard catalog includes three sub-types: • • media-external: This item type references a piece of content that is stored outside the database. such as Memory or Modems. it cannot be instantiated itself. not intended for display on the site. The following repository items are used when working with configurable SKUs: Item configurableSku Description Base SKU for the product. to which other products can be added as options. Folders are used only in the administrator user interface.

this folder is a root folder. File name of the folder. File name for this media item. Complete pathname of the folder. Integer that is incremented automatically each time the folder is updated. For information about uploading media elements to your product catalog. Folder Properties The following table describes the folder item properties in the standard product catalog: Property creationDate description endDate Description Date this folder was created. if null. used to prevent version conflict name parentFolder path startDate version Media Item Properties The following table describes the media item properties in the standard product catalog: Property url data mimeType Description Relative URL that can be used in a JSP to access the media item. Short descriptive text for display with this folder. Date this folder will no longer be available. Complete path for this media item. Defines whether a media item is binary or text. name path parentFolder 64 4 .Using and Extending the Standard Catalog . if a collection filter is implemented to use this property. A user-defined property that returns the content type value by examining the url property.µ • ATG Commerce Programming Guide media-internal-text: This item type can be used to store text files (such as JSPs) in the catalog database. Folder that contains this folder. if a collection filter is implemented to use this property. Date this folder becomes available. see ATG Commerce Catalog Administration of the ATG Commerce Guide to Setting Up a Store. Folder that contains this media item.

which references the file.repository.File object. see the Content Distribution chapter of the ATG Programming Guide. This section offers some suggestions for designing Dynamo repositories. As part of defining a ContentRepositoryItem. The url property of the media-internal item types is a user-defined property computed by the atg. which determines the value from the name property. Using Media-Internal Properties The media-internal sub-types differ only in the way the data property is defined.distributor. Designing a Multi-Locale Product Catalog Designing a multi-locale Web site is a large undertaking. and database tables to meet the needs of a multi-locale site. product catalogs. The media-internal item types define their own length and lastModified properties. Short descriptive text for display with this media item. This section discusses the following topics: • Designing the Catalog Repository 65 4 .io. If the url property is a relative URL. It also discusses which locales you should choose for your Dynamo server and database in order to make both compatible with the encodings of the content you wish to display on your site. the item definition must supply a length and a last modified value.Using and Extending the Standard Catalog . these values are automatically extracted from the File object returned from data. if a collection filter is implemented to use this property. In a media-external item. The mimeType property is a user-defined property that is computed by the MimeTyperPropertyDescriptor class. For more information about configuring content distributors. When a customer accesses a mediainternal-binary or media-internal-text item. the data property is a user-defined property computed by the atg.DistributorPropertyDescriptor class. then data is a java. Date this media item will no longer be available. if a collection filter is implemented to use this property.ATG Commerce Programming Guide µ startDate Date this media item becomes available. endDate description Using Media-External Properties In the media-external item type. The data property is either binary (for media-internal-binary items) or text (for media-internal-text items).FilePropertyDescriptor class. the /atg/commerce/catalog/ContentDistributorPool service extracts the content from the database and generates a URL to make the item accessible to a web browser.

site visitors from Japan may not be interested in the same style of jeans as site visitors from the US. Cons: You must maintain multiple copies of each item in the repository. which is an XML file that defines the relationship between the SQL database and the Dynamo repository component.adapter. Pros: Separate targeting rules let you target different pieces of content to different locales. For example. since each item is duplicated in each locale-specific repository. If you have a single repository. you can separate your database tables so that the locale-specific properties of each product are stored in multi-valued tables that hold many different language versions of the same information. Also. This method requires you to develop logic that uses the RequestLocale’s localeString property to get the property values corresponding to the proper locale. • One Repository Configure a single repository for all languages and include a language attribute in each repository item.gsa. The option you choose dictates how you must set up your database tables. This section discusses the pros and cons of single and multiple repository configurations. you should also have database tables that contain different product information for each locale. because you can have a catalog administrator for each language who has access only to the appropriate repository. In addition. When you are designing your catalog repository. A catalog repository is similar to other SQL repositories. You can create a separate repository for each language or with a single repository for all languages. which is of class atg. This requires separate targeting rules for each locale.Using and Extending the Standard Catalog . administration of multiple repositories is easier than a single repository. consider the following pros and cons of each design: • Multiple Repositories Create a separate content repository for each language. The repository component. in which each rule references the appropriate language repository. you can set up your catalog repository in one of two ways. 2. 66 4 . The database schema on your SQL database server. Pros: You can maintain only one copy of each repository item.µ • • Setting Up Multiple Product Catalogs Setting Up a Single Product Catalog ATG Commerce Programming Guide Designing the Catalog Repository If you are designing a multi-locale site with catalog repository content. The repository definition file. storing separate values for each locale-sensitive takes up a lot of space in the database. These items draw their locale-specific attributes from a multi-valued table in the database.GSARepository. There are three main parts: 1. If you have a repository for each locale. This is the simpler of the two methods. 3.

which only requires one byte per character. For example. For example. All three tables contain matching data. For more information. you could rename the file frenchProductCatalog. the Pioneer Cycling demo uses three components. 2. For example.xml file and modify it as necessary for the other locales your site is supporting.xml. despite the fact that all three tables have the same schema. Copy the productCatalog. This slows Dynamo operation. Note that multi-byte languages require multi-byte character columns to hold the translated Strings.xml.xml. 6. ProductCatalog. Pioneer Cycling uses equivalent tables for it’s French and Japanese SKUs named dfr_sku and djp_sku respectively. You cannot separate products that are Japanesespecific. and a file productCatalog. you can use ASCII and UNICODE where appropriate. For example. See Populating the International Catalogs with Product Data for more information. 3. Create database tables that map to the catalog repository as described in the productCatalog. Create a separate Control Center component for each product catalog. FrenchProductCatalog. the only difference is that the dfr_sku and djp_sku tables contain translated descriptions and prices that are specific to the French and Japanese locales. Populate the database tables with translated or otherwise locale-modified content. see the Catalog Repository section of this chapter. Setting Up Multiple Product Catalogs If you set up a separate product catalog for each language on the site. do the following: 1. and JapaneseProductCatalog. Create appropriately named database tables for each locale. You have to store most languages other than English in UNICODE format. but using multi-value tables does increase the load on the database. For example. 5. the Pioneer Cycling site has a separate XML file for each of the three languages the site supports: frenchProductCatalog. which takes up 2 bytes per character. each product catalog is defined by an XML file. Create a catalog repository XML file that defines the product catalog. but if you have a single repository you must store all data in UNICODE. you must to create database tables that mirror the English product tables. If you are using separate repositories. Make sure that the definitionFiles property of each component points to the appropriate repository definition file. for example.ATG Commerce Programming Guide µ Cons: This configuration is more difficult to administer because data for every language is in one repository.xml file. 4. The first table is not reused. The reduced performance may be imperceptible. the Pioneer Cycling application adds the letters of the locale to the name of each table. To configure Dynamo to use multiple product catalogs. Dynamo’s primary English SKU table is named dcs_sku. the FrenchProductCatalog component’s 67 4 . For example. instead of ASCII.xml that represents the standard English product catalog. There are more database joins in a single repository because of the large number of multi-value tables. You should rename this file so it is unique and recognizable for a certain locale. japaneseProductCatalog. If you decide to set up multiple product catalogs. This takes up more space in the database.Using and Extending the Standard Catalog .

Set the useDefaultRepository property to true if you want Dynamo to search the default repository when an item is not found in an alternate repository. one for each language your site supports. For example.xml. 8. a given item isn’t difficult to find. Because an item has the same ID in all catalogs. For more information on how multiple product catalogs are set up in the Pioneer Cycling demo. you can specify that the key fr_FR attached to a JSP should pull content from the French Product Catalog. JSPs can include hard-coded repository IDs because ATG Commerce uses the locale of a user’s browser to determine the appropriate language catalog’s items to display. Populating the International Catalogs with Product Data When you want your site to have several duplicate catalogs. which makes it easier to maintain consistency and quality across catalogs. Configure the alternateCatalogs property of the /atg/commerce/catalog/CatalogTools component. Configure the useDefaultRepository and repository properties of the Nucleus component. Set the repository property to point to the default repository component. To populate a second language catalog. 3. then translate property values into the appropriate catalog. You can use the CatalogTools component to set up a relationship between multilanguage repositories and their matching product catalogs. Before you replicate your catalog data. If a JSP can’t display an item from the requested language catalog. you create the first language catalog. even if the user’s request locale is not the same as the standard product catalog. the CatalogTools component reverts to the standard product catalog. You won’t need to replace the ID in copied catalog with an invented ID that’s unique and consistent with others. translate property values into the appropriate language. it is important to decide whether an item in multiple catalogs should use the same ID in each. 5. The alternateCatalogs property of the CatalogTools component specifies a mapping between repository keys and alternative repositories. ATG Commerce Programming Guide definitionFiles property should point to the file at /atg/commerce/catalog/frenchProductCatalog. in the ACC. having the same ID for a given item across catalogs may provide the following advantages: 1. you copy the original in bulk. see Adding Support for Multiple Locales in the Displaying and Accessing the Product Catalog chapter of the ATG Consumer Commerce Reference Application Guide. Create catalog items manually in the ACC.µ 7. you can display items in a default language catalog. 2.Using and Extending the Standard Catalog . 4. Promotions can apply to products from all catalogs. then create the second language catalog in one of the following ways: • • Copy the original catalog in bulk. 68 4 . Depending on how your site is configured. then. If you don’t provide this mapping.

For example. you must modify your database tables.shortDescription needs to have a map that looks like this: Key en_US Value This is a very protective and fashionable helmet.en_US"/> where the product parameter contains the product repository item that is take from the single repository of all the language catalogs. This section describes one way.ATG Commerce Programming Guide µ If the listed advantages are actually disadvantages for your site. description. The item product. because. there are many different ways to do this. which is to make every locale-sensitive property of every item in the catalog a multi-valued property that has key/value pairs for each locale. instead of accessing a product from a JSP where the product parameter contains the product repository item from the locale-specific catalog repository: <dsp:valueof param="product. For example. if each item in the catalog has a property shortDescription of type String. For example. your JSPs include hard-coded repository IDs that must access items in a specific catalog. the current dcs_product table looks like this: Table Name: dcs_product product_id VARCHAR(40) (primary key) version NOT NULL NULL INTEGER 69 4 . (translated into Japanese)) fr_FR jp_JP Displaying data for this item in a JSP requires one extra step: adding logic that evaluates the user’s locale to display the correct value from the property’s map.shortDescription.shortDescription"/> you now access items <dsp:valueof param="product. long_description) and place them in multi-value tables. for example.Using and Extending the Standard Catalog . To set up a single product catalog repository. One solution is to remove all the locale-specific properties (such as display_name. Again. Ceci est un très protectif et chic helmet. Setting Up a Single Product Catalog There are several ways to set up a single product catalog that contains content for multiple locales. this description String needs to be translated into a different language for each locale your site serves. assign each item a unique ID.

Using and Extending the Standard Catalog .µ creation_date start_date end_date display_name description long_description parent_cat_id product_type ATG Commerce Programming Guide TIMESTAMP TIMESTAMP TIMESTAMP VARCHAR(254) VARCHAR(254) LONG VARCHAR VARCHAR(40) INTEGER NULL NULL NULL NULL NULL NULL NULL NULL Here’s an example of how you could separate the properties in the dcs_product table into four separate multi-value tables to hold locale sensitive content for many different locales: Table #1: dcs_product product_id VARCHAR(40) (primary key) version creation_date start_date end_date parent_cat_id product_type NOT NULL NULL NULL NULL NULL NULL NULL INTEGER TIMESTAMP TIMESTAMP TIMESTAMP TIMESTAMP VARCHAR(40) Table #2: dcs_product_display_name product_id VARCHAR(40) NOT NULL REFERENCES dcs_product(product_id) (primary key) locale VARCHAR(42) NOT NULL (primary key) display_name VARCHAR(254) NULL Table #3: dcs_product_description 70 4 .

atg.0.0" encoding="ISO-8859-1" ?> <!DOCTYPE gsa-template PUBLIC "-//Art Technology Group.com/dtds/gsa/gsa_1. Inc.Using and Extending the Standard Catalog .//DTD General SQL Adapter//EN" "http://www.dtd"> <gsa-template> <item-descriptor name="product" display-name-resource="itemDescriptorProduct"> <table name="dcs_product" type="primary" id-column-name="product_id"> <property category-resource="categoryInfo" name="version" data-type="int" column-name="version"/> <property category-resource="categoryInfo" name="creationDate" datatype="timestamp" column-name="creation_date"></property> <property category-resource="categoryBasics" name="startDate" datatype="timestamp" column-name="start_date" display-nameresource="startDate" required="false"> </property> <property category-resource="categoryBasics" name="endDate" datatype="timestamp" column-name="end_date" display-name-resource="endDate" required="false"> </property> <property category-resource="categoryCategorizationAndRelatedProducts" name="parentCategory" item-type="category" column-name="parent_cat_id" 71 4 .ATG Commerce Programming Guide µ NOT NULL REFERENCES dcs_product(product_id) product_id VARCHAR(40) (primary key) locale VARCHAR(42) NOT NULL (primary key) description VARCHAR(254) NULL Table #4: dcs_product_long_description product_id VARCHAR(40) NOT NULL REFERENCES dcs_product(product_id) (primary key) locale VARCHAR(42) NOT NULL (primary key) long_description LONG VARCHAR NULL You’ll also have to modify your productCatalog.xml file that maps this schema: <?xml version="1. Here’s an example of a very simple productCatalog.xml file to refer to these new tables.

Using and Extending the Standard Catalog .µ ATG Commerce Programming Guide display-name-resource="parentCategory" required="false"> </property> <property name="type" data-type="enumerated" column-name="product_type"/> </property> </table> <table name="dcs_product_display_name" type="multi" id-column-name="product_id"> multi-column-name="locale"> <property category-resource="categoryBasics" name="displayName" data-type="map" component-data-type="string" column-name="display_name" required="true" display-name-resource="name"> </property> </table> <table name="dcs_product_description" type="multi" id-column-name="product_id"> multi-column-name="locale" <property category-resource="categoryPresentation" name="description" data-type="map" component-data-type="string" column-name="description" required="false" display-name-resource="description"> </property> </table> <table name="dcs_product_long_description" type="multi" id-column-name="product_id"> <property category-resource="categoryPresentation" name="longDescription" data-type="map" component-data-type="big string" column-name="long_description" required="false" display-name-resource="longDescription"> </property> </table> </item-descriptor> </gsa-template> 72 4 .

The mode that you run in determines how the values custom catalog-related properties are obtained. the product catalog repository is somewhat different. and these properties are derived on-the-fly. or different products altogether. production mode or development mode. • development mode: Uses derived properties so that you can preview a product catalog on a web site while you’re making changes without having to run the batch service (CatalogMaintenanceService). or have ATG Consumer Commerce and want to use the custom catalogs feature. This chapter consists of supplementary information that applies only to custom catalogs. see the Catalog Navigation and Searching chapter of the ATG Commerce Guide to Setting Up a Store to catalog navigation instructions.Using Custom Catalogs . If you have ATG Business Commerce installed. Development mode makes the updates incrementally so you can preview your changes throughout the development process. and navigation and searching involve components that are different from those used in standard catalogs. You should also refer to the Using and Extending the Standard Catalog chapter for instructions on setting up a catalog. Development mode is more resource intensive than production mode because these properties have to be computed at the time they are referenced. Also. you can run ATG Commerce in two separate modes. Development mode overrides the definitions of certain properties in the catalog repository that are normally computed by the batch service.ATG Commerce Programming Guide µ 5 Using Custom Catalogs Custom Catalogs allow you to set up your product catalog so different customers see different information about the products they view. 73 5 . Using ATG Commerce with Custom Catalogs Converting from Standard to Custom Catalogs The Custom Catalog Repository Custom Catalog Navigation Custom Catalog Searching Assigning a Custom Catalog to a User Using ATG Commerce with Custom Catalogs When using custom catalogs. rather than being pre-computed by the batch service.

For more information on assembling an ATG Commerce application with custom catalog in production mode. which already has the value stored there. The following steps describe how to perform this conversion. When you switch to running production mode the computedCatalogs value is used. it references computedCatalogs. When running in production mode. it references derivedCatalogs.sql. When the batch service runs. This script is located in the <ATG9dir>/DCS/CustomCatalogs/sql/db_components/<db-vendor> directory. Converting from Standard to Custom Catalogs To use custom catalogs. Keep in mind that before you set up your custom catalogs for the first time. catalogs property refers to derivedCatalogs.µ • ATG Commerce Programming Guide production mode: Uses computed properties. it stores the value in computedCatalogs. Step 1: Add New Database Tables Custom catalogs require some new database tables. so the value stored in computedCatalogs is not used. For more information on assembling an ATG Commerce application with custom catalog in development mode. When you run the batch service. There are two “helper” properties that go with the catalogs property: computedCatalogs and derivedCatalogs. there is a catalogs property for products. which holds a list of all valid catalogs in which you can view that product. you must convert your existing standard product catalog to the custom catalog configuration.Using Custom Catalogs . so performance is upgraded over development mode because time is no longer spent deriving the property values. you should run the Catalog Maintenance Service as described in Using the Catalog Maintenance System. These tables are defined in custom_catalog_ddl. it stores the value into the computedCatalogs property. see the ATG Programming Guide. If you are running in development mode and you access the catalogs property. Running this script adds the following tables to your database: • • dcs_catalog dcs_root_cats 74 5 . For example. which derives the value at the time of the request. Using in Production Mode The production mode is the most efficient mode to run in when you won’t need to preview changes to the custom catalog. see the ATG Programming Guide. regardless of what mode you are in. Using Development Mode The development mode allows you to preview the custom catalogs as you edit them. This mode uses the properties precomputed by the batch service. In the development mode.

Using Custom Catalogs . 1.CustomCatalogMigration 75 5 . Specify the following module during application assembly: DCS.ATG Commerce Programming Guide µ • • • • • • • • • • • • • • • • • • • • • • • • • • • • dcs_root_subcats dcs_sub_catalogs dcs_category_info dcs_product_info dcs_sku_info dcs_cat_subcats dcs_cat_subroots dcs_cat_catinfo dcs_catinfo_anc dcs_prd_prdinfo dcs_prdinfo_rdprd dcs_prdinfo_anc dcs_sku_skuinfo dcs_skuinfo_rplc dcs_gen_fol_cat dcs_child_fol_cat dcs_catfol_chld dcs_dir_anc_ctlgs dcs_ind_anc_ctlgs dcs_ctlg_anc_cats dcs_cat_prnt_ctlg dcs_cat_anc_cats dcs_prd_prnt_cats dcs_prd_anc_cats dcs_cat_catalogs dcs_prd_catalogs dcs_sku_catalogs dcs_user_catalog Step 2: Run the Custom Catalog Migration The Commerce Admin page includes a tool that automatically migrates your existing catalog to the new custom catalogs.

sql <ATG9dir>/DCS/CustomCatalogs/sql/db_components/<db-vendor>/ custom_catalog_reporting1. 4. the default URL on JBoss is: Note: your application must include the Dynamo Administration UI module in order for you to view this URL. Click on Migrate. Status updates display in the browser as the migration takes place. 7. Before using reporting charts. Enter the nucleus path to your catalog repository component in the Catalog Repository To Migrate: field. For general information on Commerce reporting charts. To automatically assign your customers to a custom catalog. see the Using Commerce Charts chapter of the ATG Commerce Guide to Setting Up a Store. Enter a display name for the new custom catalog. you should run the Catalog Maintenance Service as described in Using the Catalog Maintenance System.sql <ATG9dir>/DCS/sql/uninstall/<db-vendor>/ drop_reporting_views2. For example. Step 4: Set up Reporting Charts (optional) ATG Consumer Commerce customers can use reporting charts with Custom Catalogs. Select Standard to Custom Catalog Migration. See the ATG Installation and Configuration Guide for the default port.µ 2. use a scenario to set the catalog as soon as the user’s session begins. http://hostname:8080/dyn/admin ATG Commerce Programming Guide For more information on assembling applications. • • • • • • <ATG9dir>/DCS/sql/uninstall/<db-vendor>/ drop_reporting_views3. Access the ATG Dynamo Administration page by pointing your browser to the URL appropriate for your application server.sql The Custom Catalog Repository Keep in mind that before you set up your custom catalogs for the first time.sql <ATG9dir>/DCS/sql/uninstall/<db-vendor>/ drop_reporting_views1. 76 5 . Step 3: Assign Users to Custom Catalogs You can set each user’s catalog manually or automatically. custom catalog users must run the following scripts to set up the proper reporting views. 3. 6.sql <ATG9dir>/DCS/sql/db_components/<db-vendor>/ reporting_views2. For information on scenarios. see the ATG Personalization Programming Guide. see the ATG Programming Guide. 5. Click on the Commerce Administration link to open the ATG Commerce Administration page.Using Custom Catalogs .sql <ATG9dir>/DCS/CustomCatalogs/sql/db_components/<db-vendor>/ custom_catalog_reporting.

or derived from the user’s parentOrganization. This catalog can be assigned in the catalog property of the user’s profile. Designate a category as a root category by setting the value of the rootCategories property of the catalog to include the category you want to be considered the top level of the product catalog. A catalog’s rootCategories combine with the rootCategories of its rootSubCatalogs to make up the list of the catalog’s allRootCategories. That starting point is called a root category. the repository structure is somewhat different. A given user can only have permission to view one catalog. see below for details. they see all of the root categories of Catalog B (category3 and category4) as well as the root categories of the subcatalogs (category1 and category2) meaning there appear to be four root categories. For example: Catalog A: rootCategories = category1.ATG Commerce Programming Guide µ Catalogs consist of rootCategories and rootSubCatalogs. This is used for display purposes. The custom repository component is located at /atg/commerce/catalog/ProductCatalog. you need to know where to start when navigating. including the allRootCategories in the rootSubCatalogs. if Catalog A has Catalog B as a “Sub catalog at root” then allRootCategories of Catalog B are included in the allRootCategories of Catalog A. category2 Catalog B: rootCategories = category3. Defining Root Categories With any group of categories. Catalog Properties The following table describes the catalog properties of the custom repository. Property allRootCategories How it is set CCS Description Lists of all the root categories in the catalog. For the most part. category4 rootSubCatalogs = CatalogA When a user of Catalog B views the allRootCategories. Note: Root categories of a “root sub catalog” are also considered root categories.Using Custom Catalogs . custom catalogs can be used exactly as regular catalogs are. However. For example. 77 5 . The allRootCategories property of the user’s catalog specifies all the categories in a catalog’s rootCategories property.

Repository IDs of catalogs contained within the catalog. If not set. This property refers to the same database table as allRootCategories Date the catalog was created. This property is false by default subCatalogIds Optionally implicitly computed by the CCS subCatalogs CCS (optional) 78 5 . Updated nightly to speed searching. lastModifiedDate rootCategoryIds Repository IDs of top-level categories in the catalog. including rootSubCatalogs and their subCatalogs. creationDate Implicitly set by GSA when catalog is created ACC Can be set in the ACC Implicitly set by GSA when catalog is modified Implicitly set in the ACC displayName id Name used for the catalog on the site. Read-only. Date the catalog was last modified. the GSA generates the value. Read-only.µ allRootCategoryIds ATG Commerce Programming Guide Implicitly set by the CCS List of the repository IDs of all root categories for the catalog. List of catalogs whose root categories are also root categories of the catalog (for use in combining catalogs). Repository ID for the catalog. This property refers to the same database table as subCatalogs This is an optional property that is not needed in the current versions of ATG Commerce. Read-only. and the subCatalogs of any categories in the catalog. Required. and the subCatalogs of any categories in the catalog. including rootSubCatalogs and their subCatalogs.Using Custom Catalogs . rootCategories rootSubCatalogs ACC ACC List of the top-level categories in the catalog. Refers to the same database table as rootCategories. Must set computeSubCatalogs= true in CCS to compute. It lists of all catalogs contained within the catalog.

This may not actually ancestorCategories CCS ancestorCatalogsAndS elf derived be derived if the NotEmptyChooserPropertyDescriptor user defined type is queryable. By maintaining this property. This property. The purpose of this property is so that CatalogCompletionService can find all the sub-catalogs of a given category that is being added to a catalog or another category. the system can query for catalogs that contain the category being added in the ancestorCategories. and SKUs) to only keep track of their closest containing catalog. A rootCategory of a catalog only belongs in the allRootCategories list of an ancestor catalog if it is a direct ancestor. The ancestors are divided into direct and indirect lists to make it easier to compute the allRootCategories property. directAncestorCatalo gsAndSelf CCS indirectAncestorCata logs CCS All the ancestor catalogs that do not use allRootCategories as their root categories. This allows other catalog elements (categories. Category Properties The following table describes the category item properties in the custom catalog: 79 5 . and update those catalogs ancestor-catalogs properties accordingly. products.Using Custom Catalogs .ATG Commerce Programming Guide µ All the catalogs that use this catalog’s allRootCategories as their root categories. (See directAncestorCatalogsAndSelf for further explanation). The combination of directAncestorCatalogsAndSelf and indirectAncestorCatalogs. compiles a complete list of all ancestor catalogs within each catalog. (See directAncestorCatalogsAndSelf for further explanation) All the categories that can are connected to this catalog through its children. The list of all catalogs that these elements belong to can be determined from the ancestor list of that closest containing catalog. along with indirectAncestorCatalogs. Otherwise it is a Union.

Using Custom Catalogs . This is used to determine whether an end user has permission to view this category. in which case an entry is placed in this map.childCategories) to this category. This is used to determine the catalog whose Access Control List should be used for admin permissions. This is the catalog that owns this category. production this is set by the CatalogMaintenanceService. this value is set by the CatalogMaintenanceService. 80 5 . In production. that catalog can be contained within another catalog. While a category can only be directly contained by one catalog. catalogs Derived in development mode Set by CMS in production mode. regardless of catalog. Read-only. In catalog Derived in development mode Set by CMS in production mode.ancestorCatalogsAndS elf) but is not queryable. In development mode this is derived (non-queryable) by walking up the parentCategory until a catalog is reached. In development this is derived (Alias of catalog. (category. Uses same database table as ancestorCategories ancestorCategoryIds Implicitly set by CMS auxiliaryMedia ACC Additional media to be displayed with this category. categoryInfos ACC (optional) Map from catalogId to a categoryInfo.µ Property ancestorCategories ATG Commerce Programming Guide How it is set CMS Description All the categories that can be used to navigate to (through category.childCategories is a combination of fixedChildCategories and subCatalogsChildCategories) RepositoryIDs of the ancestor categories. All the catalogs that include some path to this category.

childCategories derived childCategoryGroup ACC childProductGroup ACC childProducts ACC creationDate Implicitly set by GSA ACC description displayName ACC dynamicChildCategories derived dynamicChildProducts derived dynamicRelatedCategori es derived endDate ACC fixedChildCategories ACC 81 5 . Short descriptive text for display with this category. Read-only. Date this category will no longer be available.Using Custom Catalogs . Name used for the category on the site. Required. a merge of fixedChildProducts and dynamicChildProducts. Read-only. a merge of fixedChildCategories and dynamicChildCategories. List of the categories in the content group specified by the relatedCategoryGroup property. Read-only. Name of the content group that contains the list of dynamicChildProducts. Used by catalog admin to explicitly set the descendant categories of a category. List of the products in the content group specified by the childProductGroup property. List of child categories of this category. List of the categories in the content group specified by the childCategoryGroup property.ATG Commerce Programming Guide µ List of all categories that are children of this category. if a collection filter is implemented to use this property. Read-only. Name of the content group that contains the list of dynamicChildCategories. Readonly. Readonly. Date this category was created. List of all products that are children of this category.

The parent category of this category. largeImage ACC longDescription ACC parentCatalog CCS parentCategory CCS relatedCategories derived Read-only. dynamicRelatedCategories. it implicitly set by GSA keywords ACC Set of words that can be used in searching for this category. RepositoryID for this category. this represents a merge of fixedRelatedCategories. The parent catalog of this category. Users can explicitly change this if they wish. If fixedRelatedCategories ACC id ACC this property is not set through the ACC during creation. Used by catalog admin to explicitly set the descendant products of a category.µ fixedChildProducts ATG Commerce Programming Guide ACC List of child products of this category. This will only hold a value if the catalog is a rootCategory of the given catalog. and the categoryInfo property catalogsRelatedCategories. The CatalogCompletionService will arbitrarily choose one (if the value is null). Detailed descriptive text for display with this category.Using Custom Catalogs . It is possible there is more than one choice here. This is used in the ParentCatalog derivation. 82 5 . Static list of categories related to this category. List of all categories that are children of this category. Large image associated with the category. The purpose is twofold: 1) used in breadcrumbs 2) used in “Catalog” derivation to walk up the category tree to find the containing catalog.

JSP used to display this category. 83 5 . You can create categoryInfo objects through the ACC if you wish to keep catalogspecific information for a category. categoryInfo objects were required in custom catalogs before ATG Commerce 6. Used by catalog admin to explicitly set direct descendant catalogs of a category. The CollectiveUnion of the “allRootCategories” of each catalog in “subCatalogs”. Small image associated with the category. Readonly.Using Custom Catalogs . Date this category becomes available. Provided for subclassing purposes. All relevant information for a category is kept in the category item.ATG Commerce Programming Guide µ Name of the content group that contains the list of categories that dynamicRelatedCategories is set to. Integer that is incremented automatically each time the category is updated. Used to help compile the “childCategories” property . use to indicate if an item belongs to the superclass or a subclass.the complete list of all descendant categories of a category. if a collection filter is implemented to use this property. Thumbnail image associated with this category.1. relatedCategoryGroup ACC smallImage ACC startDate ACC subCatalogs ACC subCatalogsChildCatego ries derived template thumbnailImage ACC ACC type Not used out-ofthe-box version Implicitly set by GSA categoryInfo Properties categoryInfo objects are no longer required for custom catalogs. used to prevent version conflict. List of catalogs whose root categories will be considered child categories of this category.

Product Properties The following table describes the product item properties in the custom catalog: Property How it is set CMS Description ancestorCategories All the categories that have you can navigate through (through category. ancestorCategoryIds RepositoryIDs of the ancestor categories. Read-only. this information is no longer stored in categoryInfo item – now in the ancestorCategoryId property of category item. RepositoryIDs of the ancestor categories. Updated nightly to speed searching. This property uses the same database table as ancestorCategories. regardless of catalog.µ Property How it is set ancestorCategories ATG Commerce Programming Guide Description Categories that are higher in the catalog hierarchy than this category. version Implicitly set by GSA Integer that is incremented automatically each time the categoryInfo is updated.childCategories and category.childProducts) to this category. Used for hierarchical search. By default. By default. 84 5 . this information is no longer stored in categoryInfo item – now in the ancestorCategories property of category item.Using Custom Catalogs . Read-only. used to prevent version conflict. ancestorCategoryIds Implicitly set by CMS auxiliaryMedia ACC Additional media to be displayed with this product.

Static list of products related to this product. Required. Generated Set of related products that are only shown to users of a particular catalog.Using Custom Catalogs . catalogs Derived (developm ent only) catalogsRelatedProduc ts derived childSKUs ACC creationDate Implicitly set by GSA ACC description Short descriptive text for display with this product. Read-only. RepositoryID for this category. this value is set by the CatalogMaintenanceService. Name used for the product on the site. Detailed descriptive text for display with this product. Date this product will no longer be available. List of properties of the product’s SKUs that can be displayed by the DisplaySkuProperties servlet bean. it is implicitly set by GSA Set of words that can be used in searching for this product. Used to determine if an end user has permission to view this product. In production. This is not queryable. Read-only. Date this product was created. Large image associated with the product. List of child SKUs of this product. if a collection filter is implemented to use this property. keywords ACC largeImage longDescription ACC ACC 85 5 . Used by catalog admin to explicitly set child SKUs of a product. If it is not set through the ACC. List of the products in the content group specified by the relatedProductGroup property. Can be set in displayableSkuAttribu tes ACC displayName ACC dynamicRelatedProduct s derived endDate ACC fixedRelatedProducts id ACC ACC (optional) ACC upon creation of product. Read-only.ATG Commerce Programming Guide µ In development this is the CollectiveUnion of “catalogs” for each category in “parentCategories”.

This is not queryable. The CatalogMaintenanceService will choose arbitrarily if one is not yet chosen for the given catalog. List of all products that are children of this category. a merge of fixedRelatedProducts. Map from productId to a productInfo. Users may change the value.fixedChildCategories. The parentCategory for each catalog.µ parentCategories ATG Commerce Programming Guide Implicit GSA reuse Reuses the same table as category. Read-only. Therefore adding a product to another category’s child list will automatically update the parentCategories property. the ProductsParentCategory derivation is used by inspecting each category in “parentCategories”. In development. Read-only. JSP used to display this product. Date this product becomes available. and the productInfo property catalogsRelatedProducts. There is possibly more than one choice. Name of the content group that contains the list of dynamicRelatedProducts. parentCategoriesForCa talog CMS parentCategory derived productInfos relatedProductGroup ACC ACC relatedProducts ACC smallImage startDate ACC ACC Small image associated with the product. use to indicate if an item belongs to the superclass or a subclass. dynamicRelatedProducts. Thumbnail image associated with this product. if a collection filter is implemented to use this property.Using Custom Catalogs . Provided for subclassing purposes. the CatalogMapDerivation is used to get the correct parent from “parentCategoriesForCatalog”. This is used for breadcrumb purposes. This is derived one way in development and another way in product. In production. This is used to derive the proper value for the “parentCategory” property. template thumbnailImage ACC ACC type Not used out-of-thebox 86 5 .

productInfo objects were required in custom catalogs before ATG Commerce 6. this information is stored in ancestorCategories property of product item. RepositoryIDs of the ancestor categories. Read-only. version Implicitly set by GSA productInfo Properties productInfo objects are no longer required for custom catalogs. used to prevent version conflict. Description ancestorCategories Set of categories that are higher in the catalog hierarchy than this product. Read-only. Parent category for this catalog. Property How it is set That property is computed by the CMS. Read-only.1. Now kept in parentCat egoriesFo rCatalog map in Product item That property is computed by the CMS. Now stored in ancestorCategoryIds property of product item ancestorCategoryIds That property is implicitly computed by the CMS – it uses the same DB table as ancestorC ategories catalogsRelatedProdu cts parentCategory ACC Related products that are only shown to users of the catalog that maps to this productInfo.Using Custom Catalogs . You can create productInfo objects using the ACC if you wish to keep catalog-specific information for a product.ATG Commerce Programming Guide µ Integer that is incremented automatically each time the product is updated. Out-of-the-box. 87 5 .

Can be set in ACC upon item creation. SKU is not a bundle. Additional attributes of the SKU. Date the SKU is created. This is not queryable. Read-only. Repository ID for this SKU. largeImage ACC 88 5 . SKU Properties The following table describes the SKU item properties in the custom catalog: Property How it is set ACC ACC Description auxiliaryMedia bundleLinks Additional media to be displayed with the SKU. In production. List of SKU links that make up the SKU bundle.Using Custom Catalogs . used to prevent version conflict. Required.µ version ATG Commerce Programming Guide Implicitly set by GSA Integer that is incremented automatically each time the product is updated. Replacement products that are only shown to users of a particular catalog. otherwise implicitly set by GSA Large image associated with the SKU. Read-only. if a collection filter is implemented to use this property. catalogs Derived (develop ment only) catalogsReplacement Products creationDate derived Implicitly set by GSA ACC ACC ACC ACC description displayName dynamicAttributes endDate Short descriptive text for display with the SKU. Date the SKU is no longer available. this value is set by the CatalogMaintenanceService. if null. Used to determine if an end user has permission to view this SKU. Static list of SKUs related to this SKU. fixedReplacementPro ducts fulfiller id ACC ACC ACC Fulfiller who will ship the item. In development this is the CollectiveUnion of “catalogs” for each product in “parentProducts”. Read-only. Name used for the SKU on the site.

childSkus. Read-only. Provided for subclassing purposes. Map from SKU to a SKUInfo. You can create SkuInfo objects using the ACC if you wish to keep catalog-specific information for a SKU. used to prevent version conflict. Thumbnail image associated with the SKU. Products to suggest as replacements if the item is out of stock. skuInfo objects were required in custom catalogs before ATG Commerce 6. use to indicate if an item belongs to the superclass or a subclass.1. 89 5 . Integer that is incremented automatically each time the SKU is updated. Price of the SKU if onSale property is true. Read-only. Wholesale price of the SKU. Date on which the SKU is available. Property How it is set ACC Description catalogsRepla cementProduct s These are replacement products that are only shown to users of the catalog that maps to this SKUInfo.Using Custom Catalogs . Boolean property that indicates if the item is on sale. JSP template used to display the SKU. if a collection filter is implemented to use this property. listPrice ACC onSale parentProducts ACC implicit GSA reuse replacementProducts derived salePrice skuInfos smallImage startDate ACC ACC ACC ACC template thumbnailImage type ACC ACC Not used out-ofthe-box Implicitly set by GSA ACC version wholesalePrice SKUInfo Properties skuInfo objects are no longer required for custom catalogs. Read-only. Reuses the same table as product.ATG Commerce Programming Guide µ Default price of the SKU before any discounts or promotions. Small image associated with the SKU. Therefore adding a SKU to a product’s child list will automatically update the parentProducts property.

SKU. 90 5 . Custom Catalog Navigation This section contains information on ATG Commerce classes intended to help customers navigate your store. and the permissions they have. see Implementing Custom Catalogs section of the ATG Commerce Guide to Setting Up a Store. Looking Up Items in the Catalog Use the atg.promotion See the Preparing to Use Commerce Reporting chapter in this guide for information on data logging. which makes it different from atg. Custom Catalog Security Securing a catalog allows certain users to view and edit a catalog while preventing other users from doing so. in order for the ProductCatalog logs to be created during deployment.sku. For information on implementing navigational strategies in your store. the catalog. The ACL contains lists of users or groups of users.µ version ATG Commerce Programming Guide Implicitly set by GSA Integer that is incremented automatically each time the SKUInfo is updated.repository. In the custom catalogs security policy. the repository ID.CatalogItemLookupDroplet class to locate and display items in a repository. media) except for category. the ACL of a category is the same as the ACL of the catalog that contains it. Note: If you are using custom catalogs in ATG Business Commerce with reporting.servlet.pr operties file with the following contents: repositoryPathAliasMap=\ /atg/commerce/catalog/SecureProductCatalog=/atg/commerce/catalog/ ProductCatalog sourceRepositoryPathToItemDecriptorNames+=\ /atg/commerce/catalog/SecureProductCatalog=category.custom. and the item type. This ATG Servlet Bean takes input parameters specifying the repository.Using Custom Catalogs . ATG Commerce implements a security policy for catalogs based on the secured repositories feature (for more information. used to prevent version conflict. product.catalog. an access control list (ACL) is stored for each individual item (catalog. and renders the specified item on the page.product. see the Secured Repositories chapter in the ATG Repository Guide). This servlet bean does not return items that are not visible from the current user’s catalog (as defined in their profile). Readonly. create a server_name/localconfig/atg/reporting/datacollection/commerce/ProductCatalogDeploymentListener.commerce.ItemLookupDroplet.

and MediaLookup. To facilitate this feature. For example: parentCategoryPropertyName=higherCategory CatalogTools uses parentCategory to determine the ancestor categories of a product or category. if the customer then wants to move up the hierarchy. If customer views a product that has multiple parent categories. see Appendix A: ATG Commerce Servlet Beans of the ATG Commerce Guide to Setting Up a Store. you may want to create additional ItemLookupDroplet 4components. This section includes the following information related to searching custom catalogs: Overview of Custom Catalog Searching Configuring the Custom Catalog’s Search Form Handler 91 5 . you can have the link point to the category specified by the parentCategory property. but can complicate navigation. suppose you have a link on each page that takes the customer up one level in the catalog hierarchy. But if the customer finds the product by searching rather than navigating through the catalog hierarchy. If your catalog uses a different name for the parentCategory property. Using the parentCategory Property A category or product can be the child of more than one category. For more information about the ItemLookupDroplet servlet bean. ProductLookup. and make this link point back to that category. a product can have different parentCategories for each catalog in which the product appears. parentCategory is a derived property in custom catalogs The value it returns is the parentCategory of the productInfo object that is mapped to the user’s current catalog..Using Custom Catalogs . ATG Commerce includes several ItemLookupDroplet components that are configured to use the product catalog as the default repository and find a specific item type. Specifying multiple parent categories makes the catalog more flexible. You can use the parentCategory property of the category and product items to specify a default parent category for this purpose. you need to determine which parent category to move to. In custom catalogs. SKULookup. If your site includes more than one catalog. or if your catalog uses item types not found in the standard catalog. Four of these components are found in /atg/commerce/catalog/: CategoryLookup. set the parentCategoryPropertyName property in the /atg/commerce/catalog/CatalogTools.ATG Commerce Programming Guide µ Rather than specifying the repository and item type through input parameters. For example. your site can track which parent category the customer accessed the product from. you can set these through the servlet bean’s properties file. This is especially true if the customer accesses a category or product through a search facility rather than by traversing the catalog hierarchy. Custom Catalog Searching You can provide searching mechanisms to enable customers to find products in the catalog that satisfy a set of criteria.properties file to the actual name of the property.

An example of a keyword search is “Show me all products and categories with the keyword shoe.catalog. An example of a full-text search is “Show me all products whose longDescription property contains the word wool. customers specify target values to search for through form fields in a JSP. You can create additional CatalogSearchFormHandler components and configure them through their properties files or through the Component Editor in the ACC. the children of those children. and you can specify which properties to examine when searching. you can extend CatalogSearchFormHandler or write another form handler. or for both products and categories that have a specified set of property values. and so on. Hierarchical Searches Hierarchical searches look in a subset of categories. you can search for products that contain a specified substring in their names.Using Custom Catalogs . starting from a given category. CatalogSearchFormHandler can be configured to perform four types of searching: Keyword Searches Keyword searches use keyword property names and input search strings to search product and category keywords. or for categories that are tagged with a specified keyword. and including that category’s child categories. You can use this form handler to construct searches for one or more catalog item types. Configuration settings in the form handler’s properties file specify the kinds of elements to search for. The customer enters values that are used for keyword matching.” Note that your database must be configured properly to support full-text searches. each one configured for a different set of search options (see Preconfigured Custom Catalog Search Components).commerce.CatalogSearchFormHandler to search the catalog repository for items such as products and categories. For more information. ATG Commerce includes several CatalogSearchFormHandler components in /atg/commerce/catalog.” Text Searches Full-text searches use text property names and input search strings to perform text pattern matching on properties.custom. and additional configuration details for each type of search. the properties of those elements to consider when searching. If your store requires custom search capabilities. see the discussion on databases and database access in the ATG Installation and Configuration Guide. Typically. For example. The CatalogSearchFormHandler class should provide sufficient search functionality and flexibility for most sites.µ ATG Commerce Programming Guide Configuring Custom Catalog Search Types and Specifying Search Criteria Combining Custom Catalog Search Types Preconfigured Custom Catalog Search Components Processing and Displaying Custom Catalog Search Results Searching Custom Catalogs in Development Mode Using Search Form Handler with Internationalized Catalogs Overview of Custom Catalog Searching ATG Commerce provides the form handler class atg. 92 5 .

but you can configure search form handlers to search for SKUs or for custom category or product subtypes you have created. Unless you have implemented your own catalog management system. The following is an example of a properties file for a CatalogSearchFormHandler component that can perform all four types of searching: $class=atg. For example. The advanced query is built from options selected by the customer to further refine the catalog search. You specify the item types to find by setting the itemTypes property in the form handler’s properties file to a list of strings. you could have one form handler that searches only for clothing products and another that searches for all products and categories. In addition to specifying the item types to search for. each naming one item type. An example of an advanced search is “Show me all products with the keyword shoe where price range is expensive. a clothing search page might use the first form handler. manufacturer. For example. Advanced Searches Advanced searches provide possible search options for each property specified in the form handler’s advancedSearchPropertyNames property.custom.CatalogSearchFormHandler $scope=session doKeywordSearch=true keywordsPropertyNames=keywords doTextSearch=true textSearchPropertyNames=description.ATG Commerce Programming Guide µ The given category is indicated by the repository ID in the hierarchicalCategoryId property. enumerated types are defined in the repository with a set number of values.displayName doHierarchicalSearch=true ancestorCategoriesPropertyName=ancestorCategories doAdvancedSearch=true 93 5 . as described in Using the Catalog Maintenance System. Advanced searches retrieve these values from the definition to display in a selection box. Item types typically include category or product. SKUs. you must also set the property catalogTools so that it refers to a CatalogTools object that provides access to categories.” Configuring the Custom Catalog’s Search Form Handler CatalogSearchFormHandler can search for any type of repository item in the catalog repository. advanced searches allow a customer to search on a description.catalog. You can also create multiple instances of CatalogSearchFormHandler and configure them to search for different kinds of objects. and other catalog information. while a more general search page would use the second. products. For example. you must generate the ancestorCategories property for each product and category item. you should use the default CatalogTools component at /atg/commerce/catalog/CatalogTools. To perform hierarchical searches. or price.Using Custom Catalogs .commerce.

ATG Commerce includes five different CatalogSearchFormHandler components (see Preconfigured Custom Catalog Search Components). you can force the form handler to convert keyword inputs to lowercase by setting toLowerCaseKeywords to true instead. You could use this component and just enable keyword searching on the page by including this tag: <dsp:input type="hidden" bean="KeywordSearch. but you have one page where you want to enable text searching as well.µ ATG Commerce Programming Guide advancedSearchPropertyNames=weightRange. or by setting the searchInput property to a string containing one or more words separated by spaces. 94 5 . You can override the default behavior by setting the keywordsPropertyNames property of the form handler in its properties file. suppose your site has a CatalogSearchFormHandler component named KeywordSearch that is configured only for keyword searching. For example. it is convenient to have several CatalogSearchFormHandler components. (You can change the separator character used to parse searchInput by setting the form handler’s keywordInputSeparator property. Keyword Searches To enable keyword searches in the form handler. set the property doKeywordSearch to true. each configured differently. and each of these properties can be either single-valued or multi-valued. You can also change the behavior of a CatalogSearchFormHandler component for an individual page by setting hidden input fields.doTextSearch" value="true"> Configuring Custom Catalog Search Types and Specifying Search Criteria As mentioned above. Similarly.catalog itemTypes^=/atg/commerce/customCatalogTools. You can specify the target values to search for by setting the keywords property of the search form handler to an array of strings. CatalogSearchFormHandler provides four different types of searching: • • • • keyword searches text searches hierarchical searches advanced searches This section describes how to configure a SearchFormHandler component for each of these types of searching.Using Custom Catalogs .productItemTypes Because there are so many possible combinations of search options. By default.) You can force the search form handler to convert all keyword inputs to uppercase before searching by setting the toUpperCaseKeywords property to true. keyword searches look at the keywords property of each catalog item. and you can create additional instances.childSKUs catalog^=/atg/commerce/catalog/custom/CatalogTools.manufacturer. These values are typically specified by the customer through a form input field. You can specify one or more properties to consider in keyword searches.

For example. and you search for the values red. If your database supports a full-text search engine. set the property doTextSearch to true. This means that if any one of the queries returns true. green. the resulting query is: keywords INCLUDES ANY ["red". the resulting query is: keywordString CONTAINS "red" OR keywordString CONTAINS "green" OR keywordString CONTAINS "blue" Since CONTAINS performs a substring match. If you specify multiple properties in keywordsPropertyNames. However. The target search string is specified by setting the form handler’s searchInput property. the property is of type String). If a fulltext search engine is not available (either because your RDBMS does not support one. If a property specified in keywordsPropertyNames is single-valued (e. If this property is not set. and you search for the values red. For example. or because you do not have a license for the one your RDBMS supports). and blue using keyword search. typically by the customer entering the value in a form input field. you must configure the search engine properly. this query returns true for an item whose keywordString has the value reduced calorie. the item is returned by the search operation. Text Searches To enable text searches in the form handler. the keyword search algorithm uses the QueryBuilder. and set the repository component’s simulateTextSearchQueries property to false."blue"] Since INCLUDES ANY searches for an exact match. if you have a keywordString property whose type is String. because red is not an exact match for reduced calorie. Note that although simulated full-text searching is useful for development purposes. You specify which properties to examine by setting the textSearchPropertyNames property of the form handler. if there is one. text searches use a default set of properties that is defined by the repository. For more information about configuring 95 5 .g.Using Custom Catalogs . the product catalog’s simulateTextSearchQueries is set to true to support full-text searching on the SOLID database that is included with Dynamo. then combines these queries using the OR operator. the keyword search generates a query for each property.INCLUDESANY query to perform a single search for an exact match between any value in the property and any value in the set of search criteria. To enable this feature. if you have a keywords property whose type is String[].. The implementation of text searching is RDBMS-specific and uses the database’s text searching facility. the keyword search algorithm uses the QueryBuilder. if a property specified in keywordsPropertyNames is multi-valued (for example. this query returns false for an item whose keywords are diet and reduced calorie. the property is of type String[]).CONTAINS query to examine each target value and see if it appears anywhere within the property’s current value.ATG Commerce Programming Guide µ Keyword searches treat single-valued and multi-valued properties differently. green.. performance is unlikely to be adequate for a production server."green". and blue using keyword search. because reduced contains the string red within it. set the repository component’s simulateTextSearchQueries property to true. the SQL repository can simulate full-text searching by using the LIKE operator to determine whether the target value is a substring of any of the text properties being examined. By default.

Hierarchical searching restricts the search results to items whose ancestor categories include the category specified through hierarchicalCategoryId. you may be able to configure this component to generate ancestor categories for your catalog items. This property is a Dictionary to which you add one key/value pair for each property you want to search. Setting a value to an empty string omits it from the search. each category and product item has an ancestorCategories property whose value is a Set of that item’s ancestor categories The values of these properties can be generated automatically using the component /atg/commerce/catalog/custom/AncestorGeneratorService. Target values are specified for one or more of these properties by adding values to the propertyValues property of the form handler. which is a Dictionary containing one key/value pair for each property named in advancedSearchPropertyValues whose type is either enumerated or RepositoryItem. a query is generated based on whether the property is single-valued or multi-valued. where color is a single String and availableSizes is an array of Strings. searching color for a value of red and availableSizes for a value of medium. to look for items whose color property is set to red. results in the following query: (color = red) AND (availableSizes INCLUDES medium) CatalogSearchFormHandler has a property called propertyValuesByType. and the value to search for. If you are using the standard catalog schema. or you can specify ancestor categories by setting properties manually. To enable hierarchical searches in the form handler.propertyValues. If your catalog does not use the default schema. see the discussion on databases and database access in the ATG Installation and Configuration Guide. set the form handler’s doAdvancedSearch property to true. For example. This property is typically set through a hidden input tag. See Using the Catalog Maintenance System for more information. For single-valued properties a simple equality test is used.µ Hierarchical Searches ATG Commerce Programming Guide your database for full-text searching. You specify the category to start the search from by setting the form handler’s hierarchicalCategoryId property to the repository id of the category whose descendants you want to find. and therefore specifies that the property matches any value. or specified by the customer through a form input field.color to red. For example. Hierarchical searching requires that each category and product item have a multi-valued property whose value is a complete list of all of its ancestor categories. The key is the property name. so all properties must match for the catalog item to be selected. the queries are combined using the AND operator. typically through form input fields. Advanced searches are limited to the set of properties you name here. Specify the name of the ancestor category property by setting the ancestorCategoriesPropertyName property of the form handler. so that the query succeeds if any of the property’s values match the target value. If you specify multiple properties. For each property specified in propertyValues. set CatalogSearchFormHandler. Advanced Searches To enable advanced searches. You then specify the set of properties to search by setting the advancedSearchPropertyNames property. For multi-valued properties an INCLUDES test is generated.Using Custom Catalogs . The key is the name of the property and the value is a 96 5 . set the property doHierarchicalSearch to true.

and large. the size of an item. medium. 97 5 . This component is an instance of the atg.PossibleValues class.Create a default choice --> <dsp:option value="" selected="true"/>Any size <!-. see the Reference Applications section of the Introduction in the ATG Commerce Guide to Setting Up a Store. For more information.size" name="array"/> <dsp:oparam name="output"> <dsp:getvalueof id="option11" param="element" idtype="java. where size is an enumerated property with a set of predefined values like small. there are some important differences: • RepositoryValues determines possible values for only a single item type at a time.FilteringCatalogPossibleValues.String"> <dsp:option value="<%=option11%>"/> <dsp:setvalue bean="" value="/> </dsp:getvalueof><dsp:valueof param="element">Unknown size</dsp:valueof> </dsp:oparam> </dsp:droplet> </dsp:select> For more examples. • RepositoryValues can look up values for any property of a repository item. For information on the Sample Catalog and how to run it.ATG Commerce Programming Guide µ Collection of the possible values.repository. Note: When running development mode.catalog. The RepositoryValues servlet bean returns essentially the same information as the propertyValuesByType property of the CatalogSeachFormHandler class. see the Sample Catalog that is provided with ATG Commerce. while the propertyValuesByType property works with multiple item types at the same time. see Searching Custom Catalogs in Development Mode. See the entry for PossibleValues in Appendix B: ATG Servlet Beans in the ATG Page Developer’s Guide for a detailed description of this servlet bean.commerce.size"> <!-.Using Custom Catalogs .Now create an option for each defined value for size --> <dsp:droplet name="ForEach"> <dsp:param value="SearchHandler. for example.propertyValues. However. the /atg/commerce/catalog/RepositoryValues component becomes an instance of atg.propertyValuesByType. while propertyValuesByType works with only the properties specified in the form handler’s advancedSearchPropertyNames property. The following example illustrates this: <!-. The propertyValuesByType property is useful for building forms that allow customers to select.lang. Another approach to determining the possible values of properties whose type is enumerated or RepositoryItem is to use the servlet bean located at /atg/commerce/catalog/RepositoryValues.Create a select field to choose size and a default option --> Size: <dsp:select bean="SearchHandler.servlet.

format=DVD The search will locate all comedies plus all movies whose description mentions Steve Martin. but will return only the subset of those movies that are found in the BudgetMovies category and are available on DVD. ProductSearch searches keywords and descriptions and finds matching products only. For example. and display names. Search types are combined according to the following rules: • • Text and keyword searches are combined using the OR operator. The customer enters the following search criteria: keywords=comedy textSearchPropertyNames=description searchInput=Steve Martin hierarchicalCategoryId=BudgetMovies propertyValues. so that a match on either set of criteria selects an item for inclusion in the search results. and you configure a search form handler to allow all four types of searches. or you can combine advanced searching with hierarchical searching to find only items in a particular category.µ • ATG Commerce Programming Guide RepositoryValues works anywhere in a JSP.Using Custom Catalogs . you can use any combination of search types. Preconfigured Custom Catalog Search Components ATG Commerce includes five preconfigured instances of CatalogSearchFormHandler in /atg/commerce/catalog: • • • CatalogSearch searches keywords. and finds matching products and categories. In fact. you can search on both keywords and text. while the propertyValuesByType property is only available within search forms you construct using the SearchFormHandler class. 98 5 . Combining Custom Catalog Search Types The CatalogSearchFormHandler class allows you to specify multiple search types in a single request. descriptions. limiting the scope of the search to items that satisfy the hierarchical or advanced search requirements in addition to any specified text or keyword search criteria. CategorySearch searches keywords and descriptions and finds matching categories only. suppose you have a catalog of videos and DVDs. Hierarchical and advanced searches are combined using the AND operator. The query is of the form: (KeywordConditions OR TextConditions) AND HierarchicalConditions AND AdvancedSearchConditions For example.

sorted by display name: Your search returned the following products: <dsp:droplet name="ForEach"> <dsp:param value="CatalogSearch. You can use the sorting capabilities of a servlet bean (such as ForEach) to control the order in which the items are displayed. the five preconfigured search components are instances of FilteringSearchFormHandler in atg/commerce/catalog. but reflect the order they were retrieved from the database. if you search for categories and products in the standard catalog schema. and the value is a Collection of items of that type that satisfied the search criteria. and another key called product whose value is a Collection of matching products. which contain the same information but organize it differently: • The searchResults property is a Collection of all catalog items that satisfied the search criteria.search" value="Go" type="submit"/> After executing the query. see Searching Custom Catalogs in Development Mode. The key is the item type name (the value specified in the form handler’s itemTypes property). Note: When running development mode. the searchResultsByItemType property will have a key called category whose value is a Collection of matching categories. open them in the ACC Component Editor and view their property settings. • For example. you associate the form handler’s search property with a submit button.ATG Commerce Programming Guide µ • • ProductTextSearch searches only description fields. and finds matching products only. the items are not sorted. The searchResults property will have a Collection in which some of the items are categories and some of the items are products. SearchFormHandler makes the search results available in two different properties. To see how these components are configured.product" name="array"/> <dsp:param value="+displayName" name="sortProperties"/> 99 5 . AdvProductSearch combines keyword and text searching with hierarchical and advanced searching. as in this example: <dsp:input bean="/myCatalog/SearchForm. The following example uses ForEach with searchResultsByItemType to display only the products returned by the search. Within each Collection. If you search for multiple item types (such as categories and products) all items returned by the search appear in the list regardless of their type.searchResultsByItemType. Typically. Processing and Displaying Custom Catalog Search Results SearchFormHandler executes its search query when the handleSearch method is called. The searchResultsByItemType property is a HashMap containing one key/value pair for each item type you searched for. and finds products that match all search criteria. not keywords.Using Custom Catalogs . For more information.

catalog. Before returning the result set.catalog. might show different sets of products to customers in the US and the UK.µ <dsp:oparam name="empty"> <p>No matching products were found. FilteringCatalogSearchFormHandler then iterates through the results. </dsp:oparam> </dsp:droplet> ATG Commerce Programming Guide <dsp:oparam name="output"> <li><dsp:valueof param="element. • In production mode: The SearchFormHandler and CatalogPossibleValues classes add a clause to the query that they pass to the repository that restricts the search results to the user’s current catalog.displayName">Unknown product</dsp:valueof> </dsp:oparam> Searching Custom Catalogs in Development Mode Custom catalog searches in development mode are performed slightly differently than searches in production mode.commerce.FilteringSearchFormHandler the /atg/commerce/catalog/RepositoryValues component becomes an instance of atg. Instead. Those items that do not contain the user’s current catalog among their catalogs are then removed from the list. A site that sells laptop computers with integrated modems. In development mode: The catalogs property of categories. the repository would only return items that exist in the user’s current catalog. So the SearchFormHandler cannot add the extra clause to narrow the search to only the user’s current catalog. The following example demonstrates the different ways the two modes retrieve the same results. the query includes a “where keywordString CONTAINS ‘red’” clause and the SearchFormHandler adds another clause to make the query “where keywordString CONTAINS ‘red’ and catalogs CONTAINS (the user’s current catalog)”. and the “filtered” result set containing only items in the user’s current catalog is returned. and SKUs is derived and non-queryable. If a user does a keyword search for “red” in production mode. The two main differences are: • • the five preconfigured search components become instances of atg. for example. 100 5 . the query is run without the extra clause and items not in the user’s current catalog may be returned.Using Custom Catalogs . or display different sets of products to customers in different countries. and checks the catalogs property of each. which can display product information in different languages. products.commerce. taking into account the different keyboard layouts and telephony standards that prevail in those countries.FilteringCatalogPossibleValues. Therefore. • Using Search Form Handler with Internationalized Catalogs Some businesses require internationalized catalogs.

Assigning a Custom Catalog to a User In order for a user to view a custom catalog. catalog is a derived property. The repositoryKey property is typically set through a hidden input field in the search form. For ATG Consumer Commerce.locale"/>' type="hidden" bean="MySearchFormHandler. as in this example: <dsp:input value='<dsp:valueof bean="Profile. For ATG Business Commerce. the standard catalog repository is used. set catalog to the catalog you want the user to see. If you don’t set repositoryKey. You can set it in either the user’s myCatalog property or the catalog property of the contract for the user’s parentOrganization. The search form handler uses repositoryKey to retrieve the appropriate catalog from the CatalogTools component. The custom catalogs feature assumes the existence of a catalog property for the user repository item. You can do this by setting the search form handler’s repositoryKey property to the name that identifies the repository you want to search. you want to make sure they search the catalog specific to their language or locale. 101 5 . but if you have ATG Consumer Commerce installed you will have to add it as detailed in Converting from Standard to Custom Catalogs. the parent organization’s setting is ignored.repositoryKey"> Using repositoryKey in conjunction with the alternateRepositories property of the CatalogTools component lets you ensure that customers see only the appropriate products when searching the catalog.ATG Commerce Programming Guide µ The CatalogTools component includes a property called alternateRepositories that lets you specify a mapping between symbolic names (called repository keys) and alternative repositories to use as the product catalog. When the customer searches the catalog on an internationalized site. If myCatalog is set. You can then use customer locale as the repository key to determine which version of the catalog to display. they must have that catalog assigned to them. This property is included in ATG Business Commerce.Using Custom Catalogs .

µ ATG Commerce Programming Guide 102 5 .Using Custom Catalogs .

and releases it upon completion. Each service keeps in memory a history of all information.ATG Commerce Programming Guide µ 6 Using the Catalog Maintenance System ATG catalogs use several batch and dynamic services to perform catalog updates and to verify catalog relationships. using the global lock management. getWarningMessages. getInfoMessages and getCurrentMessage. The CMS updates property values that enable navigation and hierarchical search. getErrorMessages. warning and error level messages. They are: • • • • AncestorGeneratorService CatalogVerificationService CatalogUpdateService CatalogMaintenanceService Each service performs functions that can be selectively executed using the function names. others for both standard and custom catalogs. Each service has the following configurable property values 103 6 . Batch Services There are four services that facilitate the updating of the catalog in batch mode. They can be viewed using the View Status option on the Commerce Administration Page. All batch services can be run on demand or in scheduled mode. These services are collectively referred to as the Catalog Maintenance System (CMS). For more information see Running the Batch Services from the Commerce Admin Page. Batch Services Dynamic Services Note that some of these services are available only for custom catalogs.Using the Catalog Maintenance System . They are exposed through a set of API. It also verifies the relationships of catalog repository items and properties. or other servers in the cluster. Each service creates a global lock at the start of execution. This prevents services that use the same lock name from executing simultaneously on the same server.

Time in milliseconds before a timeout when acquiring the global lock. The name used for the global lock. the service will schedule itself accordingly when it is first instantiated. A list of function names that the service can perform. The scheduled job description.Using the Catalog Maintenance System . The number of repository items that are updated before restarting the transaction. This property is used to configure a default set of function names that are executed when none are provided. 104 6 . AGS_GENCATALOGS to generate ancestor catalogs. This service must be executed after making catalog updates in order for catalog navigation and search to work correctly. such as in schedule mode. The scheduler job name used when the service is scheduled. error.µ Property schedule ATG Commerce Programming Guide Description Schedule on which the service will execute. the info. and warning messages from the last execution of the service are retained in memory. availableFunctions functionsToPerformBy Default saveMessages maxItemsPerTransacti on jobName jobDescription lockTimeOut lockName AncestorGeneratorService Component: /atg/commerce/catalog/custom/AncestorGeneratorService (for custom catalogs) or /atg/commerce/catalog/AncestorGeneratorService (for standard catalogs) The AncestorGeneratorService updates the following property values for each of the catalog item types. Can be set to true or false. Function names are used to identify specific processes that can be performed by the service such as. It can be any of the functions exposed by the availableFunctions property. Default is true. These messages are used for the maintenance log display on the Commerce Administration pages. or through the Java API. This can be used in the case of very large catalogs to spread updates across several transactions. AGS_GENANCESTORS to generate ancestor categories. If this property is valued. If true.

ATG Commerce Programming Guide µ Item Type Categories: Property Names catalogs catalog ancestorCategories catalogs ancestorCategories parentCategoriesForCatalog catalogs ancestorCategories Products: SKUs: Available Functions AGS_GENCATALOGS: generates the catalog and catalogs properties AGS_GENPARENTCATS: generates the parentCategoriesForCatalog property AGS_GENANCESTORS: generates the ancestorCategories property CatalogVerificationService Component: /atg/commerce/catalog/custom/CatalogVerificationService The CatalogVerificationService verifies/validates various relationships between catalog items. See CatalogUpdateService computeSubCatalogs) fixedRelatedCategories categoryInfos parentCategory Categories Products fixedRelatedProducts catalogsRelatedProducts productInfos parentCategoriesForCatalog fixedReplacementProducts catalogsReplacementProducts skuInfos SKUs 105 6 .Using the Catalog Maintenance System . Item Type Catalogs Property Names ancestorCategories allRootCategories directAncestorCatalogsAndSelf indirectAncestorCatalogs subCatalogs (only if configured to use. It validates the following property values for each catalog item type.

which can afterwards be maintained by CatalogCompletionService. This service can be run in a versioned ATG instance. this service can be used to batch update them on an as-needed basis. but in batch mode. Because the CatalogCompletionService can be disabled and may not be actively updating the catalog property values in real time. If you use startSQLRepository to import catalog data. Item Type Catalog Property Names directAncestorCatalogsAndSelf indirectAncestorCatalogs ancestorCategories allRootCategories subCatalogs(optional) parentCatalog parentCategory Categories Available Functions CUS_UPDATECATALOGS: Updates all item properties in the catalog CatalogMaintenanceService Component: /atg/commerce/catalog/CatalogMaintenanceService This component is an extension of a standard batch service. 106 6 .Using the Catalog Maintenance System . This service updates the following property values for each of the catalog item types. you can run this service immediately after the import to compute all properties.µ Available Functions ATG Commerce Programming Guide CVS_VERIFYCATALOGS: verifies catalog item properties CVS_VERIFYCATEGORIES: verifies category item properties CVS_VERIFYPRODUCTS: verifies product item properties CVS_VERIFYSKUS: verifies SKU item properties CatalogUpdateService Component: /atg/commerce/catalog/custom/CatalogUpdateService The CatalogUpdateService updates the same catalog properties that are updated by the dynamic service CatalogCompletionService. It is a container of other batch maintenance services. It provides a single point of access to other batch services and a consolidated view of their processing results.

so that changes to these item types can also trigger catalog maintenance services. Additional property information: Property availableServices Description An array of Nucleus paths to each contained service component. If you have created custom subtypes based on these item types. Each component is resolved by path and added to the servicesMap property.myCustomDesc2 For general information on ATG Content Administration. which can be viewed from the Commerce Administration pages. The CatalogMaintenanceService has a related /atg/epub/CatalogMaintenanceHelper component. categoryInfo. Note that the viewable history log is maintained only in memory and is discarded after a recycle of the ATG server. Functions from any of the contained services can be selectively executed using the CatalogMaintenanceService. A consolidated list of all the availableFunctions provided by the contained services. This property is used to configure a default set of function names that are executed when none are provided. see the ATG Content Administration Programming Guide.ATG Commerce Programming Guide µ The CatalogMaintenanceService exposes the history log for each of its registered services. For example: extraTriggeringAffectedItemDescriptors+=myCustomDesc1. the component’s important property is extraTriggeringAffectedItemDescriptors. the standard catalog repository is updated. It can be any of the function names exposed by the availableFunctions property. sku. or through the Java API. catalogRepositories availableFunctions functionsToPerformBy Default Available Functions 107 6 . Therefore. For ATG Commerce purposes. you can add them to this property. If null. and skuInfo). the CatalogMaintenanceHelper listens for changes to standard catalog items (catalog. In the case of the CatalogMaintenanceService this property can contain any of the function names exposed by the contained services. it listens for ATG Content Administration deployments and runs catalog maintenance services automatically. as opposed to scheduling each service individually. productInfo. The ATG logs can be used as a historical reference to the service logs. A list of catalog keys that will be updated. category. this service can be scheduled to sequentially execute other services it contains.Using the Catalog Maintenance System . This component is used by installations that use ATG Content Administration to manage their catalogs. product. By default. such as categories and products. such as in schedule mode.

The default is to run all the functions of the CatalogUpdateService. ATG Commerce Programming Guide Running the Batch Services from the Commerce Admin Page Catalog Maintenance batch services should be run the in the staging environment. Catalog Verification This process verifies catalog component relationships for accuracy. Click on the Start Process button at the bottom of the Verify Catalog page. click on the Verify Catalog link. 108 6 . click on the Catalog Update link. The default configuration runs all the functions of the AncestorGeneratorService and CatalogVerificationService. Catalog Verification. this process should be used to batch update the appropriate property values. The catalog batch maintenance services are available from the Commerce Administration page.µ All functions available to the contained services. To run CatalogUpdateService from the Commerce Administration Page. For more information. To run CatalogVerficationService from the Commerce Administration Page. click on the Basic Catalog Maintenance link. Important note: If you are using custom catalogs and are running ATG Content Administration. For example. Basic Catalog Maintenance and View Status. When this service is enabled all updates to the catalog that are made using the ACC or the Repository API will trigger these properties to be computed and updated dynamically. it should be run after adding new categories. There are four options available on the menu. However. if the DCS catalog is updated outside of these processes or if the CatalogCompletionService is disabled. or SKUs. Click on the Start Process button at the bottom of the Basic Catalog Maintenance page. They should be run after any structural changes are made to the catalog. see the ATG Installation and Configuration Guide.Using the Catalog Maintenance System . you must configure one agent server on your target site cluster to run the Catalog Maintenance Service. see the Getting Started chapter of the ATG Merchandising User Guide. To run Basic Catalog Maintenance from the Commerce Administration Page. Click on the Start Process button at the bottom of the Catalog Update page. Catalog Update This CatalogUpdateService will batch update the catalog property values that are normally updated incrementally by the CatalogCompletionService. For more information on accessing the Dynamo Administration UI. Basic Catalog Maintenance This process will execute the standard batch maintenance services against the DCS catalog. products. Catalog Update. The default is to run all the functions of the CatalogVerficationService.

The status from the last execution displays. To view the status log from the Commerce Administration Page. 109 6 . 4. choose Component > Start Component. errors and warnings from the last execution of maintenance on the server. Choose File > Open Component. For example: Running a Batch Service from the ACC To use the ACC to execute a service 1. If the component is not currently running. The Component Editor opens. either /atg/commerce/catalog/custom/CatalogMaintenanceService (for custom catalogs) or /atg/commerce/catalog/CatalogMaintenanceService(for standard catalogs). select the component by path. 2. Select the Methods tab. In the Components > by Path window.ATG Commerce Programming Guide µ View Status The View status page let you view the information.Using the Catalog Maintenance System . click on the View Status link. 3.

Using the Catalog Maintenance System . then the View Status page is shown. passing a configurable set of functions for each available option. ATG Commerce Programming Guide Click the Invoke button next to the performService method. This form handler executes the CatalogMaintenanceService. The View Status can be refreshed to monitor the progress of the batch maintenance run. It is notified for each repository change made to a category or catalog item in the product catalog. The execution of the CatalogMaintenanceService is started in a new thread. Batch Maintenance Form Handler Component: /atg/commerce/catalog/RunServiceFormHandler There is one form handler that is used to execute the batch services from the Commerce Administration Pages.µ 5. or a program using the Repository API. As each 110 6 . • • • CatalogChangesListener CatalogCompletionService StandardCatalogCompletionService CatalogChangesListener Component: /atg/commerce/catalog/custom/CatalogChangesListener (for custom catalogs) or /atg/commerce/catalog/CatalogChangesListener (for standard catalogs) This component registers itself at deployment as a property changed listener for the product catalog. Property information: Property basicMaintenanceFunctions Description These are the function names passed to the CatalogMaintenanceService for the execution of the Basic Catalog Maintenance option These are the function names passed to the CatalogMaintenanceService for the execution of Verify Catalog option These are the function names passed to the CatalogMaintenanceService for the execution of Update Catalog option verifyFunctions updateFunctions Dynamic Services Dynamic Services consists of components that enable the catalog properties to be dynamically updated as the catalog structure is modified by an ACC user. BCC user.

When a product or category is made a child of another category. the service checks the former child’s parentCategories property. If the parentCategories list is empty.Using the Catalog Maintenance System . Running the Dynamic Services The dynamic service components are started automatically. Additional property information: Property computeSubCatalogs Description If true. parentCategory is set to null. Enabled True/False StandardCatalogCompletionService Component: /atg/commerce/catalog/StandardCatalogCompletionService This component updates catalog item property values in real time based on changes made to the product catalog repository. If parentCategory is set to the category that is no longer the parent.ATG Commerce Programming Guide µ change is made. CatalogCompletionService Component: /atg/commerce/catalog/custom/CatalogCompletionService (for custom catalogs) or /atg/commerce/catalog/CatalogCompletionService (for standard catalogs) This component updates catalog item property values in real time based on changes made to the product catalog repository. but remains available for backward compatibility. and assigns the first category in the list as the new parentCategory. When a product or category is removed as a child from a category. The subCatalogs property is no longer used by custom catalogs. the service checks the former child’s parentCategory. You can disable the CatalogCompletionService or the StandardCatalogCompletionService by setting the service’s 111 6 . The CatalogUpdateService also refers to this property to control updating of the subCatalogs property in real time. It is called by the CatalogChangesListener when changes are made to the product catalog repository. Refer to the CatalogUpdateService for a list of properties that are maintained by this service. the parentCategory of the new child is automatically set to the new parent if the child’s parentCategory property is null. it calls the CatalogCompletionService to make dynamic updates to the appropriate catalog item property values. The StandardCatalogCompletionService updates the parentCategory property for product and category items. It is called by the CatalogChangesListener when changes are made to the product catalog repository. the catalog item’s subCatalogs property will be updated.

If you set the enabled property to false.Using the Catalog Maintenance System .µ ATG Commerce Programming Guide enabled property to false. but they do not do anything if called. the components still start up with ATG Commerce. 112 6 .

In this adapter. wish lists. address books. Also describes the extensions related to the ATG Commerce Property Manager. • • Profile Repository Extensions The Personalization module’s Profile Repository is an instance of the Generic SQL Adapter. phone number. This user has many general attributes defined. promotions. Removing or modifying the profile additions may require modifying logic in ATG Commerce. city. credit card collection and other features. postal code. address books. such as first and last name. credit card collection and other minor features. This chapter includes information on the following subjects: • Profile Repository Extensions: Describes the attributes that ATG Commerce adds to the user Item Descriptor to support gift lists. Components of ATG Commerce rely on these extensions to perform their logic. which provides additional access to profile property names specific to Commerce customers that are used by CommerceProfileTools. Promotions Three attributes manage promotions for each user: 113 7 .ATG Commerce Programming Guide µ 7 ATG Commerce Profile Extensions ATG Commerce extends the profile configuration and classes of the Personalization module in several ways to add functionality. Associated with the user definition is an item type created for contact information (contactInfo) which encapsulates fields such as address. Profile Form Handler Extensions: Describes the ATG Commerce profile form handler extensions. state. It is located in /atg/userprofiling/ProfileAdapterRepository. wish lists. which provide additional methods to access commerce specific profile properties such as shipping and billing addresses and credit card information. See the Standard User Profile Repository Definition section of the Setting Up a Profile Repository chapter in the ATG Personalization Programming Guide for more information on the attributes included. e-mail address. date of birth and home address. promotions. Profile Tools and Property Manager Extensions: Describes the extensions related to the ATG Commerce profile tools.ATG Commerce Profile Extensions . the Personalization module defines a base “user” Item Descriptor. ATG Commerce adds several attributes to the user Item Descriptor to support gift lists.

commerce. The session-scoped PricingModelHolder component (/atg/commerce/pricing/UserPricingModels) asks the item. which defines the getPricingModels method. inactivePromotions: Stores promotions that can no longer be used. The user can create nicknames for other addresses and store those as the key/value pairs in the secondaryAddresses map. A promotion would be moved into the inactive list if it was created with a limited number of uses and the user had reached the threshold. shipping. The billing and shipping address is a contactInfo and the secondary addresses are a map of contactInfo objects. which comes from the activePromotions attribute. tax and order pricing engines to retrieve what promotions should be available for pricing. ATG Commerce Programming Guide activePromotions: Stores the list of promotions that can be used by the user in usedPromotions: Stores any promotions used in an order. Address Books Three attributes are defined as part of the address book: billingAddress.µ • • • pricing their orders. The implementation of this method returns a combined collection of global and user promotions. Credit Card Collection The Commerce profile extensions also include defining a new credit-card item type.ATG Commerce Profile Extensions . Each of these collection attributes has a component item type of ‘promotion’ which is defined in the Product Catalog repository /atg/commerce/catalog/ProductCatalog. Gift Lists and Wish List Three attributes manage gift lists for each user: • • Wishlist: Stores the index to the default wish list created for a user. shippingAddress and secondaryAddresses.PricingEngine interface. Giftlists: Stores the list of gift lists created by a user when they register an event. 114 7 . A credit card includes the following attributes: • • • • • • creditCardNumber creditCardType expirationMonth expirationDayOfMonth expirationYear billingAddress The user definition includes defaultCreditCard and creditCards map attribute. Each pricing engine implements the atg.pricing. It is intended that the billingAddress and shippingAddress attributes are for “default” address values for the user.

These are registries of other customers that have been accessed by the customer using the gift list search feature. If your site supports multiple shipping groups.commerce. During the registration and login process. For example.userprofiling. The giftlist repository is located in /commerce/gifts/Giftlists. the anonymous user’s active promotions are copied into the list of active promotions of the persistent user. Profile Tools and Property Manager Extension The ATG Commerce profile tools class (atg.commerce. In the associated JSPs use a <setvalue> call to set the current location. • allowPartialShipment: This Boolean value can be used as the user’s default setting for allowing partial shipments.g. some items are backorderId). you can give the customer the option of allowing a shipping group to be automatically split if some items cannot be shipped together (e. For example. any shopping carts (Orders) created before logging in are changed to be persistent.profile. See the Configuring the Order Fulfillment Framework chapter for information on allowing partial shipments. these shopping carts are loaded into the user’s session.userprofiling. For more information on gift lists and wish lists. currentLocation: This is an enumerated attribute to be used with targeting.ATG Commerce Profile Extensions . During login. The ATG Commerce 115 7 . If the user’s persistent profile contains any old shopping carts (Orders in an incomplete state).ATG Commerce Programming Guide µ • OtherGiftlists: Stores the list of gift lists from which a customer is currently shopping. postCreateUser and postLoginUser methods from the ProfileFormHandler.currentLocation" value="home"/> Profile Form Handler Extensions The ATG Commerce profile form handler (atg.CommerceProfileTools) is a subclass of atg. It performs operations specific to Commerce.ProfileTools. It provides additional methods to access commerce specific profile properties such as shipping and billing addresses and credit card information. Other Features The following list contains some other attributes that are used through out the commerce system. an anonymous user can accumulate promotions in their activePromotions attribute. After log in.CommerceProfileFormHandler) is a subclass of atg. see the Configuring Merchandising Services chapter. <dsp:setvalue bean="Profile. These operations are performed by overriding the addPropertiesOnLogin. • • daytimeTelephoneNumber: The user’s daytime telephone number. the PricingModelHolder component is reinitialized to cache all the promotions that the persistent user has accumulated during previous sessions. Each attribute has a component item type of gift-list defined in the Giftlist Repository.ProfileFormHandler.profile.

This provides a convenient central location to store property names that may change depending on the site.µ ATG Commerce Programming Guide Property Manager (atg.userprofiling. This extension of the tools component provides methods to create. It provides additional access to profile property names specific to Commerce customers that are used by CommerceProfileTools. These different shipping addresses are managed by the CommerceProfileTools component. The shipping address property names are stored in CommercePropertyManager.CommercePropertyManager) is a subclass of atg. For example.PropertyManager.profile. delete and update profile repository shipping addresses as well as to retrieve all shipping addresses. a registered Commerce customer may have multiple shipping addresses. 116 7 .commerce.ATG Commerce Profile Extensions .

commerce. Setting Up Gift Certificates and Coupons Enables customers to purchase and use gift certificates and redeem coupons. Customers c an create an unlimited number of gift lists for themselves. such as birthdays or weddings. This section describes how to implement these lists. Setting Up Gift Lists and Wish Lists Gift lists are lists of items selected by a site visitor. Part of the purchase process allows for special handling instructions for gift purchasing. A wish list is actually a gift list that is accessible to only the person who created it. for example. Customers can use gift lists to register for events. wrapping. and they can purchase items from their wish lists at any time. The following scenarios demonstrate how gift lists can be used on a commerce site. address security.ATG Commerce Programming Guide µ 8 Configuring Merchandising Services This chapter includes the following information on ATG Commerce merchandising services: Setting Up Gift Lists and Wish Lists Customers can use gift lists and wish lists to create lists of items for future purchase. As wish lists Customers can use wish lists to save lists of products without placing the items in their shopping carts. • The gift list class package is atg. Joseph Smith logs onto the site and creates a list of gifts he would like to receive 117 8 . Refer to the ATG API Reference for more information on the associated classes and programming interfaces.Configuring Merchandising Services . and shipping. Customers can access their wish lists every time they log into their accounts. Example of Using a Gift List The following scenario describes how a site customer can use a gift list while shopping on the Pioneer Cycling Store Web site. All customers have one default wish list. Gift lists can be used in two ways: • As gift lists Gift lists are lists of products that other site visitors can view. This section describes how to implement comparison lists.gifts. Setting Up Product Comparison Lists Comparison lists enable customers to make side-by-side comparisons of different products and SKUs.

These classes consist of a GiftlistManager and GiftlistTools. The gift list functionality is broken down into the following sub-areas. these components support adding an item from a gift list to a shopping cart and updating the Giftlists repository at checkout. They provide the interface between the UI and the business layer classes to create and edit gift lists. Mike can send the item to his own address or send it directly to Joseph. • Gift List Form Handlers and Gift List Servlet Beans: The form handlers and servlet beans provide an interface to the Giftlists repository. Mike. During the checkout process.µ ATG Commerce Programming Guide for his birthday. However. Gift List Repository: The repository definition maps the Giftlists repository to database tables. Mike decides to purchase the other inner tube for Joseph and adds it to his cart. Mike sees that Joseph needs two new inner tubes for his bike. They provide an interface between the customer and the manager classes with access to the Giftlists repository. Forms (or JSPs) use these handlers to take input from the user and call methods to perform actions on the Giftlists repository. Disabling the Gift List Repository: Describes how to disable the Giftlists repository. Example of Using a Wish List The following scenario describes how a site customer uses a wish list while shopping on the Pioneer Cycling Store Web site. This section describes what steps to take if extending the system is necessary. browses the store and finds a bike and many accessories she would like to purchase. Gift List Business Layer Classes: Business layer classes contain the logic for gift list creation and manipulation. Mike can see that someone has already purchased one of the inner tubes. Each of these sub-areas is described in detail later in this section. or event type. The gift list now reflects that two inner tubes have been purchased for Joseph. then visits the site and searches for “Joseph Smith. A wish list is not searchable or visible by other customers of the store. Purchase Process Extensions to Support Gift Lists: The purchase process has been extended to support purchasing gifts from published gift lists. she can view her wish list. The remaining items are saved in the wish list for later visits. She can buy the bike and helmet by moving them to her shopping cart. The next time she visits the site. A customer. The business layer classes access the gift lists through the repository layer. Joseph’s friend. • • • • • Gift List Form Handlers Form handlers process forms and pages. event name.Configuring Merchandising Services . Disable the repository if you are not going to use the gift list functionality. This section describes the components that are used to support this functionality. It serves only as a holder of items the customer has found. For example. The store returns a list of gift lists found. Sally can add the items to her default private wish list and save the list. Sally. but can not afford to buy at the time. Mike selects the correct list and views the items that Joseph selected. you can extend this functionality if needed. Extending gift list functionality: Gift list functionality provided in ATG Commerce supports most requirements of commerce sites. For more 118 8 .” Mike can use advanced search criteria to refine his search by including a state.

Some handle methods have pre and post methods defined to simplify extending the methods to add functionality. eventName. description) Navigation properties Navigation properties are used to tell Dynamo to what pages to redirect after an action is performed. The tools component to provide low level operations on the catalog. The site customer should be able to enter information on different pages to configure the same gift list. update and delete gift lists. The GiftlistFormHandler.Configuring Merchandising Services . This section describes the following gift list form handlers: • • GiftlistFormHandler GiftlistSearch GiftlistFormHandler The GiftlistFormHandler provides the primary interface between the customer and the Giftlists repository. CommerceProfileTools Giftlist properties (for example. as well as to store success and failure URLs for redirect after processing. as well as to add items to gift lists. GiftlistFormHandler Submit Handle Methods The GiftlistFormHandler has the following handle and support methods: 119 8 . like most form handlers. Property GiftlistManager CatalogTools Function The manager component to interface with the repository. see the Working with Forms and Form Handlers chapter in the ATG Programming Guide and the Using Repository Form Handlers chapter in the ATG Page Developer’s Guide. Both success and failure URL properties are provided. should be session-scoped because multiple pages usually gather the information needed for gift list management. This handler accepts input from the customer to create. GiftlistFormHandler Properties The GiftlistFormHandler has the following properties that support the management of gift lists and items in the repository. Giftlist properties to store information entered by the customer to use for management of attributes.) Properties in the handler are used to store user input for processing. eventDate. The tools component to provide low level operations on the commerce specific profile. (See GiftitemDroplet in Gift List Servlet Beans for information on how to remove items from gift lists.ATG Commerce Programming Guide µ information on form handlers.

The default implementation is empty. It calls createGiftlist in the manager class with gift list properties to create a gift list in the repository. Then it checks if the item already exists in the giftlist. The default implementation is empty. save properties and add the gift list to the customer’s profile. Executed at the start of the handleSaveGiftlist method. it adds the item to the gift list by calling addItemToGiftlist in the manager class with the correct parameters. The default implementation is empty. It calls updateGiftlist in the manager class with gift list properties to update a particular gift list in the repository. Updates the current gift list. Executed at the end of the handleSaveGiftlist method. If it does. This method provides a way to extend the functionality of this form handler. The default implementation is empty. This method provides a way to extend the functionality of this form handler. handleCreateGiftlist handleDeleteGiftlist Creates a new Giftlist object. This method provides a way to extend the functionality of this form handler.µ Method handleAddItemToGiftlist ATG Commerce Programming Guide Function Adds items to a gift list during the shopping process. handleSaveGiftlist handleUpdateGiftlist preAddItemToGiftlist preSaveGiftlist postAddItemToGiftlist postSaveGiftlist 120 8 . it increments the desired quantity. This method performs a few steps to add the item. It looks up the product in the repository by skuId. If it does not. It takes the skuId. Deletes a gift list from the user’s profile and from the repository. It calls removeGiftlist in the manager class with the profileId and giftlistId to remove it from the repository. Executed at the start of the handleAddItemToGiftlist method. Creates and saves gift lists in the Giftlists repository.Configuring Merchandising Services . This method provides a way to extend the functionality of this form handler. quantity and giftlistId from the form. Executed at the end of the handleAddItemToGiftlist method.

Each operation has its own SuccessURL and ErrorURL properties. This file is located at /atg/commerce/gifts/ in <ATG9dir>/DCS/config/config. These properties specify the URLs to which to redirect on certain error and success conditions.gifts. $class=atg. For example. If the value for a particular condition is not set.commerce.jar. saveGiftlist. you can redirect the customer to pages other than those specified by the form’s action attribute.properties file is used to configure the GiftlistFormHandler. The GiftlistFormHandler has a set of properties you can use to control navigation after a form operation. For example. addItemToGiftlist) is completed.defaultLocale # Giftlist repository 121 8 . if an attempt to create a gift list fails.jsp " type="hidden"/> GiftlistFormHandler Example The GiftlistFormHandler. you could redirect the customer to a page explaining what missing information caused the failure.ATG Commerce Programming Guide µ GiftlistFormHandler Navigation Properties After a form operation (createGiftlist. you can set the addItemToGiftlistSucessURL property with this tag: <dsp:input bean="GiftlistFormHandler./user/lists.. The properties available include the following: • • • • • • • • createGiftlistSuccessURL createGiftlistErrorURL saveGiftlistSuccessURL savlleGiftlistErrorURL deleteGiftlistSuccessURL deleteGiftlistErrorURL addItemToGiftlistSuccessURL addItemToGiftlistErrorURL The value of each of these properties is a URL relative to the action page of the form. This page’s content depends on the type of form operation and whether the operation succeeded or not. no redirect takes place and the form is left on the page defined as the action page.addItemToGiftlistSucessURL" value=".Configuring Merchandising Services .GiftlistFormHandler $scope=session # Profile properties profile=/atg/userprofiling/Profile defaultLocale^=/atg/commerce/pricing/PricingTools. Either you can specify the values of these URL properties in the properties of the form handler or you can set them in the JSP itself using a hidden tag attribute.

µ
giftlistRepository=Giftlists # Business layer giftlist manager giftlistManager=GiftlistManager

ATG Commerce Programming Guide

# Business layer order manager orderManager=/atg/commerce/order/OrderManager shoppingCart=/atg/commerce/ShoppingCart pipelineManager=/atg/commerce/PipelineManager # commerce tools giftlistTools=GiftlistTools catalogTools=/atg/commerce/catalog/CatalogTools profileTools=/atg/userprofiling/ProfileTools # giftlist properties itemType=gift-list

The following code sample demonstrates how to use the GiftlistFormHandler in a template. This serves as an example of how to display error messages, set up input and URL properties and make calls to handle methods in the form handler.

<!-Import statements for components--> <dsp:importbean <dsp:importbean <dsp:importbean <dsp:importbean <dsp:importbean bean="/atg/commerce/gifts/GiftlistFormHandler"/> bean="/atg/dynamo/droplet/ForEach"/> bean="/atg/dynamo/droplet/Switch"/> bean="/atg/dynamo/droplet/IsEmpty"/> bean="/atg/userprofiling/Profile"/>

<!-- Display any errors processing form --> <dsp:droplet name="/atg/dynamo/droplet/Switch"> <dsp:param bean="GiftlistFormHandler.formError" name="value"/> <dsp:oparam name="true"> <font color=cc0000><STRONG><UL> <dsp:droplet name="/atg/dynamo/droplet/ErrorMessageForEach"> <dsp:param bean="GiftlistFormHandler.formExceptions" name="exceptions"/> <dsp:oparam name="output"> <LI> <dsp:valueof param="message"/> </dsp:oparam> </dsp:droplet> </UL></STRONG></font> </dsp:oparam> </dsp:droplet> <!-Save giftlist --> <dsp:form action="lists.jsp" method="POST"> <!-Success and error URLs -->

122
8 - Configuring Merchandising Services

ATG Commerce Programming Guide

µ

<dsp:input bean="GiftlistFormHandler.saveGiftlistSuccessURL" value="./lists.jsp" type="hidden"/> <dsp:input bean="GiftlistFormHandler.saveGiftlistErrorURL" value="./new_list.jsp" type="hidden"/> <b>Event Name</b><br> <input size="40" value='<dsp:valueof bean="GiftlistFormHandler.eventName"/>' type="text"> <p> <b>Event Type</b> <dsp:select bean="GiftlistFormHandler.eventType"> <dsp:droplet name="ForEach"> <dsp:param bean="GiftlistFormHandler.eventTypes" name="array"/> <dsp:oparam name="output"> <dsp:getvalueof id="option76" param="element" idtype="java.lang.String"> <dsp:option value="<%=option76%>"/> </dsp:getvalueof><dsp:valueof param="element">UNDEFINED</dsp:valueof> </dsp:oparam> </dsp:droplet> </dsp:select><br> <p> <b>Event Description</b><br> <dsp:setvalue bean="GiftlistFormHandler.description" value=""/> <dsp:textarea bean="GiftlistFormHandler.description" value="" cols="40" rows="4"></dsp:textarea> <p> <b>Where should people ship the gifts?</b><p> <dsp:select bean="GiftlistFormHandler.shippingAddressId"> <!-display address nicknames for profile to select from --> <dsp:droplet name="ForEach"> <dsp:param bean="GiftlistFormHandler.addresses" name="array"/> <dsp:oparam name="output"> <dsp:getvalueof id="option117" param="key" idtype="java.lang.String"> <dsp:option value="<%=option117%>"/> </dsp:getvalueof><dsp:valueof param="element">UNDEFINED</dsp:valueof> </dsp:oparam> </dsp:droplet> </dsp:select><br> <table width=100% cellpadding=0 cellspacing=0 border=0> <tr><td class=box-top-store>Gift list public?</td></tr></table> <p> <dsp:input bean="GiftlistFormHandler.isPublished" value="true" type="radio" name="published"/> Make my list public now<br> <dsp:input bean="GiftlistFormHandler.isPublished" value="false" checked="<%=true%>" type="radio" name="published"/> Don't make my list public yet <dsp:input bean="GiftlistFormHandler.saveGiftlist" value="Save gift list" type="submit"/>

123
8 - Configuring Merchandising Services

µ
GiftlistSearch

ATG Commerce Programming Guide

The GiftlistSearch form handler searches the repository for gift lists. The handler uses input from the customer, such as owner name, event name, event type and state, to find gift lists published by other customers. It returns a list of gift lists that match the given criteria. Like most form handlers, GiftlistSearch should be session-scoped because multiple pages are typically involved in gathering and displaying information for gift list searching. This form handler uses supporting servlet beans to add the retrieved gift lists to the customer’s profile and to display gift list contents.
GiftlistSearch is configurable to support all gift list searching requirements. Booleans specify what

searching is done. The configurable searches include: • • • Name Search: Searches by the name of the gift list owner. Properties Search: Searches for matches of specific gift list properties (such as event name, event type, and owner’s state). Published List Search: Searches for both published and unpublished gift lists by turning doPublishedSearch to false in the configuration file.

GiftlistSearch Properties
GiftlistSearch has the following properties to support gift list searching:

Property
doNameSearch doAdvancedSearch

Function Specifies if searching by name. Specifies if searching gift lists by advanced properties. Advanced search property names. Specifies if searching only published gift lists. Input text parsed for searching.
Giftlist repository items found based on

advancedSearchPropertyNames doPublishedSearch searchInput searchResults

searching criteria.

GiftlistSearch Submit Handle Methods
GiftlistSearch has the following handle submit method:

124
8 - Configuring Merchandising Services

ATG Commerce Programming Guide

µ

Method
handleSearch

Function
handleSearch provides the core functionality of this form. It uses the

configuration set in the properties file to build its query string. This method builds the query based on the configuration and applies it to the Giftlists repository to find a list of gift lists. The list is stored in the results property for the form to display.

GiftlistSearch Example The following properties file is used to configure the GiftlistSearch form handler. This properties file is located at /atg/commerce/gifts/GiftlistSearch.properties in /<ATG9dir>/DCS/config/config.jar.

$class=atg.commerce.gifts.SearchFormHandler $scope=session doNameSearch=true nameSearchPropertyNames=owner.firstName,owner.lastName doAdvancedSearch=true advancedSearchPropertyNames=eventType,eventName,state doPublishedSearch=true publishedSearchPropertyNames=public,published giftlistRepository=Giftlists itemTypes=gift-list

The following code sample demonstrates how to use GiftlistSearch in a template. It is only one example of how it might be used to search for gift lists.
giftlist_search.jsp:

<!-Import statements for form components> <dsp:importbean bean="/atg/commerce/gifts/GiftlistSearch"/> <dsp:importbean bean="/atg/dynamo/droplet/IsEmpty"/> <dsp:importbean bean="/atg/dynamo/droplet/ForEach"/> <dsp:importbean bean="/atg/dynamo/droplet/Switch"/> <TITLE>Giftlist Search</TITLE> <dsp:form action="giftlist_search.jsp"> <p> <b>Find someone's gift list</b> <hr size=0>

125
8 - Configuring Merchandising Services

µ

ATG Commerce Programming Guide

Name: <dsp:input bean="GiftlistSearch.searchInput" size="30" type="text"/> <p> Optional criteria that may make it easier to find the right list: <p> <dsp:droplet name="ForEach"> <!-- For each property specified in GiftlistSearch.advancedSearchPropertyNames, retrieve all possible property values. This allows the customer to pick one to search on for advanced searching. --> <dsp:param bean="GiftlistSearch.propertyValuesByType" name="array"/> <dsp:oparam name="output"> <dsp:droplet name="Switch"> <dsp:param param="key" name="value"/> <!-- One property that a product in the store can have is weight range. In this case, if the property is weight range, we want to put all possible choices in a pulldown menu. --> <dsp:oparam name="eventType"> Event Type <!-- property to store the customer's selection is propertyValues -> <dsp:select bean="GiftlistSearch.propertyValues.eventType"> <dsp:option value=""/>Any <dsp:setvalue paramvalue="element" param="outerelem"/> <dsp:droplet name="ForEach"> <dsp:param param="outerelem" name="array"/> <dsp:oparam name="output"> <dsp:option/><dsp:valueof param="element">UNDEFINED</dsp:valueof> </dsp:oparam> </dsp:droplet> </dsp:select><br> </dsp:oparam> <dsp:oparam name="eventName"> <b>Event Name <!-- property to store the customer's selection is propertyValues -> <dsp:input bean="GiftlistSearch.propertyValues.eventName" size="30" value="" type="text"/> <br> </dsp:oparam> <dsp:oparam name="state"> <b>State <!-- property to store the customer's selection is propertyValues -> <dsp:input bean="GiftlistSearch.propertyValues.state" size="30" value="" type="text"/> <br> </dsp:oparam> </dsp:oparam> </dsp:droplet> </dsp:droplet>

126
8 - Configuring Merchandising Services

ATG Commerce Programming Guide

µ

<p> <dsp:input bean="GiftlistSearch.search" value="Perform Search" type="hidden"/> <dsp:input bean="GiftlistSearch.search" value="Perform Search" type="submit"/> </dsp:form>

Gift List Servlet Beans
Several servlet beans are provided to support gift list and wish list functionality. These servlet beans can be used with forms to look up gift lists and gift items, as well as to perform actions, such as removing or purchasing items from a gift list, adding gift lists to a profile, and removing gift lists from a profile.

Lookup Servlet Beans
The GiftlistLookupDroplet and GiftitemLookupDroplet servlet beans, located in Nucleus at /atg/commerce/gifts/, are instances of class atg.repository.servlet.ItemLookupDroplet. These servlet beans provide a way to search for and display gift lists and gift items in the Giftlists repository based on ID. For information about the input, output, and open parameters of servlet beans instantiated from ItemLookupDroplet, refer to Appendix B: ATG Servlet Beans in the ATG Page Developer’s Guide. The following code example demonstrates how to use the GiftlistLookupDroplet to look up a gift list in the repository and check that the owner ID equals the ID of the current profile before displaying the gift list.

<dsp:droplet name="/atg/commerce/gifts/GiftlistLookupDroplet"> <dsp:param param="giftlistId" name="id"/> <dsp:oparam name="output"> <dsp:droplet name="IsEmpty"> <dsp:param param="element" name="value"/> <dsp:oparam name="false"> <dsp:setvalue paramvalue="element" param="giftlist"/> <dsp:droplet name="/atg/dynamo/droplet/Switch"> <dsp:param bean="Profile.id" name="value"/> <dsp:getvalueof id="nameval2" param="giftlist.owner.id" idtype="java.lang.String"> <dsp:oparam name="<%=nameval2%>"> </dsp:oparam> </dsp:getvalueof> </dsp:droplet> </dsp:oparam> </dsp:droplet> </dsp:oparam> </dsp:droplet>

127
8 - Configuring Merchandising Services

µ
GiftlistDroplet

ATG Commerce Programming Guide

The GiftlistDroplet servlet bean (class atg.commerce.gifts.GiftlistDroplet), which is located in Nucleus at /atg/commerce/gifts/, adds or removes customer A’s gift list from customer B’s otherGiftlists Profile property, depending on the action supplied via the action input parameter. GiftlistDroplet is used in the Pioneer Cycling Reference Application to associate and disassociate gift lists created by others to a given customer. This enables the given customer to easily find those for whom the customer has shopped or is shopping.
GiftlistDroplet takes the following input parameters:

• • •

action: The action to perform on the gift list (“add” or “remove”). (Required) giftlistId: The ID of the gift list. (Required) profile: The profile of the current customer. If not passed, the profile will be resolved

by Nucleus.
GiftlistDroplet doesn’t set any output parameters. It renders the following open parameters

(oparams): • •
output: The oparam rendered if the gift list is added or removed successfully from a

profile.
error: The oparam rendered if an error occurs while adding or removing the gift list.

The following code example demonstrates how to use the GiftlistDroplet to add a gift list that was retrieved in a search to a customer’s profile.

<dsp:droplet name="/atg/dynamo/droplet/IsEmpty"> <dsp:param param="giftlistId" name="value"/> <dsp:oparam name="false"> <dsp:droplet name="/atg/commerce/gifts/GiftlistDroplet"> <dsp:param param="giftlistId" name="giftlistId"/> <dsp:param value="add" name="action"/> <dsp:param bean="/atg/userprofiling/Profile" name="profile"/> <dsp:oparam name="output">Output</dsp:oparam> <dsp:oparam name="error">Error</dsp:oparam> </dsp:droplet> </dsp:oparam> </dsp:droplet>

GiftitemDroplet
Servlet beans instantiated from class atg.commerce.gifts.GiftitemDroplet enable customers either to buy or to remove items from their own personal gift lists, depending on the configuration of the servlet bean. (For information on how to add items to a personal gift list, see GiftlistFormHandler. For information on how to buy items from another’s gift list, see CartModifierFormHandler.) Two Commerce servlet beans have been instantiated from GiftitemDroplet; they are BuyItemFromGiftlist and RemoveItemFromGiftlist. They take the following input parameters, both of which are required:

128
8 - Configuring Merchandising Services

ATG Commerce Programming Guide

µ

• •

giftId: The ID of the gift. giftlistId: The ID of the gift list.

They don’t set any output parameters. They render the following open parameters: • •
output: The oparam rendered if the item is bought or removed successfully from list. error: The oparam rendered if an error occurs during processing.

The following code example demonstrates how to use the RemoveItemFromGiftlist component to remove an item from a customer’s personal gift list.

<dsp:droplet name="/atg/dynamo/droplet/IsEmpty"> <dsp:param param="giftId" name="value"/> <dsp:oparam name="false"> <dsp:droplet name="/atg/commerce/gifts/RemoveItemFromGiftlist"> <dsp:param param="giftlistId" name="giftlistId"/> <dsp:param param="giftId" name="giftId"/> </dsp:droplet> </dsp:oparam> </dsp:droplet>

Gift List Business Layer Classes
The business layer classes contain the logic for managing gift lists and items. The methods within these classes are used to create, update, and delete selected gift lists for a given customer. The business layer components are the interface to the Giftlists repository. All calls to modify a gift list are made through these classes. Business layer objects include the following three classes: GiftlistManager and GiftlistTools. •
GiftlistManager: The majority of the functionality for gift list management exists in the GiftlistManager component. The class contains such methods as createGiftlist, updateGiftlist, addItemToGiftlist and removeItemFromGiftlist. These methods are higher level than those in GiftlistTools. It calls methods in the tools object to perform the lower level functionality (for example, repository access, property update). GiftlistTools: The GiftlistTools component is the low level interface and contains the logic for creating and editing gift lists in the repository. GiftlistTools is usually not called directly. It is usually called by the manager class to perform functionality on gift lists. This class defines repository item descriptors and property names and uses them to make updates to the repository.

Because these classes do not contain any state, it makes sense for them to exist as globally-scoped services in ATG Commerce. Rather than constructing a new object when required, ATG Commerce places one instance of each into the Nucleus hierarchy to be shared. They can be found in the hierarchy under: • •
GiftlistTools - /atg/commerce/gifts/GiftlistTools GiftlistManager - /atg/commerce/gifts/GiftlistManager

129
8 - Configuring Merchandising Services

µ
Gift List Repository

ATG Commerce Programming Guide

Note: Gift lists use the ClientLockManager component to control locks on repository items. The ClientLockManager prevents a deadlock situation or data corruption that could occur when multiple customers update the same gift list. The ClientLockManager is located at /atg/dynamo/service/ClientLockManager. See the Using Locking in Fulfillment section of the Fulfillment Framework chapter for more information on the ClientLockManager.

The Giftlists repository is the layer between ATG Commerce and the database server. It provides an interface to the database layer to persist gift list information. The Giftlists repository is a part of the Profile Adapter Repository that uses the SQL Repository implementation. For more information on SQL repositories, see the ATG Repository Guide. The Giftlists repository is defined in two configuration files: •
giftlists.xml defines the repository. It is located in ATG Commerce configpath at /atg/commerce/gifts/. This XML file defines gift lists and gift list item descriptors.

The Repository API uses this definition to save information in the database. •
userProfile.xml defines the relationship between users and gift lists. It is located in ATG Commerce configpath at /atg/userprofiling/. It adds properties to the user that provide maps to wish lists and gift lists.

The manipulation of gift lists and gift list items is performed using the GiftlistManager described in the Gift List Business Layer Classes section. The GiftlistManager provides methods to create, save, and update gift lists, as well as ones to create gift list items, remove them and move them to the shopping cart. The following XML files show how the repository is configured and mapped to the database schema. This file is located at /atg/commerce/gifts/giftlists.xml in <ATG9dir>/DCS/src/config/config.jar.

<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE taglib PUBLIC "-//Art Technology Group, Inc.//DTD General SQL Adapter//EN" "http://www.atg.com/dtds/gsa/gsa_1.0.dtd"> <gsa-template> <header> <name>Commerce Giftlists</name> <author>DCS Team</author> <version>$Id: giftlists.xml,v 1.5 2000/05/12 06:22:00 kmoy Exp $</version> </header> <!--

130
8 - Configuring Merchandising Services

ATG Commerce Programming Guide

µ

************************************************************* GiftList (also gift registries) ************************************************************* --> <item-descriptor name="gift-list"> <table name="dcs_giftlist" type="primary" id-column-name="id"> <property name="id"/> <property name="owner" item-type="user" repository="/atg/userprofiling/ProfileAdapterRepository" column-name="owner_id"/> <property name="public" data-type="boolean" column-name="is_public" default="false"/> <property name="published" data-type="boolean" column-name="is_published" default="false"/> <property name="eventName" data-type="string" column-name="event_name"/> <property name="eventDate" data-type="timestamp" column-name="event_date"/> <property name="eventType" data-type="enumerated" default="other" column-name="event_type"> <attribute name="useCodeForValue" value="false"/> <option value="valentine's day" code="0"/> <option value="wedding" code="1"/> <option value="bridal shower" code="2"/> <option value="baby shower" code="3"/> <option value="birthday" code="4"/> <option value="anniversary" code="5"/> <option value="christmas" code="6"/> <option value="chanukah" code="7"/> <option value="other holiday" code="8"/> <option value="i just want this stuff" code="9"/> <option value="other" code="10"/> </property> <property name="comments" data-type="string" column-name="comments"/> <property name="description" data-type="string" column-name="description"/> <property name="instructions" data-type="string" column-name="instructions"/> <property name="lastModifiedDate" data-type="timestamp" column-name="last_modified_date"/> <property name="creationDate" data-type="timestamp" column-name="creation_date"> <attribute name="useNowForDefault" value="true"/> </property> <property name="shippingAddress" item-type="contactInfo" repository="/atg/userprofiling/ProfileAdapterRepository" column-name="shipping_addr_id"/> </table> <table name="dcs_giftlist_item" type="multi"

131
8 - Configuring Merchandising Services

µ

ATG Commerce Programming Guide

id-column-name="giftlist_id" multi-column-name="sequence_num"> <property name="giftlistItems" data-type="list" component-item-type="gift-item" column-name="giftitem_id" cascade="delete"/> </table> </item-descriptor> <item-descriptor name="gift-item" display-property="displayName"> <table name="dcs_giftitem" type="primary" id-column-name="id"> <property name="id" column-name="id"/> <property name="catalogRefId" data-type="string" column-name="catalog_ref_id"/> <property name="productId" data-type="string" column-name="product_id"/> <property name="displayName" data-type="string" column-name="display_name"/> <property name="description" data-type="string" column-name="description"/> <property name="quantityDesired" data-type="long" column-name="quantity_desired"/> <property name="quantityPurchased" data-type="long" column-name="quantity_purchased"/> </table> </item-descriptor> </gsa-template>

The following section of code describes how gift lists are added to the user profile. The entire file is located at /atg/userprofiling/userProfile.xml in <ATG9dir>/DCS/config/config.jar.

<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE taglib PUBLIC "-//Art Technology Group, Inc.//DTD General SQL Adapter//EN" "http://www.atg.com/dtds/gsa/gsa_1.0.dtd"> <gsa-template> <header> <name>Commerce Related Profile Changes</name> <author>DCS Team</author> <version>$Id: userProfile.xml,v 1.24 2000/05/03 03:51:19 petere Exp $</version> </header> <item-descriptor name="user" default="true" sub-type-property="userType">

132
8 - Configuring Merchandising Services

ATG Commerce Programming Guide

µ

<!-- this is the key into private giftlist --> <table name="dcs_user_wishlist" type="auxiliary" id-column-name="user_id"> <property name="wishlist" item-type="gift-list" repository="/atg/commerce/gifts/Giftlists" column-name="giftlist_id" cascade="insert,update,delete"/> </table> <!-- this is the key into user created giftlists --> <table name="dcs_user_giftlist" type="multi" id-column-name="user_id" multi-column-name="sequence_num"> <property name="giftlists" data-type="list" component-item-type="gift-list" repository="/atg/commerce/gifts/Giftlists" column-name="giftlist_id" cascade="delete"/> </table> <!-- this is the key into giftlists found for other customers --> <table name="dcs_user_otherlist" type="multi" id-column-name="user_id" multi-column-name="sequence_num"> <property name="otherGiftlists" data-type="list" component-item-type="gift-list" repository="/atg/commerce/gifts/Giftlists" column-name="giftlist_id"/> </table> </gsa-template>

Purchase Process Extensions to Support Gift Lists
The ATG Commerce purchase process supports features such as browsing the catalog, adding items to a shopping cart, selecting payment methods, entering billing and shipping information, and the entire checkout process. To also support purchasing gifts off a gift list, components in the order package (atg.commerce.order) have been extended. To understand how gift lists work in ATG Commerce, it is important to know which components in the order package support this functionality. This section describes how order management and the purchasing process have been extended to support gift lists. (See the Configuring Purchase Process Services chapter for more information on the purchase process.) The following components provide gift list functionality to the purchase process: • • • •
CartModifierFormHandler GiftlistHandlingInstruction ShippingGroupDroplet and ShippingGroupFormHandler ProcUpdateGiftRepository

133
8 - Configuring Merchandising Services

µ

ProcSendGiftPurchasedMessage

ATG Commerce Programming Guide

CartModifierFormHandler
atg.commerce.order.purchase.CartModifierFormHandler is one class that provides the functionality to support shopping carts and the purchase process in ATG Commerce. More importantly, the addItemToOrder method of CartModifierFormHandler provides support for purchasing items that appear on gift lists. CartModifierFormHandler and the addItemToOrder method are described in Understanding the CartModifierFormHandler in the Configuring Purchase Process Services chapter.

Adding a gift item to an order is virtually the same as adding any item to an order. A gift item is distinguished by two additional form input fields, CartModifierFormHandler.giftlistId and CartModifierFormHandler.giftlistItemId. When these two fields contain non-null values, addItemToOrder calls addGiftToOrder in the GiftListManager component, which does additional processing for the gift as required by the purchase process. The following code sample demonstrates how to use the CartModifierFormHandler in a template for gifts. It is an example of how to set up input and URL properties and make calls to handle methods in the form handler. In this example, a customer is purchasing an item from another customer’s gift list and adding it to the shopping cart.

<dsp:droplet name="/atg/commerce/gifts/GiftlistLookupDroplet"> <dsp:param param="giftlistId" name="id"/> <dsp:param value="giftlist" name="elementName"/> <dsp:oparam name="output"> <table cellpadding=0 cellspacing=0 border=0> <tr> <td class=box-top-store> Get this gift for <dsp:valueof param="giftlist.owner.firstName">someone</dsp:valueof> </td> </tr> <tr> <td class=box> <dsp:form action="<%=request.getRequestURI()%>" method="post"> <input value='<dsp:valueof param="Product.repositoryId"/>' type="hidden" name="id"> <input type="hidden" name="itemType" value="Product"> <input value='<dsp:valueof param="Product.repositoryId"/>' type="hidden" name="itemId"> <dsp:input bean="CartModifierFormHandler.addItemToOrderSuccessURL" value="../checkout/cart.jsp" type="hidden"/> <dsp:input bean="CartModifierFormHandler.productId" paramvalue="Product.repositoryId" type="hidden"/> <dsp:input bean="CartModifierFormHandler.giftlistId" paramvalue="giftlist.id" type="hidden"/> <dsp:input bean="CartModifierFormHandler.giftlistItemId"

134
8 - Configuring Merchandising Services

ATG Commerce Programming Guide

µ

paramvalue="giftid" type="hidden"/> <dsp:droplet name="/atg/commerce/gifts/GiftitemLookupDroplet"> <dsp:param param="giftId" name="id"/> <dsp:param value="giftitem" name="elementName"/> <dsp:oparam name="output"> <dsp:input bean="CartModifierFormhandler.catalogRefIds" paramvalue="giftitem.catalogRefId" type="hidden"/> <dsp:valueof param="giftlist.owner.firstName">firstname</dsp:valueof> wants <dsp:valueof param="giftitem.quantityDesired">?</dsp:valueof> <dsp:valueof param="giftitem.catalogRefId">sku</dsp:valueof><br> and so far people have bought <dsp:valueof param="giftitem.quantityPurchased">?</dsp:valueof>. <p> </dsp:oparam> </dsp:droplet> Buy <dsp:input bean="CartModifierFormHandler.quantity" size="4" value="1" type="text"/> <dsp:input bean="CartModifierFormHandler.addItemToOrder" value="Add to Cart" type="submit"/> </dsp:form> </dsp:oparam> </dsp:droplet>

GiftlistHandlingInstruction
The GiftlistHandlingInstruction specifies what special handling needs to be done for a gift. For example, it could update gift list information to reflect that the item was purchased. A separate GiftlistHandlingInstruction could indicate that the gift should be wrapped. A GiftlistHandlingInstruction is created in the following sequence of events: When a person purchases an item off a gift list, CartModifierFormHandler calls addGiftToOrder in GiftlistManager. addGiftToOrder performs additional tasks to adding the item to an order. These tasks include: • • • Creating a new shipping group with the recipient’s address Adding that item(s) to the new shipping group Creating a GiftlistHandlingInstruction object for the item

For more information on Handling Instructions, see Setting Handling Instructions in the Configuring Purchase Process Services chapter.

ShippingGroupDroplet and ShippingGroupFormHandler
Your site may use ShippingGroupDroplet and ShippingGroupFormHandler to pull shipping information from the user’s profile and to allow the user to assign shipping addresses to items in an order.

135
8 - Configuring Merchandising Services

µ
ProcUpdateGiftRepository

ATG Commerce Programming Guide

Both of these components have been extended for gift lists so that shipping information for gift items is automatically preserved. See Adding Shipping Information to Shopping Carts in the Implementing Shopping Carts chapter of the ATG Commerce Guide to Setting Up a Store and Preparing a Complex Order for Checkout in the Configuring Purchase Process Services chapter for descriptions of these components.

A pipeline is an execution mechanism that allows for modular code execution. Pipelines are used in ATG Commerce to execute a series of tasks such as saving an order, loading an order and everything required during checkout. The PipelineManager used by ATG Commerce is located in /atg/commerce/PipelineManager. The commerce pipeline configuration file contains the definition for the processOrder chain. The ProcUpdateGiftRepository processor is added to the processOrder chain to support gift lists. It goes through the order and looks for a gift that has been added to the shopping cart. If one has been added, it updates the Giftlists repository to update the purchased count of items off the gift list.

ProcSendGiftPurchasedMessage
The ProcSendGiftPurchasedMessage processor is added to the processOrder chain. It goes through the order and looks for a gift that has been purchased. If one has been purchased, it sends a message that contains the order, gift and recipient profile to the Scenarios module. This message can be used to trigger an event such as sending an e-mail message to the recipient.

Extending Gift List Functionality
The ATG Commerce implementation of gift lists supports most of the requirements for this feature for a typical commerce site. However, gift list functionality can be extended, if necessary. This section describes how to extend gift list functionality by adding additional item properties to the gift-list item descriptor. The process includes the following basic steps: • • Updating the Database and Repository Definition Extending GiftlistFormHandler

Updating the Database and Repository Definition
You can extend your site’s gift list functionality by adding new gift-list item properties. To add new properties, do the following: 1. Modify your database schema and update the database script included with ATG Commerce. The script for gift lists is found in
<ATG9dir>/DCS/sql/db_components/database_vendor/user_giftlist_ddl.s ql.

2.

Extend the repository definition for gift lists by layering on a giftlists.xml file at /atg/commerce/gifts/ in your local configuration directory. This new file should add your new property to the gift-list item descriptor. As an example, the following XML example demonstrates how you might add the property giftlistStatus to the gift-list item descriptor.

136
8 - Configuring Merchandising Services

ATG Commerce Programming Guide

µ

<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE taglib PUBLIC "-//Art Technology Group, Inc.//DTD General SQL Adapter//EN" "http://www.atg.com/dtds/gsa/gsa_1.0.dtd"> <gsa-template> <header> <name>Commerce Giftlists</name> <author>Company XYZ</author> <version>$Id$</version> </header> <item-descriptor name="gift-list"> <property name="giftlistStatus" data-type="timestamp" column-name="giftlist_status"/> </item-descriptor> </gsa-template>

Note: You should only need to add to the schema and repository definition. Removing anything that is already there requires substantially more work.

Extending GiftlistFormHandler
After Updating the Database and Repository Definitions to support additional gift-list item properties, you also need to extend the GiftlistFormHandler component to support them. To do so, do the following: 1. Extend the class atg.commerce.gifts.GiftlistFormHandler to support your new properties and override related methods. The source code for this form handler can be found in <ATG9dir>\DCS\src\Java\atg\commerce\gifts. Note that most handlers in the GiftlistFormHandler have preXXX and postXXX methods that can be overridden to support your requirements. To support your new property, you should override the postSaveGiftlist method to save your new property value in the repository. 2. Layer on a GiftlistFormHandler.properties file to configure an instance of the new class you created in step 1. The contents of the configuration file would look similar to the following:
# MyNewGiftlistFormHandler # $class=xyz.commerce.gifts.MyNewGiftlistFormHandler

Disabling the Gift List Repository
If you are not going to use the Giftlists repository, you can disable it. This repository is represented by the /atg/commerce/gifts/Giftlist component. Disabling this repository prevents you from having to create the associated tables in your database. Perform the following steps to disable the Giftlists repository:

137
8 - Configuring Merchandising Services

µ
1. 2. 3.

ATG Commerce Programming Guide

Edit the /atg/registry/ContentRepositories component and remove the value in the initialRepositories property that references the /atg/commerce/gifts/Giftlist component. For more information, see the Configuring the SQL Repository Component section of the SQL Repository Reference chapter in the ATG Repository Guide. Edit the /atg/commerce/gifts/GiftlistTools component and set the giftlistRepository property to null. Edit the userProfile.xml file and remove properties that reference items in the Giftlists repository. The userProfile.xml file is located in the Commerce configuration layer. Remove the following lines:
<!-- this is the key into private giftlist --> <table name="dcs_user_wishlist" type="auxiliary" id-column-name="user_id"> <property category="Commerce - Lists" name="wishlist" item-type="gift-list" repository="/atg/commerce/gifts/Giftlists" column-name="giftlist_id"cascade="insert,update,delete" display-name="Wish list"/> </table> <!-- this is the key into user created giftlists --> <table name="dcs_user_giftlist" type="multi" id-column-name="user_id" multi-column-name="sequence_num"> <property category="Commerce - Lists" name="giftlists" data-type="list" component-item-type="gift-list" repository="/atg/commerce/gifts/Giftlists" column-name="giftlist_id" display-name="Gift list"/> </table> <!-- this is the key into giftlists found for other customers --> <table name="dcs_user_otherlist" type="multi" id-column-name="user_id" multi-column-name="sequence_num"> <property category="Commerce - Lists" name="otherGiftlists" data-type="list" component-item-type="gift-list" repository="/atg/commerce/gifts/Giftlists" column-name="giftlist_id" display-name="Other gift lists"/> </table>

4.

Remove the updateGiftRepository and sendGiftPurchased processors from the commerce pipeline. These processors are found in the processOrder pipeline chain. After these entries have been removed from the chain definition, create a link from the authorizePayment processor to the addOrderToRepository processor.

Setting Up Product Comparison Lists
Commerce sites often require the ability for a site user to compare items in the product catalog. A simple site may offer the user a single product comparison list and enable the user to add and remove products

138
8 - Configuring Merchandising Services

and so on). • ProductListHandler A form handler that manages product comparison lists.comparison.ATG Commerce Programming Guide µ from the list. ATG Commerce includes a session-scoped instance of ProductListHandler.commerce. located in Nucleus at /atg/commerce/catalog/comparison/ProductListContains. • ProductListContains A servlet bean that queries whether a product comparison list contains an entry for a specific product.comparison package: • ComparisonList A class that provides a generic data structure to maintain an ordered list of objects and an associated set of sort directives to apply when displaying the items. as well as an associated set of sort directives to apply when displaying the items in the list. The objects in the list may be of any Java class.commerce. SKU. ComparisonList atg. Like Java 139 8 . it enables the page developer to display product comparison information as a sortable table. a list to compare cameras. ATG Commerce includes a globally-scoped instance of ProductListContains.Configuring Merchandising Services .ComparisonList provides a generic data structure to maintain an ordered list of items that the user may want to compare. a different list to compare televisions. product. (You can extend the system to include additional information. as well as compare the properties of the products in the list. ATG Commerce provides a product comparison system that enables you to meet both simple and complex requirements. ATG Commerce includes a session-scoped instance of ProductComparisonList. located in Nucleus at /atg/commerce/catalog/comparison/ProductList. This section describes the default implementation of the product comparison system and includes the following subsections: • • • Understanding the Product Comparison System Extending the Product Comparison System Using TableInfo to Display a Product Comparison List Understanding the Product Comparison System The product comparison system consists of the following four classes in the atg.catalog. and inventory information. which the user can manipulate to change the sort criteria for the displayed information. located in Nucleus at /atg/commerce/catalog/comparison/ProductListHandler.catalog. A more complex site may offer the user multiple comparison lists to compare different types of items (for example. • ProductComparisonList A subclass of ComparisonList that provides an extended API for comparing product information.) Additionally. The default implementation of the product comparison system enables the user to compare any number of products and to do so using the products’ category.

Configuring Merchandising Services . Returns true if the comparison list contains the specified item. Removes an item from the comparison list if it was present in the list. it prohibits duplicate entries in the list by ignoring requests to add items that compare equal to items already in the list. For more information about the TableInfo component and how to use it to display sortable tables. Removes all items from the comparison list.service. user profiles.µ ATG Commerce Programming Guide List classes. Use ComparisonList when you want to compare sets of simple Java beans.util.TableInfo as a convenience to the developer. ATG Commerce includes a session-scoped instance of TableInfo. If you want to compare more complex objects. The following table describes the ComparisonList methods used to maintain a list of items to compare. Returns the number of items in the comparison list. ComparisonList maintains a property of type atg. see the Implementing Sortable Tables chapter in the ATG Page Developer’s Guide. ComparisonList maintains the insertion order of items in the list. repository items. you’ll want to subclass ComparisonList to be able to manage application-specific objects. Unlike List classes.Collections. For additional methods and details. clear containsItem getItem(n) getItems indexOf removeItem size ComparisonList internally synchronizes operations on the list. 140 8 . Returns the list of items being compared. or other self-contained objects. this provides an easy way to associate default table display properties with a comparison list. Note that if your application calls the getItems method to obtain a reference to the list. you should synchronize all operations on the list or call the java. as long as all changes to the list are made through the ComparisonList API.synchronizedList method to obtain a thread-safe version of the list upon which to operate.util. refer to the ATG API Reference. located in Nucleus at /atg/commerce/catalog/comparison/TableInfo. In cases where the comparison information will be displayed as a table. Returns the item at the specified index in the comparison list. This makes it possible for multiple request-scoped servlet beans and form handlers to operate safely on a shared session-scoped ComparisonList. returns -1 if the item does not appear in the list. Method addItem Description Adds an item to the end of the comparison list if the item isn’t already present in the list. or sets of objects against each other. Returns the index of the specified item in the comparison list.

you can either cast the objects to ProductComparisonList. which set and get various properties of the ProductComparisonList itself.Entry or use the DynamicBeans system to retrieve the product. you get back an array of Entry objects. • • • remove methods. When the add method or addAllSkus method is called. This method enables you to update the inventory information for the items when you render the page that displays the 141 8 . set and get methods. and inventory information from the Entry. providing an API designed to manage and compare products and SKUs. If no default parent category for the given product is set. which refresh the inventory information for the items in the ProductComparisonList. a different list to compare televisions. a list to compare cameras. When working with these objects in JSPs. product. SKU. The refreshInventoryData() method iterates over the items in the ProductComparisonList and loads updated inventory information into them. and inventory information about a product into a single object. a new Entry object is automatically constructed and added to the item list. then the given product’s first child SKU is used. or SKU information. if no category ID for the given product is specified. contains methods. then the sku property of the new Entry object is null. Similarly. category. If the product has no child SKUs. You can configure additional instances of ProductComparisonList in Nucleus to provide multiple comparison lists (for example. When you call ProductComparisonList’s addAllSkus method. ProductComparisonList uses the items property to store a list of Entry objects. The setRefreshInventoryData(String unused) method calls the refreshInventoryData() method. which remove entries from the list. SKU. a new Entry object for each SKU associated with the given product is automatically constructed and added to the item list. The API for ProductComparisonList The public API for ProductComparisonList can be divided broadly into the following four categories: • add methods. When working with these objects in Java. which add entries to the list. then the product’s default parent category is used. which query whether the list contains an entry matching specified product. you can refer to their properties in the same way you refer to the properties of any other Java bean. if no SKU is specified in the method call. Entry is an inner class defined by ProductComparisonList. it combines category. then the category property of the new Entry object is null.ATG Commerce Programming Guide µ ProductComparisonList ProductComparisonList extends ComparisonList. each of which represents a product or SKU that the user has added to her product comparison list. • set and refresh methods. When you call ProductComparisonList’s add method. When you call getItems on a ProductComparisonList.Configuring Merchandising Services . category. and so on).

For example. then the first SKU in the product’s childSkus list is used. See Extending the Product Comparison System for more information. This String parameter is useful for applications using catalog localization because it enables you to specify the product catalog to use when operating on a product comparison list. Refer to the ATG API Reference for additional information on the public API for ProductComparisonList. several methods of ProductComparisonList take an optional catalogKey parameter. and contains methods. to remove all entries for all products in a specified category. see ProductListHandler. you pass a key to CatalogTools. Additionally. If the product’s default parent category is unset. and SKU. product. RepositoryItem pSku) The createListEntry method is called to create a new list entry with a given category. you could use the following setvalue tag at the <setvalue bean="ProductList. To do so. The product’s SKU. remove. If the SKU is not set explicitly when the product is added to the list. Also note that there is one important protected method: Protected Entry createListEntry(RepositoryItem pCategory. If the category is not set explicitly when the product is added to the list. If the product has no child SKUs. The category of the product being compared. there are remove methods to remove all entries for a specific product. The various methods take different sets of arguments to support a wide range of application behaviors. RepositoryItem pProduct. which then uses the given key and its key-tocatalog mapping to select a product catalog repository.µ top of the page: ATG Commerce Programming Guide ProductComparisonList. then the product’s default parent category is used. The Entry Inner Class The public API for the Entry class exposes various properties that the page developer can display in a product comparison list or table.refreshInventoryData"> For related form handler methods. then the sku property is null. you can extend or replace the properties of the Entry object. The default implementation includes the following properties: Property Name product category Property Type RepositoryItem RepositoryItem Description The product being compared. There are several different variations on the add. and to remove the entry for a particular category/product/SKU combination. sku RepositoryItem 142 8 . By subclassing ProductComparisonList and overriding createListEntry. Through the catalogKey parameter. the category property is null.Configuring Merchandising Services .

you could modify the example in the following manner: columns=\ Product Name=productLink.Configuring Merchandising Services .productLinkForma t property.ATG Commerce Programming Guide µ The InventoryData object that describes the inventory status for the given product and SKU. inventoryInfo InventoryData productLink String However. Note: If you display the product comparison information in a table. (See the next section for more information on the InventoryData object. then the inventoryInfo property is null.template.\ Price=sku. you can use the productLink property in the configuration of the TableInfo object that maintains the table information.\ … Or. product.\ Price=sku.url?id=product.\ … For more information on the TableInfo component. as in the following example: columns=\ Product Name=productLink. 143 8 . similarly.) An HTML fragment that specifies an anchor tag that links to the product’s page in the catalog. repositoryId">product. see the Implementing Sortable Tables chapter in the ATG Page Developer’s Guide.listPrice. If the sku property is null or the inventory information isn’t available.listPrice. The default format for the link is <a href="product.displayName. to display the product link in a table column but sort the column on the product’s display name.displayName</a>. you can change the format by setting the ProductComparisonList.

A page developer can refer to the properties of the Entry objects using familiar JSP syntax. id Int A unique ID that names the list entry. you can change the format by setting the ProductComparisonList.displayName"/><br> Inventory: <dsp:valueof param="element.inventoryInfo. The default format for the link is <a href=category.getItems(id) in the Java code or by using <dsp:valueof bean="ProductList.category.displayName</a>. refer to Examples of Product Comparison Pages in the Implementing Product Comparison chapter of the ATG Commerce Guide to Setting Up a Store. for example.entries[id]"/> in the .µ categoryLink String ATG Commerce Programming Guide An HTML fragment that specifies an anchor tag that links to the category’s page in the catalog. the categoryLink property can be used in the configuration of a TableInfo component. However.template.url?id=category . See the description of the productLink property in this table for more information. Note: Like the productLink property.jsp page. with a form handler.categoryLinkForm at property.Configuring Merchandising Services . You can also use this property to delete specific entries.items" name="array"/> <dsp:oparam name="output"> <p>Product Name: <dsp:valueof param="element. For a JSP example. You can use this property to retrieve individual entries by calling ProductComparisonList.product.repositoryId>category.inventoryAvailabilityMsg"/><br> </dsp:oparam> </dsp:droplet> The InventoryData Inner Class 144 8 . as in the following example: <dsp:droplet name="ForEach"> <dsp:param bean="ProductComparisonList.displayName"/><br> Category: <dsp:valueof param="element.

Configuring Merchandising Services . Typically. set the ProductListHandler. which enables it to participate in session failover. the ProductListContains servlet bean queries whether a product comparison list includes the given product. ProductListHandler The ProductListHandler form handler manages product comparison lists. then ProductListContains looks for a list entry whose category property matches either the given product’s default category or null if there is no default category for the given product. located in Nucleus at /atg/commerce/catalog/comparison/ProductListHandler. ProductListContains When given a category. To do so. If the repositoryKey property is unset. If your application uses multiple instances of ProductComparisonList to manage multiple product comparison lists (for example. output. then ProductListContains looks for a list entry whose sku property matches either the given product’s first child SKU or null if there are no SKUs for the given product. and open parameters for ProductListContains.commerce. a list to compare cameras and a different list to compare televisions). • For a list of the input. The InventoryData object stores the inventory data for a given item in the product comparison list.commerce. If your application uses alternate product catalogs for different locales. unlike an InventoryInfo object.ProductComparisonList. ProductListContains behaves as follows: • If you don’t specify a category ID for the given product.repositoryKey property via a hidden input field in a form.catalog. you can specify a product ID with or without an accompanying category or SKU.ProductComparisonList. In the latter situation. 145 8 . refer to the ATG API Reference. However. and for JSP examples of how page developers can use ProductListContains.comparison. By default. then you may want to configure multiple instances of ProductListHandler to manage the contents of each list. It is configured to operate on the product comparison list located at /atg/commerce/catalog/comparison/ProductList. refer to the Implementing Product Comparison chapter of the ATG Commerce Guide to Setting Up a Store. CatalogTools uses the given key and its key-to-catalog mapping to select a product catalog repository. an InventoryData object is serializable.inventory.InventoryInfo).catalog.ATG Commerce Programming Guide µ The getInventoryInfo() method of the Entry inner class (class atg. you would set the ProductListHandler.repositoryKey property to the key to pass to CatalogTools. The behavior of ProductListContains parallels that of ProductComparisonList.comparison. and SKU. It returns a subset of the readable properties of an InventoryInfo object (class atg.Entry.InventoryData). then the default product catalog repository is used.Entry) returns an instance of the InventoryData inner class (class atg. you can specify the product catalog to use when operating on a product comparison list. ATG Commerce includes a session-scoped instance of ProductListHandler. Namely. product. If you don’t specify a SKU for the given product.commerce. For a list of InventoryData properties.

Adds all of the SKUs for all of the products specified by productIDList to the product comparison list.µ Handle Method handleAddProduct ATG Commerce Programming Guide The following table describes ProductListHandler’s handle methods for managing a product comparison list: Description Adds the product specified by productID to the product comparison list.Configuring Merchandising Services . which you can set to redirect the user when the handle method succeeds or fails. Also note that ProductListHandler has two optional properties. handleRemoveCategory Removes all entries for the category specified by categoryID from the product comparison list. applying optional category information if supplied in categoryID and the default SKU for each product. applying optional category information if supplied in categoryID. handleAddProductAllSkus handleAddProductList handleAddProductListAllSkus handleCancel handleClearList handleRefreshInventoryData The handleRefreshInventoryData method also calls pre and post methods. categoryID. and skuID to null. refreshInventoryDataSuccessURL and refreshInventoryDataErrorURL. Adds all of the products specified by productIDList to the product comparison list. respectively. Resets the form handler by setting productID. Removes the list entries whose ids are specified in entryIds from the product comparison list. if any. Calls the ProductComparisonList. If necessary. applying optional category and SKU information if supplied in categoryID and skuID. Adds all of the SKUs for the product specified by productID to the product comparison list. Clears the product comparison list and redirects the user to the clearListSuccessURL on success. handleRemoveEntries 146 8 .refreshInventoryDa ta() method. your subclasses can override these methods to provide additional application-specific processing. applying optional category information if supplied in categoryID.

sku. then the form handler looks for the product’s first child SKU (that is.HashMap. Namely. if any. optional category and SKU information is managed in the same way. Sets the product comparison list to the products specified by productIDList. applying optional category information if supplied in categoryID and the default SKU for each product. If a product’s category information isn’t specified in categoryID. handleRemoveProduct handleRemoveProductAllSkus handleSetProductList handleSetProductListAllSkus The behavior of ProductListHander’s handle methods parallels that of ProductComparisonList. RepositoryItem pProduct.Configuring Merchandising Services . Although the Entry class contains convenience methods for setting and getting properties like product. SKU. The following code example illustrates this point.ATG Commerce Programming Guide µ Removes the product specified by productID from the product comparison list. Because Entry is a subclass of java. respectively. You can subclass ProductComparisonList and override its createListEntry method to extend the information stored in an Entry object. the default SKU).util. Similarly.put(name. For examples of how page developers can use ProductListHandler in JSPs to manage product comparison lists. For additional information on ProductListHandler’s methods. category. refer to Implementing Product Comparison chapter of the ATG Commerce Guide to Setting Up a Store. RepositoryItem pSku) { 147 8 . value) to add a new property value to the Entry object. product. then the property is set to null. Removes all entries for the product specified by productID from the product comparison list. If no default value exists. applying the optional category and SKU information if supplied in categoryID and skuID. Extending the Product Comparison System As previously described. Sets the product comparison list to contain all the SKUs for all the products specified by productIDList. then the property is set to null. If no default value exists.” which indicates how popular a given product is. ProductComparisonList maintains a list of Entry objects. refer to the ATG API Reference. your subclasses don’t need to provide similar methods for their own properties. public class MyProductComparisonList extends ProductComparisonList { protected Entry createListEntry(RepositoryItem pCategory. applying optional category information if supplied in categoryID. then the form handler looks for the default category of the product. the Entry object maintains category. and inventory information in a single object. if a product’s SKU information isn’t specified in skuID. with each Entry object representing a product that the user has added to her product comparison list. you can call Entry. and inventoryInfo. it stores a hypothetical value called “popularity.

148 8 . createListEntry is called with the same category and SKU values that the user ultimately sees on the page in the product comparison list. pSku). The TableInfo component maintains the display information to compare the products in table form. Also by default. For JSP examples of how to use the ProductList and TableInfo components to manage product comparisons. it is configured for use with ProductList (in ProductList. and so on). refer to Implementing Product Comparison chapter of the ATG Commerce Guide to Setting Up a Store. a site will maintain one instance of ProductComparisonList and one instance of TableInfo for each comparison table that’s desired. public int computePopularity(RepositoryItem pProduct) { . In general. Using TableInfo to Display a Product Comparison List The ProductList component. a different list to compare televisions. e. however.. and the sorting instructions for the table. if necessary and available. the column headings for the table. refer to the Viewing Compare Results section of the Displaying and Accessing the Product Catalog chapter in the ATG Business Commerce Reference Application Guide. you may require multiple instances of ProductComparisonList and TableInfo. Consequently. which maintains the list of Entry objects in its items property. pCategory and pSku will have been populated with the product’s default parent category and first child SKU. Depending on the complexity of your commerce site. refer to the Implementing Sortable Tables chapter in the ATG Page Developer’s Guide..µ } ATG Commerce Programming Guide Entry e = super. score). located in Nucleus at /atg/commerce/catalog/comparison/TableInfo. By default. one list to compare cameras. return e. such as the properties to display in the table. For an example of using multiple instances of TableInfo to manage a single product comparison table. int score = computePopularity(pProduct). A simple site may offer the user a single product comparison list. A more complex site may offer the user multiple comparison lists to compare different types of items (for example. } } Note that by the time the createListEntry method is called. it is configured for use with the Motorprise Reference Application.tableInfo). For detailed information on TableInfo. Page developers can refer to the popularity property of a ProductComparisonList entry to display the corresponding value in a JSP.Configuring Merchandising Services . ATG Commerce provides one instance of TableInfo. pProduct.createListEntry(pCategory.put("popularity". also includes a reference to a TableInfo object in its tableInfo property.

(Collectively.gsa... you can increase sales and attract new business. these are sometimes referred to as “claimable items” in ATG Commerce.ATG Commerce Programming Guide µ Setting Up Gift Certificates and Coupons ATG Commerce provides the ability to create and manage gift certificates and coupons. Coupons can also help increase your customer base (for example.adapter. <property name="type" data-type="enumerated"> <option value="GiftCertificateClaimable"/> <option value="PromotionClaimable"/> </property> . The following example shows the pertinent code from the Claimable repository definition file: <item-descriptor name="claimable" sub-type-property="type" version-property="version"> . The definition file represents an item that can be claimed (a sub-type of type Claimable) and then defines specific implementations of this item. by including them in a cold call e-mail campaign). The repository itself is made up of two parts: the database schema and the XML repository definition file.xml # name for the repository repositoryName=Claimable # database access transactionManager=/atg/dynamo/transaction/TransactionManager dataSource=/atg/dynamo/service/jdbc/JTDataSource # XML parsing 149 8 . but importantly they provide an alternative way to deliver promotions to your existing customers..Configuring Merchandising Services .. gift certificates and coupons . The claimable item system in ATG Commerce is made up of three components: • • • The Claimable repository The ClaimableTools component The ClaimableManager component The Claimable Repository The Claimable repository holds all possible claimable items.GSARepository # definition files for claimable objects definitionFiles=\ /atg/commerce/claimable/claimableRepository.) By providing gift certificates as an option for your customers. namely. </item-descriptor> The following example shows the properties file for the ClaimableRepository component (/atg/commerce/claimable/ClaimableRepository): $class=atg.

Disabling the Claimable Repository The Claimable repository is represented by the /atg/commerce/claimable/ClaimableRepository component. and then perform 150 8 . If you are not going to use the Claimable repository. Edit the /atg/commerce/claimable/ClaimableTools component and set the claimableRepository property to null. See the ID Generators section of the Core Dynamo Services chapter in the ATG Programming Guide. Edit the /atg/registry/ContentRepositories component and remove the value in the initialRepositories property that references the /atg/commerce/claimable/ClaimableRepository component. The second use of the ClaimableTools component is to provide configurable values for the various properties of claimable items. For example. This is important to prevent users from guessing claim codes. initialize them. Follow these steps to disable the ClaimableRepository: 1. The ClaimableManager Component The ClaimableManager component (/atg/commerce/claimable/ClaimableManager) provides higher level access to the repository and is the mechanism that most applications use to interact with the claimable item functionality. The ObfuscatedIdGenerator service creates nonsequential repositoryId values. it takes the item-descriptor type as an argument and then creates and adds the claimable item to the repository. The ClaimableTools Component The ClaimableTools component (/atg/commerce/claimable/ClaimableTools) provides two pieces of functionality: • • Low-level access to the Claimable repository. 2.Configuring Merchandising Services . The system uses the value in this property as the key for claiming the item (for example. The first use of the ClaimableTools component is simply to create and claim any type of claimable item. It provides the ability to claim items. it can obtain any super-type of type claimable since they all share the same common base type of claimable.µ ATG Commerce Programming Guide XMLToolsFactory=/atg/dynamo/service/xml/XMLToolsFactory # id generator IdGenerator=/atg/dynamo/service/ObfuscatedIdGenerator lockManager=/atg/dynamo/service/ClientLockManager Each item in the Claimable repository has a repositoryId property. as the claim code for a gift certificate). if someone changes the name of a field in the XML file. The value is created by the ObfuscatedIdGenerator service. Naming for various claimable item properties. you can disable it. The standard IdGenerator generates sequential repositoryId values. Additionally. For claiming items. you can reflect that change in the code by adjusting the property values of the ClaimableTools component. Disabling the repository prevents you from having to create the associated tables in your database.

the ClaimableManager component attempts to claim the item through the ClaimableTools package. An example of how the ClaimableManager component can layer together several pieces of functionality from the ClaimableTools package is as follows: when a user claims an item (for example. Customer B uses (claims) the gift certificate to pay for all or part of an order. you could have two SKUs. thus combining several smaller functions from the ClaimableTools package. When Customer A adds a gift certificate to his or her shopping cart. amount (Required) The original dollar value of the gift certificate. one for a $50 dollar certificate and another for a $100 certificate. debitClaimableGiftCertificate – debits a specific amount from the gift certificate. he or she enters a code for a gift certificate). Setting Up Gift Certificates Gift certificates allow a customer to pay for all or part of a purchase using a prepaid amount. For example. Processing a gift certificate involves the following steps: 1. 2. The gift certificate is not functional unless the three required properties (identified below) are set. The following properties can be set when the gift certificate is created. also through the ClaimableTools package. ATG Commerce fulfills the purchase for Customer A (and sends a notification e-mail to Customer B as part of the fulfillment process). The Purchase and Fulfillment Process for Gift Certificates Set up gift certificates as items in your product catalog. Other examples of functions that the ClaimableManager component provides are as follows: • • • createClaimableGiftCertificate – creates a gift certificate in the system. Then it attempts to adjust the status of the item to a claimed status. The ElectronicFulfiller then creates the gift certificate in the Claimable repository (by means of the ClaimableManager component) and sends an e-mail to the recipient notifying him or her that a gift certificate has been purchased on his or her behalf and including the code to use for claiming it. Refer to the Configuring the Order Fulfillment Framework chapter for more information on the ElectronicFulfiller. The value of the gift certificate is stored in the listPrice property of each gift certificate SKU in the product catalog. 3.Configuring Merchandising Services .ATG Commerce Programming Guide µ functions that are specific to one type of claimable item. Customer A purchases the gift certificate on behalf of Customer B. Each SKU has a fulfiller property that defines an ElectronicFulfiller. 151 8 . adding separate SKUs for different amounts. creditClaimableGiftCertificate – credits a specific amount to a gift certificate. the fulfiller property tells the OrderFulfiller to route the purchase to the specified ElectronicFulfiller.

repositoryId"/>' type="hidden" name="id"> Give <dsp:input bean="ShoppingCartModifier.--> <!--Create a dropdown list will all Sku in the Product. add the SKU to the dropdown list:--> <dsp:droplet name="/atg/dynamo/droplet/ForEach"> <dsp:param param="Product.childSKUs" name="array"/> 152 8 . Note: By default.repositoryId" type="hidden"/> <!--set id param so that the Navigator won't get messed up in case of an error that makes us return to this page. Use the handleAddSoftGoodToOrder() method in the /atg/commerce/order/ShoppingCartModifier component to do this. (Required) The current amount of money remaining on the gift certificate for debit.com/dsp. in this case an e-mail address. The profileId of the person who bought the gift certificate. The date the gift certificate was purchased.Configuring Merchandising Services . the stock level of a gift certificate is set to -1 indicating that an infinite number of the item is available.tld" prefix="dsp" %> <dsp:page> <dsp:form action="<%=request.getServletPath()%>" method="post"> <!-. ATG Commerce does this through an ElectronicShippingGroup. Store the selected SKU's id in the Form Handler: --> <dsp:select bean="ShoppingCartModifier. which designates the necessary information for delivering electronic goods.atg. The following example shows the JSP code you would add to the page on which the gift certificate product is displayed. you add an ElectronicShippingGroup to the order as well.µ amountAuthorized amountRemaining purchaserId purchasedDate lastUsed ATG Commerce Programming Guide (Required) The total amount of money on the gift certificate that has been authorized for debit.quantity" size="4" value="1" type="text"/> <!-----------DropDownList format (default) ----------. and define the relationship between the two. when Customer A adds the gift certificate to his or her cart.ProductId" paramvalue="Product.--> <input value='<dsp:valueof param="Product. It adds the gift certificate to the customer’s order and prompts him or her to specify the e-mail address of the recipient: <%@ taglib uri="http://www. The latest date on which fulfillment updated the amount. So. Sending an e-mail to the recipient of the gift certificate requires knowing his or her e-mail address. Setting the stock level of a gift certificate to 0 (out of stock) does not affect the gift certificate’s availability because the ElectronicFulfiller does not check a gift certificate’s stock level.Store this Product's ID in the Form Handler: --> <dsp:input bean="ShoppingCartModifier.catalogRefIds"> <!--For each of the SKUs in this Product.

ADD TO CART BUTTON: Adds this SKU to the Order--> <dsp:input bean="ShoppingCartModifier.jsp" type="hidden"/> <dsp:input bean="ShoppingCartModifier. Thus. Note that electronic goods require special processing.addSoftGoodToOrderErrorURL" value="product_gift_certificate. so the submit method of the form is set to addSoftGoodOrder and not addItemToOrder.addSoftGoodToOrderSuccessURL" value=".repositoryID" idtype="java.softGoodRecipientEmailAddress. if this SKU is selected in dropdown:--> <dsp:getvalueof id="option48" param="Sku. and then the ElectronicFulfiller examines it to determine where to send the message. the e-mail address is set in the ElectronicShippingGroup through the handleAddSoftGoodToOrder method. 153 8 .addSoftGoodToOrder" value=" Add Gift Certificate to Cart " type="submit"/> <!-.Configuring Merchandising Services .displayName"/> </dsp:oparam> </dsp:droplet> <!--ForEach SKU droplet--> </dsp:select> to <br> Recipient's e-mail address <dsp:input bean="ShoppingCartModifier. For more information on the ShoppingCartModifier component..lang.Goto this URL if NO errors are found during the ADD TO CART button processing:--> <dsp:input bean="ShoppingCartModifier. please refer to the Setting Up Gift Lists and Wish Lists section.softGoodRecipientEmailAddress" size="30"/> <p> <!-./checkout/cart.jsp" type="hidden"/> </td> </tr> </table> </dsp:form> </dsp:page> In this example. The customer enters the recipient’s e-mail address into a form field set to the property ShoppingCartModifier.ATG Commerce Programming Guide µ <dsp:param value="Sku" name="elementName"/> <dsp:param value="skuIndex" name="indexName"/> <dsp:oparam name="output"> <!--This is the ID to store.String"> <dsp:option value="<%=option48%>"/> </dsp:getvalueof> <!--Display the SKU's display name in the dropdown list:--> <dsp:valueof param="Sku. note the code that handles the recipient’s e-mail address.

The processor used for gift certificates handles the authorization. If there are any differences. create a relationship between the order and the new payment group indicating that the gift certificate payment group can account for any amount up to the value of the gift certificate. The ClaimableManager attempts to match each string to a corresponding gift certificate in the Claimable repository. with a FormHandler to connect these two systems. During the handleMoveToConfirmation process.debit returns successfully. The properties to initialize include the claim code ID. any amount that was authorized will be credited back to the gift certificate before the PaymentGroup is removed. and the amount of the gift certificate. using white space as the delimiter. the ShoppingCartModifier parses any values it finds in this field into tokens. and the system adds the corresponding promotion to the customer’s profile. it creates a new GiftCertificate payment group and adds it to the order. During fulfillment. 154 8 . If the system does find an item that corresponds to the token string. the user profile ID. When a gift certificate is authorized. This behavior allows customers to enter multiple gift certificate codes into a single text field. Please refer to the Configuring Purchase Process Services chapter for more information on payment groups. If it cannot find a corresponding item. see the Processing Payment of Orders section. Finally. it hands each token string to the ClaimableManager component. include a text field where customers can enter the claim codes for any gift certificates they may have (you send the codes in the gift certificate notification e-mail). (For more information.) When an order is submitted. they are corrected now. Obtain a coupon code. When this happens. the amount that was authorized is checked against the amount that is being debited. the PaymentManager. the PaymentGroup containing the gift certificate is debited through the PaymentManager (and ultimately the GiftCertificateProcessor). Hook the text field up to the giftCertificateNumbers property of the ShoppingCartModifier component. Most of the code for handling coupons is included in the ClaimableManager component and the standard promotion architecture. The process for handling a coupon is as follows: 1. This prevents the same gift certificate from being used for more than it is worth.µ Using a Gift Certificate ATG Commerce Programming Guide On your Checkout page (or an equivalent page on your site). debit. The PaymentManager has different processors for gift certificates and credit cards.Configuring Merchandising Services . the amountRemaining is reduced by the amount being authorized. Setting Up Coupons ATG Commerce treats coupons as a type of promotion that customers can claim. To make sure that the gift certificate is valid if an order is removed before the debit occurs (and after authorization). The customer types in a specific code. and credit of gift certificates. each PaymentGroup in the order is authorized using the PaymentManager. If the amount authorized was the same as the amount being debited. Settling a Gift Certificate Gift certificate settlement is handled similar to the way that settlement for credit cards is handled. After the system tokenizes the giftCertificateNumbers property. it adds an error to the FormHandler. You must initialize the properties of the payment group to the correct values.

155 8 .ATG Commerce Programming Guide µ 2. During order pricing. 3.atg.claimCouponSuccessURL" value="CouponClaim.tld" prefix="dsp" %> <dsp:page> <dsp:form method="post"> <!-.couponClaimCode" type="text"/> <dsp:input bean="CouponFormHandler. discontinues that order. a Checkout page) and hook it up to the couponClaimCode property of the CouponFormHandler component. Use the /atg/commerce/promotion/CouponFormHandler component to obtain a coupon code and add it to a customer’s list of promotions in the customer’s activePromotions profile property. Create an input field on an appropriate site page (for example. COUP100 and coup100 are two different coupon codes. Add the resulting promotion to the activePromotions list in the user profile.Where to go to on success or failure --> <dsp:input bean="CouponFormHandler.Configuring Merchandising Services . the promotion applies to the second order. ATG Commerce determines whether the order qualifies for the coupon’s promotion by checking that: • • The order meets the requirements of the promotion The promotion has not expired This double-checking capability ensures that if a user claims a coupon as part of one order. This method uses the ClaimableManager component to attempt to get a coupon from the Claimable repository. Try to claim the coupon from the ClaimableRepository. as long as the promotion is active and applicable. the user “claims” the coupon. ATG Commerce checks that the coupon is active and the promotion associated with it is not expired. If both conditions are met.claimCoupon" type="submit"/> </dsp:form> </dsp:page> When a user enters a coupon code on a Checkout page.com/dsp. For example. which means that the promotion is added to the user’s activePromotions profile property.jsp" type="hidden"/> <!-. then creates a second one.jsp" type="hidden"/> <dsp:input bean="CouponFormHandler. Then it extracts the promotion from the coupon and uses the PromotionTools component to place the promotion into the customer’s user profile. Note that coupon codes are case-sensitive. The following example shows the JSP code for using the CouponFormHandler component: <%@ taglib uri="http://www. have the form submit to the handleClaimCoupon method of the form handler. Then.Get the coupon claim code --> Coupon code: <dsp:input bean="CouponFormHandler.claimCouponSuccessURL" value="CouponClaim.

The following example shows the default item-descriptor for coupons: <!-.jar. If your Web site requires multiple types of coupons.µ ATG Commerce Programming Guide A promotion given by a coupon persists on the user profile. you can define additional item-descriptor types by editing the claimableRepository. there’s no need to claim a coupon twice. The other step to consider when you set up coupons is to make sure that there are coupons in the Claimable repository for a customer to claim.checkPromotionType method checks the item type of the coupon corresponding to the given claim code against the array of acceptable item types in the CouponFormHandler.commerce. When a coupon is claimed.Promotion Claimable object --> <item-descriptor name="PromotionClaimable" super-type="claimable" sub-type-value="PromotionClaimable"> <table name="dcspp_coupon" type="auxiliary" id-column-name="coupon_id"> <property name="promotion" column-name="promotion_id" item-type="promotion" repository="/atg/commerce/pricing/Promotions"/> </table> </item-descriptor> The coupon item-descriptor is defined in /atg/commerce/claimable/claimableRepository. refer to Extending the Purchase Process in the Customizing Purchase Process Externals chapter.xml.promotion. You can populate the Claimable repository through either the ATG Control Center or the atg. For information on how to extend the commerce object hierarchy to include a new property. which is located in a .validCouponItemTypes property. The item-descriptor defines a claim code ID and a link to a promotion object in the Promotions repository. A claimed coupon is automatically applied to any order to which it qualifies.xml file and then specifying the valid coupon types in the validCouponItemTypes property in the CouponFormHandler properties file.jar file at <ATG9dir>/DCS/config/config. not as part of the order.id">no value</dsp:valueof> </dsp:oparam> <dsp:oparam name="error"> </dsp:oparam> </dsp:droplet> 156 8 . The following example shows the JSP code for the CouponDroplet: <dsp:importbean bean="/atg/commerce/promotion/CouponDroplet"/> <h2>here is a coupon that was created: </h2> <dsp:droplet name="CouponDroplet"> <dsp:param value="promo60001" name="promoId"/> <dsp:oparam name="output"> <dsp:valueof param="coupon.CouponDroplet. You can persist a coupon code with an order by adding a new property to the Order object and storing the coupon code in the new property. the CouponFormHandler. The value of the output parameter in the CouponDroplet is the coupon object. The CouponDroplet servlet bean takes either a promotion or promotion ID and then generates a coupon for it in the repository.Configuring Merchandising Services . You can obtain the claim code for the coupon using coupon.id.

thereby creating a coupon code that is ready to send to a customer.Configuring Merchandising Services . 157 8 .ATG Commerce Programming Guide µ You could include the CouponDroplet in a targeted e-mail JSP.

µ ATG Commerce Programming Guide 158 8 .Configuring Merchandising Services .

and other promotions. which evaluates discount rules to determine whether a calculator should apply a discount in a given situation. target them for appropriate visitors.Using and Extending Pricing Services . you can tailor prices and generate them dynamically on demand. you can use ATG Commerce pricing services to provide dynamic pricing for orders. Extending and Creating Pricing Calculators: Describes how to add new calculators or extend existing calculators to fit the specific needs of your site. Public Pricing Interfaces and Classes: Describes the interfaces and classes used in the pricing framework. • • The ATG Consumer Commerce Reference Application Guide and the ATG Business Commerce Reference Application Guide contain extensive descriptions of how ATG implemented dynamic pricing in the Pioneer Cycling Store and Motorprise reference applications. and use them in dynamic pricing situations. Extending the Qualifier Class: Describes how to extend the Qualifier class. refer to the sections on pricing in these manuals as well as the information in this guide. Extending and Creating Pricing Engines: Describes how to add new pricing engines or extend existing pricing engines to fit the specific needs of your site. This chapter contains information on the following topics: • • • • • • • Overview of Pricing Services: Describes how pricing engines and calculators work within the pricing framework. For more pricing information. 159 9 . Using Price Lists: Describes how to use price lists to implement different pricing schemes for different customers. and shipping. Creating Promotions: Describes how to set promotions up and deliver them to customers. Just as you can personalize content for every shopper who visits your site. Default Pricing Calculators: Describes the preconfigured discount pricing calculators that are supplied with ATG Commerce. Default Pricing Engines: Describes the preconfigured pricing engines that are supplied with ATG Commerce. sales tax. As well as personalizing prices for catalog items. sales. You can also set up coupons.ATG Commerce Programming Guide µ 9 Using and Extending Pricing Services The pricing services in ATG Commerce provide a flexible system for personalizing the prices of items in your product catalog. The system is granular enough to allow you to create a site on which a single item is priced differently for every shopper who views it.

a customer might have a coupon offering a 10% discount on a total order. For more information on using a third-party system for this purpose. Determining which calculators generate the price. For example. Pricing calculators are responsible for the following: • • • Looking up the price in the catalog by priceList.Using and Extending Pricing Services . (Refer to the Qualifier Class section for more information. Invoking the calculators in the correct order. the structure for pricing and discounting catalog items includes the following: 160 9 . you might set up a “2-for-1” sale for a limited period on a specific type of item. sites can use a third-party system such as CyberSource or TAXWARE to handle tax calculations. which represents a quantity of a SKU or a product).µ Overview of Pricing Services Pricing engines are responsible for three tasks: • • • ATG Commerce Programming Guide ATG Commerce pricing services are based on the behavior of two complementary elements: pricing engines and pricing calculators. The structure includes the following: • • • • A pricing engine One or more calculators A helper method in the qualifier service An item-descriptor in the Promotions repository. see Integrating Third-Party Software With ATG Commerce. ATG Commerce pricing services can calculate the sales tax for an order. ATG Commerce pricing services calculate the total cost of an order and can apply any discounts that are applicable (for example. By default. Retrieving any promotions that are available to the site visitor. • • • ATG Commerce uses the same basic structure for pricing each type of object described above. sales tax. Shipping price. ATG Commerce pricing services adapt the list price by applying any discounts or other promotions that you have set up. (Note that an “item” is a CommerceItem. For example. Each item has a list price that can be specified in the listPrice property of the Product Catalog repository. and shipping. Invoking a qualifier service that identifies the objects to discount. ATG Commerce can perform dynamic pricing for the following types of pricing object: • Items. Alternatively. Orders. which work together to determine prices for catalog items.) Using information they receive from the engines and from the qualifier service to perform the actual process of determining prices. total orders. ATG Commerce pricing services can calculate the price of shipping for an order and apply discounts if applicable. Tax.

Qualifier The Item Discount item-descriptor in the repository /atg/commerce/pricing/Promotions. It includes a description of the change and the amount. It also contains the promotion (if any) that triggered the change. An object that contains the price of some piece of an order.Using and Extending Pricing Services . There are four main kinds of priceInfo objects: OrderPriceInfo. Pricing Model Definition Language – This is how a promotion is described. You could add such an item item-descriptor if necessary. after order (or the relevant component) has been priced. an Item Sale Price Calculator.ATG Commerce Programming Guide µ • • • • An Item Pricing Engine An Item List Price Calculator. or tax). It also contains information about when the pricing model may be used. This includes the discount rules for when a promotion may apply and the rules for what may be discounted. Each of these is contained within the order. the locale.commerce. For this reason. and an Item Discount Calculator The findQualifyingItems call in atg. ShippingPriceInfo. there is no item-descriptor for tax discounts in the default Promotions repository. order. PriceInfo PricingAdjustment PricingContext PricingModel Promotion 161 9 . Pricing Term Calculator PMDL Definition An object that looks at all or part of an Order and returns a price. and TaxPriceInfo. It includes a PMDL rule and the discount type and amount. Describes why and how a particular price was changed. There is also a DetailedItemPriceInfo. ItemPriceInfo. The ACC includes a discount rule interface for creating rules. See PricingModel. described with ItemPriceInfo objects. Note: The structure for determining sales tax is slightly different because ATG Commerce does not support offering discounts on tax. This is an abstract notion referring to one of the four sets of promotions (shipping. A repository item that describes a discount. and the profile used when a price was calculated. Common Terms in Pricing Services The following table describes common terms used in pricing. Each of these terms is described in detail in this chapter. item.pricing. These two pieces are called the “qualifier” (when) and the “target” (what) and are a part of every promotion.

For more information. see Creating Promotions. searching for any promotion whose Automatically Give to All Customers (global) property is set to true.µ Qualifier Target ATG Commerce Programming Guide This is a service that interprets a PMDL rule and decides what. if anything. The pricing engine processes one at a time the objects for which it is tasked with generating a price. This usually occurs during checkout. A precalculator modifies a price without using any associated promotions. This includes: listPrice (fixed price. For example. 1. bulk price. This rule defines when something can receive a discount. The resulting lists are concatenated. The term qualifier also refers to the first part of a PMDL rule. How Pricing Services Generate Prices This section provides an overview of the way ATG Commerce uses pricing services to calculate prices. (See PricingTools Class for more information. such as a PriceItem servlet bean in a page or from the ATG Commerce PricingTools class. This method looks at the activePromotions property to find all promotions associated with a given profile. a site could use a list price precalculator or an order subtotal precalculator to establish a base price to which subsequent calculators then apply a discount. It applies promotions by priority. The second part of a PMDL rule is called the target. Note: You can also specify a priority level for any promotion by setting its Order of Application (priority) property in the Promotion repository. A pricing engine is invoked from business-layer logic. may be discounted. The pricing engine accesses the current customer’s profile and retrieves any promotions listed in the activePromotions property of the profile. The pricing engine builds a list of global promotions (ones that you define as applying automatically to all customers). tiered price) salePrice (if item is on sale) 2. 3. The engine looks up the 5. (You create promotions in the ATG Control Center. This rule defines which part of an order receives a discount.) The pricing engine applies its configured precalculators. The pricing engine sorts the promotions by this property before it applies them. 162 9 . All the precalculators (defined in ItemPricingEngine) are executed in order.) Note: The list of promotions that the business logic passes to the pricing engine often comes from the engine itself through its getPricingModels method. It builds the list by using its globalPromotionsQuery property to query the Promotions repository. For each available promotion. 4.Using and Extending Pricing Services . ATG Commerce does the following: Each promotion has a pricingCalculatorService property that specifies the calculator that the system must use to apply it.

The calculator applies the discount to the list of objects. you must decide whether your site requires dynamic product pricing and. if so.Using and Extending Pricing Services . 163 9 . The promotion calculator consults the qualifier service to get a list of objects that qualify for the discount. passing in the referring promotion. which is the same for all customers. You can also choose to restrict dynamic pricing to certain types of customers (for example. blue items appear with their static list or sale price. refer to the sections on the PriceItem and the PriceEachItem servlet beans in the ATG Commerce Guide to Setting Up a Store. The calculator marks any items that it uses as qualifiers for the promotion. For more information on dynamic pricing.) Many sites do not need to show dynamic pricing on product pages.ATG Commerce Programming Guide µ specified calculator in Nucleus and invokes it. For more information. dynamic pricing takes effect. This process is repeated every time a price is requested. Even if you decide not to display dynamic pricing on a product page. Using dynamic pricing on a product page can cause a significant decrease in performance compared to using static pricing. suppose you send a specific group of customers a coupon for 20% off all blue items. You display the price on the appropriate site pages. each item in the catalog has a list price stored in the listPrice property of the catalog repository. registered visitors only). The pricing engine applies its configured PostCalculators. The pricing engine modifies the PriceInfo object of the object being discounted. when a customer with the “20% off” coupon adds a blue item to his or her shopping cart. which make any necessary modifications to the price after any discounts have been applied. for example a list price or a sale price. it is acceptable to show dynamic prices only when a customer places items in the shopping cart. How Static Pricing Works With static pricing. You can use dynamic pricing on certain product templates and static pricing on others. as a property of the object whose price is being shown. dynamic pricing still occurs on the shopping cart and purchase process pages. For example. 7. and the item price appears on the Shopping Cart or Checkout page (for example) with a discount of 20%. If you do decide to use dynamic pricing on product pages. you can still ensure a high level of performance by using the pricing features selectively. and the ATG Commerce Pricing Services can then use that price as a base for calculating order totals. On the product pages of the site. see How Static Pricing Works. 6. (A product or SKU that is priced statically just displays a price amount. Deciding Between Dynamic and Static Product Pricing When building a product catalog. For these sites. and sales tax. how granular you need it to be. However. shipping costs. This behavior prevents the qualifier items from being used again during the same price calculation.

you can maintain more than one price per item – for example.PricingEngine is the main interface for interacting with the atg. 164 9 . you can give each item a fixed sale price in addition to its list price by specifying a value for the salePrice property in the catalog repository. The APIs work together. This section includes information on the following: • • • The Base Pricing Engine Pricing Interfaces Pricing Classes For more information on pricing interfaces and classes. see the ATG API Reference. use the Switch servlet bean with the onSale property from the Catalog repository. Extensions of this interface describe objects that calculate a price for a specific class of object. see Appendix B: ATG Servlet Beans in the ATG Page Developer’s Guide.pricing.commerce. The Base Pricing Engine atg. There are many points from which you can extend existing ATG Commerce functionality.pricing package.µ ATG Commerce Programming Guide Optionally.listPrice" converter="currency"/> </dsp:oparam> <dsp:oparam name="true"> List price of <dsp:valueof param="sku. if your site requires additional functionality.salePrice" converter="currency"/>! </dsp:oparam> </dsp:droplet> For more information about the Switch servlet bean. However. so you can extend a single class while still leveraging much of the ATG Commerce code base. you can write a new implementation of the many public pricing APIs that the product supplies. When you want the alternate price to take effect.commerce.Using and Extending Pricing Services . Public Pricing Interfaces and Classes ATG Commerce Pricing Services come with a powerful set of standard features that are designed to handle the pricing demands of most Web sites. For example.onSale" name="value"/> <dsp:oparam name="false"> List price of <dsp:valueof param="sku. OrderPricingEngine extends PricingEngine and calculates prices for orders passed to it. The following example is taken from the default ATG Commerce product catalog: <dsp:droplet name="/atg/dynamo/droplet/Switch"> <dsp:param param="sku.listPrice" converter="currency"/> on sale for <dsp:valueof param="sku.

order.CommerceItem objects. which extracts a collection of promotions from an input profile. The individual extensions of the PricingEngine interface contain the API methods for generating a given type of price. The pricing context is defined by the method’s input parameters.commerce. For example. getPricingModels. while the OrderPricingEngine needs a different set. 165 9 .Using and Extending Pricing Services . priceOrder.pricing. Define one or more methods that do the following: Take an input object(s) to be priced. For example. It varies among PricingEngine extensions.pricing. Extend the PricingEngine interface.ATG Commerce Programming Guide µ All PricingEngine implementations process promotions.commerce.ShippingPricingEngine Provides a price for atg.commerce.pricing.ShippingGroup objects. atg.order. A hash table of extra parameters.pricing. ATG Commerce Extensions of the PricingEngine ATG Commerce provides the following four extensions of the main PricingEngine interface: • • • atg. atg. There is a Java object type for each type of price that is generated. The customer’s profile. Return the price(s) to be associated with the input object(s). which exists so that new APIs do not have to be created to accommodate additional pricing context information. Take an input context defined by zero or more parameters (in addition to the object to be priced).commerce. The locale for which the price is being generated. follow the same basic procedure: 1. The PricingEngine interface itself does not describe any functionality other than the promotion extraction API because of the wide range of information that different PricingEngine implementations might require to calculate a price for their specific class of object. to generate a price for an order in a given context.ItemPricingEngine Provides a price for atg.OrderPricingEngine Provides a price for atg. 2.OrderPricingEngine inherits the promotion extraction API from PricingEngine and defines one new method. atg.commerce.order. Extending the Base Pricing Engine For all extensions of the PricingEngine.Order objects.commerce. but typically it includes the following: • • • • • The input object(s) to be priced. The input promotions to apply to the prices. the ItemPricingEngine implementation needs one set of input parameters.commerce. The PricingEngine interface itself contains only one method.

Using and Extending Pricing Services . Pricing Interfaces. but they are priced as if they were passed into PriceItem one at a time. when the customer makes the decision to add the shorts to the shopping cart.commerce.” While the customer is just browsing the catalog. get one pair free.order. To continue with the same example. The single item that is passed in is the only one available to satisfy the requirements of any promotion. The prices that are generated are ItemPriceInfo objects.CommerceItem objects. the customer now puts “6 blue men’s shorts” in the shopping cart in addition to the “5 blue women’s shorts. It reviews any promotions that are passed in through a pPricingModels parameter. if the item passed in is “5 blue women’s shorts. get one pair free” promotion is not factored in when displaying prices.order.” and there is a promotion for “Buy 7 or more blue shorts. It describes an object that determines prices for atg. The priceItems method prices all input items all in the same context.Order objects. Therefore. when the customer subsequently displays the contents of his or her cart.” the promotion would not take effect.ItemPricingEngine is an extension of the PricingEngine interface. These interfaces are described in the next section. the price shown is still full price for all the shorts.µ • ATG Commerce Programming Guide atg. 166 9 .commerce. An ItemPricingEngine can determine prices in three ways: • The priceItem method prices an item as a single item. For example.commerce.pricing. This call is mainly used for displaying item prices when a customer is browsing the catalog. However.pricing. • • The priceEachItem method batch processes all the items that are passed in. Pricing Interfaces This section describes the following ATG Commerce pricing interfaces: • • • • • • • • • ItemPricingEngine Interface ItemPricingCalculator Interface OrderPricingEngine Interface OrderPricingCalculator Interface ShippingPricingEngine Interface ShippingPricingCalculator Interface TaxPricingEngine Interface TaxPricingCalculator Interface PricingConstants Interface ItemPricingEngine Interface atg. the promotion takes effect and shows that one pair of shorts is free.commerce.TaxPricingEngine Determines tax for atg. the “Buy 7 or more blue shorts.

The context can be important because some promotions take effect only if the item appears in a pricing context with other items.commerce. see Pricing Calculator Classes. For more information.ItemPricingCalculator modifies the price of a CommerceItem.ItemListPriceCalculator class. ATG Commerce provides the ItemPricingEngineImpl class as a default implementation of the ItemPricingEngine interface. The item pricing engine invokes each calculator’s priceItem. the context is as follows: the items to be priced.pricing.OrderPricingCalculator.pricing. For more information. Tax. the profile of the user. modifies the price of an order. The specific way in which the calculator modifies an item price varies according to individual implementations. Implementations of this interface create an OrderPriceInfo object that accurately represents the price of an input order. For example.pricing.commerce. a certain promotion might give 10 percent off an order if the pricing context includes one shirt and one pair of pants.Using and Extending Pricing Services . see Item. OrderPricingCalculator Interface The OrderPricingCalculator interface.OrderPricingEngine is an extension of the PricingEngine interface. and any additional parameters. see Item. ATG Commerce provides the OrderPricingEngineImpl class as a default implementation of the OrderPricingEngine interface. The items would only receive the discount if priced in the same context. ItemPricingCalculator Interface atg.commerce. the promotions to factor. The specific way in which the calculator modifies an order price varies according to individual implementations. the locale. It describes an object that determines prices for Order objects (the total price of all items in a customer’s shopping cart). or priceItems method. The way in which they do this is depends on the implementation. Order. An OrderPricingEngine uses the priceOrder method to determine the price of an order. The calculator’s priceItem method modifies the input priceObjects according to the current pricing context.pricing. For more information on this class and other classes that implement this interface. Order. OrderPricingEngine Interface atg. priceEachItem. For example.commerce.ATG Commerce Programming Guide µ The pricing context is defined by the methods’ input parameters. and Shipping Pricing Engine Classes. The priceOrder method modifies the input pPriceQuote according to the current pricing context. and Shipping Pricing Engine Classes. which you can use to determine an initial price for an item without any discounting. The order pricing engine invokes the priceOrder method of the OrderPricingCalculator (or calculators) that it is configured to use. The specific way in which the engine creates the order object varies according to individual implementations. 167 9 . atg. it includes the atg. ATG Commerce includes several classes that are implementations of the ItemPricingCalculator interface. In the case of priceItem. Tax. The pricing context is defined by the priceOrder method’s input parameters.

pricing. TaxPricingCalculator Interface The atg. it includes the atg. ATG Commerce provides the ShippingPricingEngineImpl class as a default implementation of the ShippingPricingEngine interface. Tax.OrderSubtotalCalculator class. For more information. For example. Order. it includes the atg. The priceShippingGroup method modifies the input pPriceQuote according to the current pricing context.ShippingPricingEngine is an extension of the PricingEngine interface. and Shipping Pricing Engine Classes. Order.pricing. see Pricing Calculator Classes.commerce. Implementations of this interface determine the price for the tax associated with a specified order object. the current profile. and any additional parameters. ATG Commerce provides the TaxPricingEngineImpl class as a default implementation of the TaxPricingEngine interface. and Shipping Pricing Engine Classes.commerce. The getAvailableMethods call returns the methods available for shipping the specified group. For more information on this class and other classes that implement this interface. The priceShippingGroup method asks this object to determine a price for the specified shipping group. Tax.commerce.TaxPricingCalculator interface modifies the price of tax for an order. a locale in which the pricing should occur. For example.pricing.µ ShippingPricingEngine Interface ATG Commerce Programming Guide ATG Commerce includes several classes that are implementations of the OrderPricingCalculator interface. The interface provides one way to ask for a tax price. atg.commerce.pricing. The specific way in which the calculator modifies a shipping price varies according to individual implementations. atg. 168 9 . see Item.ShippingDiscountCalculator class.pricing. which you can use to apply a promotional discount to the shipping price of an order. see Item. which you can use to calculate the raw subtotal for an order before any discounts are applied. The shipping pricing engine invokes the priceShippingGroup method of the ShippingPricingCalculator (or calculators) that it is configured to use. Calling code provides the pricing context by inputting the order. It describes an object that determines taxes for Order objects. modifies a price object that represents the cost of shipping for an order.pricing.Using and Extending Pricing Services . see Pricing Calculator Classes. ShippingPricingCalculator Interface The ShippingPricingCalculator interface.ShippingPricingCalculator.commerce. For more information on this class and other classes that implement this interface. For more information. Implementations of this interface determine the cost of shipping the contents of a shipping group. It describes an object that determines prices for ShippingGroup objects. ATG Commerce includes several classes that are implementations of the ShippingPricingCalculator interface. TaxPricingEngine Interface atg. any pricing models (promotions).commerce.TaxPricingEngine is an extension of the PricingEngine interface.

commerce. 169 9 .pricing.AmountInfo parent class represents price information about an object.Using and Extending Pricing Services . OrderPriceInfo. see Pricing Calculator Classes. Pricing Classes The following section describes the ATG Commerce pricing classes.PricingConstants interface contains constant values for static reference by other classes in the atg.pricing. For more information on this class and other classes that implement this interface. it includes the atg.pricing package.commerce. The calculator’s priceTax method modifies the input pPriceQuote according to the current pricing context. In addition to the actual amount. it also contains information about how to interpret that amount.pricing. PricingConstants Interface The atg. This class is the base for the ItemPriceInfo.commerce.ATG Commerce Programming Guide µ The tax pricing engine invokes the priceTax method of the TaxPricingCalculator (or calculators).commerce.commerce. which you can use for situations in which a sales tax of zero is applicable for an order.NoTaxCalculator class.pricing package. For example. TaxPriceInfo. • • • • • • • • Price Holding Classes Pricing Engine Classes Pricing Calculator Classes Qualifier Class QualifiedItem Class PricingTools Class Other Classes The Pricing Servlet Beans Price Holding Classes This section describes the following ATG Commerce price holding classes: • • • • • • AmountInfo ItemPriceInfo DetailedItemPriceInfo OrderPriceInfo ShippingPriceInfo TaxPriceInfo AmountInfo The atg. ATG Commerce includes several classes that are implementations of the TaxPricingCalculator interface. and ShippingPriceInfo classes. The specific way in which the calculator modifies a tax price varies according to individual implementations. which are located in the atg.

quantityAsQualifier: The quantity of the item that acted as a qualifier for any discount. If using tiered pricing. and Shipping PricingEngines. If it is set to true.Using and Extending Pricing Services . or the list price. • The ItemPriceInfo class contains information about the price of an item (a CommerceItem). If true. discounted: Indicates whether this quantity of items has been discounted. orderDiscountShare: The amount of all order discounts that applied to this item. the items either have no price. The calculators perform all the computations and store the results.priceItem check if the priceInfo for the object being priced has amountIsFinal=true. This method sets the amountIsFinal property and adds a PricingAdjustment to the amountInfo. For example. It also contains detailed price information about how individual quantities of the CommerceItem were priced. onSale: Indicates whether the price for an item is on sale. amountIsFinal: Indicates if the amount is final. • • • • • • • rawTotalPrice: The base price for the item.commerce. The following list describes important properties in the AmountInfo class: currencyCode: Indicates the currency of the price. currentPriceDetails: A list of DetailedItemPriceInfo objects that constitute a breakdown of the price represented by this object. This information is useful if you need to determine how the object arrived at its current price (for example. • • • amount: The raw number that represents the price. priceList: The priceList used to calculate the price. before any modifications. If the flag is false. USD indicates that the price is in US dollars. for customer service requests).pricing. and the precise individual item price can be found in the DetailedItemPriceInfo object. which are modified by the item pricing calculators and returned by the item pricing engines: • listPrice: The base price of an item before any modifications are made. this number is the average of the unit prices (total divided by quantity purchased). Calculated by multiplying the quantity by the listPrice.ItemPriceInfo class contains the following properties. pricingAdjustments: Provides an audit trail of everything that happened to the AmountInfo up to this point. 170 9 . quantityDiscounted: The quantity of the item to which any type of discount has been applied. The sum of the amounts of these DetailedItemPriceInfos should always equal this object’s amount. Order. The Tax. and the ItemPricingEngine. AmountInfo includes a method called markAsFinal(). that priceInfo is immediately returned. then this price is final and will never be recalculated. ItemPriceInfo The atg. salePrice: The sale price of an item before any modifications are made.µ • • ATG Commerce Programming Guide The AmountInfo class is designed only to hold data.

For more information on the ItemPriceInfo object. This is used for two reasons: • To split the details of items in different shipping groups. and one with the promotion that caused the item to be free. The amount property of ItemPriceInfo (inherited from AmountInfo) should always equal the sum of the amounts of the DetailedItemPriceInfo entries in currentPriceDetails. DetailedItemPriceInfo objects cannot refer to items in more than one shipping group. Instead of a detail referring to “5 items” it is more specific and refers to “the first 5 items” or “items 2-6”. Another feature of DetailedItemPriceInfo is the range property. and one for the promotion.00. The amount property of the ItemPriceInfo is the final price for the given CommerceItem. Information in this section includes how DetailedItemPriceInfo objects relate to each other and to their ItemPriceInfo. describing the changes discount B made to the price.Using and Extending Pricing Services .00 PricingAdjustment: set to the list price. If part of the quantity of the CommerceItem was discounted due to a promotion. One DetailedItemPriceInfo entry for the quantity of 2. there would be two DetailedItemPriceInfo objects: DetailedItemPriceInfo object #1: quantity: 9 amount: $90. there would be two DetailedItemPriceInfo entries in currentPriceDetails: • • One DetailedItemPriceInfo entry for the quantity of 3. and there was a promotion “Buy 9 shirts. if an item’s quantity is 5. DetailedItemPriceInfo object #2: quantity: 1 amount: $0. The DetailedItemPriceInfo objects provide a much more detailed view of the price of the item.00 PricingAdjustment: There would be two PricingAdjustments. In the example above. DetailedItemPriceInfo This section describes DetailedItemPriceInfo objects. • During qualification of a promotion (the process of determining if a particular promotion applies to the order) we need to know which items have been looked at 171 9 . The PricingAdjustments in the ItemPriceInfo would contain one PricingAdjustment for the list price. get 1 free” then the amount property of the ItemPriceInfo would be $90. and 3 items received Discount A and the other two received Discount B. There is a range property in ShippingGroupCommerceItemRelationship. see the ItemPriceInfo section. this information is reflected in the ItemPriceInfo. For example. if the order contains 10 shirts at $10. The ItemPriceInfo object describes the price for an entire CommerceItem in an order. One with the list price.00 each.ATG Commerce Programming Guide µ For example. describing the changes discount A made to the price.

see the Qualifier Class section. This is needed to get to the ShippingGroupCommerceItemRelationships. the same sale price.The person for whom the items are to be discounted (currently ignored). The following statements are true for all CommerceItem objects: Each CommerceItem has exactly one ItemPriceInfo. 172 9 . Locale . there will only need to be one DetailedItemPriceInfo. Profile .The CommerceItem being priced. PricingModel . Item . PriceQuote .The total price for which the new DetailedItemPriceInfo objects must account. For more information. or the second shirt. PriceQuote is the ItemPriceInfo • • • • • to which the newly created details will be added. each ItemPricingCalculator has the responsibility of manipulating the DetailedItemPriceInfos correctly. and the same promotions.The locale in which the items are to be discounted (currently ignored).) is described by exactly one detail. (The same list price.createInitialDetailedItemPriceInfos This method takes the following parameters: • TotalPrice .µ • • • ATG Commerce Programming Guide and which items have already qualified a promotion.The current working price of Item.) All the items described by a DetailedItemPriceInfo are in the same shipping group. TotalPrice is the price of the entire CommerceItem (listPrice * quantity). They can usually look up a list price and multiply it by the quantity.The discount that will be set in the PricingAdjustment (usually null).detailedItemPriceTools. the first shirt. Each DetailedItemPriceInfo in the ItemPriceInfo describes the price of a quantity of items that are all priced in exactly the same way. The following sections describe how the three different types of item calculators interact with DetailedItemPriceInfos: • • • Using List Price Calculators with DetailedItemPriceInfo Objects Using Sale Price Calculators with DetailedItemPriceInfo Objects Using Item Discount Calculators with DetailedItemPriceInfo Objects Using List Price Calculators with DetailedItemPriceInfo Objects The list price calculators are responsible for calculating the price based on the list price.Using and Extending Pricing Services . • To make sure all of the above statements are true. The price of a particular item (if there are 10 shirts. etc. The logic for making sure that each detail only refers to items in one shipping group is contained in this method: pricingTools. If the entire quantity of the item is being shipped to the same place.

In this case. Locale .assignSalePriceToDetails. It is the responsibility of the caller to update the ItemPriceInfo objects. To facilitate tiered pricing. This will usually be the entire list of details. This functionality is contained in a centralized method: pricingTools.Using and Extending Pricing Services . This calculator splits the details since each quantity of the item will not necessarily get the same unit sale price. This is ignored in the default implementation. there is another version of this method that also takes a Range argument. the TotalPrice is the price for the range as opposed to the entire CommerceItem.Any extra information that this method might need to set the prices of a number of the qualifying item(currently ignored). The ItemTieredPriceCalculator will call this method once per tier. PricingModel .The discount that will be set in the PricingAdjustment (usually null). PriceQuote . The assignSalePriceToDetails method walks through each detail and adjusts the amount accordingly. This method will only modify the DetailedItemPriceInfo objects. The entire quantity gets the same price. These parameters are the only parameters required to perform list pricing and bulk pricing.detailedItemPriceTools. 173 9 . Profile . One sale calculator that does not use this method is the ItemSalesTieredPriceCalculator. Using Sale Price Calculators with DetailedItemPriceInfo Objects The calculators responsible for calculating the sale price usually change the price of the entire quantity. UnitSalePrice .This is the adjustment description used when creating all new PricingAdjustments.The adjustment description used when creating all new PricingAdjustments that is added to each new detail.The locale in which the items are to be discounted (currently ignored). This method will only modify the DetailedItemPriceInfo objects. and then modifies the amount accordingly.ATG Commerce Programming Guide µ • • ExtraParameters . There is no reason to create any new details. AdjustmentDescription .CommerceItem being priced.The list of DetailedItemPriceInfo objects that should be adjusted. Item . It is the responsibility of the caller to update the ItemPriceInfo. The total adjustment for each detail is this amount times the quantity of the detail. This means that new details will only be created for the given range. The calculator retrieves the sale price. This is taken from the ItemPriceInfo to which the newly created details will be added.The person for whom the items are to be discounted (currently ignored).Any extra information that this method might need to set the number of the qualifying item (currently ignored). AdjustmentDescription . The assignSalePriceToDetails method takes the following parameters: • • • • • • • • • DetailedItemPriceInfos . This is also ignored.The sale price for a single given CommerceItem. subtracts the list price.The current working price of Item. ExtraParameters .

Using Item Discount Calculators with DetailedItemPriceInfo Objects The calculators that are responsible for discounting the price based on a promotion usually only adjust the price for some subset of the quantity. What our implementation of the ItemDiscountCalculator does is figure out the range that is undiscounted and figure out the range that is discounted.OrderPriceInfo class contains information about the price of an order.commerce. and shipping costs. • nonTaxableShippingItemsSubtotalPriceInfos: A map of shipping group IDs to all OrderPriceInfo properties that describe the prices of the totals of the nontaxable items in the order’s shipping groups. This method takes the following parameters: • • Detail—The DetailedItemPriceInfo to split apart. which are modified by order pricing calculators and returned by order pricing engines: • taxableShippingItemsSubtotalPriceInfos: A map of shipping group IDs to OrderPriceInfo properties that describe the prices of the totals of the taxable items in the order’s shipping groups. this property does not apply. shipping: The shipping cost of the order. Ranges—The list of Ranges that should have a DetailedItemPriceInfo. including all promotions. It creates a new DetailedItemPriceInfo for the undiscounted portion and set its quantity to the number of undiscounted items. Therefore. manualAdjustedTotal: The total value of manual adjustments on the order.pricing. total: The current working total. OrderPriceInfo The atg. The size of these must equal the quantity of Detail. 174 9 . it calls pricingTools. It modifies the current detail to be discounted and changes its price. Manual • • adjustments are applied using the Commerce Service Center.Using and Extending Pricing Services . tax: The tax on the order. the ItemDiscountCalculator frequently splits details.detailedItemPriceTools.µ ATG Commerce Programming Guide Therefore it usually splits each detail to maintain the property that each item in a detail was priced in exactly the same way (this includes having the same unit sale price). • • • • rawSubTotal: The subtotal of the order before applying order-level promotions. with each detail. shippingItemsSubtotalPriceInfos: A map of shipping group IDs to all OrderPriceInfo properties that describe the prices of the shipping groups. This method takes the current detail and creates enough new details so that there is one per Range that is passed in. Then. All the details are returned. tax.splitDetailsAccordingtoRanges. The OrderPriceInfo class contains the following properties. if you are not using that application.

and other configuration functionality. Tax. countyTax: Indicates any county tax.TaxPriceInfo class represents tax price information. and Shipping Pricing Engine Classes ItemPricingEngineImpl ShippingPricingEngineImpl TaxPricingEngineImpl OrderPricingEngineImpl PricingEngineService The PricingEngineService class is a GenericService implementation of a PricingEngine.service. stateTax: Indicates any state tax.ATG Commerce Programming Guide µ ShippingPriceInfo The atg.pricing. locale. which are modified by tax pricing calculators and returned by tax pricing engines.commerce. The TaxPriceInfo contains the tax price information for only the items that appear in that shipping group.ShippingPriceInfo class contains information about the price of a ShippingGroup. which is modified by shipping pricing calculators and returned by shipping pricing engines: • rawShipping: Represents the shipping price before any promotions or adjustments are applied. The PricingEngineService class contains the following properties: • scheduler: The atg.pricing. which are then passed to into pricing engine methods. • • • • • Pricing Engine Classes This section describes the following pricing engine classes: • • PricingEngineService Item. Re-running the query generates a new list of global promotions. countryTax: Indicates any country tax. • 175 9 . Order. It contains the following properties. TaxPriceInfo The atg.scheduler.Using and Extending Pricing Services .commerce.Scheduler that this service uses to run the globalPromotionsQuery. updateSchedule: The schedule for running the globalPromotionsQuery. districtTax: Indicates any district or territory tax. It contains the following property. global promotions. cityTax: Indicates any city tax. PricingEngine implementations can extend this class to leverage scheduling. • shippingItemsTaxPriceInfos: A map of shipping group IDs to TaxPriceInfo objects.

A promotion that this engine uses as a pricing model must be of one of the types in promotionItemTypes. The engine invokes one or more preCalculators to provide a base price to which subsequent calculators can then apply a discount. Order. invoking a series of OrderPricingCalculators. This property is configured based on the class extension. It computes the price of items both individually and in a larger context. and to have the query return all promotions whose global property value is true. The ShippingPricingEngineImpl class is an implementation of the ShippingPricingEngine interface. As described earlier in How Pricing Services Generate Prices. which is described in the previous section. invoking a series of TaxPricingCalculators. each engine calls a series of calculators as follows: 1. It invokes a series of ItemPricingCalculators.Using and Extending Pricing Services . The TaxPricingEngineImpl is an implementation of the TaxPricingEngine interface. For example. • • • Each of these implementation classes also extends the abstract class. promotionItemTypes: An array of item descriptor names in the repository shown in the promotionsRepository property. It computes the shipping cost for an order by invoking a series of ShippingPricingCalculators. It computes the price for an order. promotionsRepository: The name of the repository that holds the promotions this engine can use. pricingModelComparator: The comparator used to sort promotions. It invokes them on the input pPriceQuote in the order in which they appear in its preCalculators property. ItemPricingEngine sets this to ItemPriceInfo. pricingModelProperties: A configuration bean that holds the name of every property of a pricing model RepositoryItem. It computes the tax for an order. • • • • • ATG Commerce Programming Guide defaultLocale: The default locale in which this pricing engine should generate priceInfoClass: The class of the prices that this engine generates. and Shipping Pricing Engine Classes The following four classes are implementations of their respective pricing engine interfaces: • The ItemPricingEngineImpl class is an implementation of the ItemPricingEngine interface. profileProperties: A list of profile properties to be checked for active promotions. PricingEngineService. The OrderPricingEngineImpl class is an implementation of the OrderPricingEngine interface. • Item. globalPromotionsQuery: An RQL query that is run on the promotionsRepository to return all promotions that should always be taken into account in every pricing. Tax. 176 9 .µ • • prices. A typical way to mark global promotions is to have assign all promotions in the promotionsRepository a boolean property global.

(Discount calculators are specified in a promotion’s pricingCalculatorService property. and shipping pricing engines to calculate prices. tax.) Finally the engine invokes any postCalculators configured for it. Again.Using and Extending Pricing Services . Pricing Calculator Classes These classes are used by the ATG Commerce item. invoking the discount calculators from each one. The engine uses its getPricingModels method to extract any promotions from the customer’s profile. They can be extended according to your pricing needs. and then it processes the promotions one at a time. It invokes them on the input pPriceQuote in the order in which they appear in its postCalculators property.ATG Commerce Programming Guide µ (Each type of engine calls its corresponding type of precalculator – for example. each pricing engine calls postcalculators of its own type. order. 3. • • DiscountCalculatorService Item Calculator Classes ItemPriceCalculator ItemDiscountCalculator ItemDiscountMultiplierCalculator ItemListPriceCalculator ItemSalePriceCalculator ConfigurableItemPriceCalculator • Order Calculator Classes OrderDiscountCalculator OrderSubtotalCalculator • Shipping Calculator Classes ShippingCalculatorImpl ShippingDiscountCalculator PriceRangeShippingCalculator DoubleRangeShippingCalculator FixedPriceShippingCalculator PropertyRangeShippingCalculator WeightRangeShippingCalculator • Tax Calculator Classes NoTaxCalculator TaxProcessorTaxCalculator 177 9 . the OrderPricingEngineImpl calls OrderPricingCalculators and the TaxPricingEngineImpl calls TaxPricingCalculators.) 2.

the discount type. which can extend this class to eliminate redundant configuration code. ItemPriceCalculator The abstract class atg. This functionality is used by all discount calculators. and the current price.commerce. The ItemPriceCalculator class also contains the following properties: • loggingIdentifier: The ID that this class uses to identify itself in logs.pricing. For more information. The adjust method can be used as a quick way to apply a discount. and the discount amount.DiscountCalculatorService class is an extension of GenericService. • • pricingModelProperties: Points to a configuration bean that holds the names of all the properties of a pricing model repository item. so classes that extend it have access to Nucleus logging services. negativeAmountException: ATG Commerce never discounts the price of an object to less than zero. consolidating the functionality that these calculators have in common. the discount amount. False: (default) Log a warning message and set the amount to 0.pricing.Using and Extending Pricing Services . True: Throw an exception when a discount causes an amount to be negative. ItemListPriceCalculator and ItemSalePriceCalculator).0 when a discount causes an amount to be negative. Extending classes implement this method to leverage the other item pricing functionality that this class provides.commerce. This property determines what happens when a discount would cause the amount to be negative. see Qualifier Class. 178 9 .ItemPriceCalculator is the parent class for many item pricing calculators (for example. DiscountCalculatorService computes a price based on the type of discount. It contains a single abstract method: priceItems. ItemPriceCalculator extends ApplicationLoggingImpl. The following list describes important properties in the DiscountCalculatorService class: • qualifierService: Specifies the Qualifier service that performs the actual evaluation of the discount rule against the running environment.µ • Price List Calculator Classes Price List ItemListPriceCalculator Price List ItemPriceCalculator Price List ItemSalesPriceCalculator ATG Commerce Programming Guide Price List ConfigurableItemPriceListCalculator Price List ItemSalesTieredPriceCalculator Price List ItemTieredPriceCalculator DiscountCalculatorService The atg. This class determines a price for an object based on a pricesource object and the properties of that pricesource. It calculates a price based on an existing price. It holds information common to all the discount calculators.

In this example. The catalogRef property of items to be priced points to a SKU in the SKU catalog. getPriceSource returns the productRef property. see the atg. Examples of How Classes that Extend ItemPriceCalculator Determine Prices The ItemListPriceCalculator extends ItemPriceCalculator. the priceSource object is the catalogRef property of the item to be priced. That SKU has the following properties: • • • color = blue itemType = shorts listPrice = 10. • priceFromCatalogRef: If this property is true.Using and Extending Pricing Services . The productRef property points to a product in the product catalog. • ItemPriceCalculator determines an item’s price based on a property value.commerce.ATG Commerce Programming Guide µ • pricePropertyName: The name of the property of the priceSource that represents an item’s price. If false. which extend ItemPriceCalculator) identifies the property on the priceSource object (the SKU or product) which contains the price for the current item. For more information. If priceFromCatalogRef is false.order. getPriceSource: Returns the catalogRef property of the input CommerceItem if priceFromCatalogRef is true. • • If true. • requirePriceValue: If this property is true. The pricePropertyName in the ItemPriceCalculator (and therefore the ItemListPriceCalculator and ItemSalePriceCalculator. the priceSource object is the productRef property of the item to be priced. In this example. this particular Itemlistpricecalculator looks at the item’s catalogRef property (SKU) and retrieves the value of 179 9 . If this property is false. The priceSource is the value returned from the getPriceSource property. getPriceSource returns the catalogRef property of the input CommerceItem.00 When a CommerceItem is passed to the ItemListPriceCalculator. an exception is thrown if the priceSource of the CommerceItem does not have its pricePropertyName property set. The priceSource object can be one of two objects. The property value comes from a priceSource object. the ItemListPriceCalculator is set with the following properties: • • priceFromCatalogRef=true (indicating it will get its property from a SKU) pricePropertyName=listPrice.CommerceItem entry in the ATG API Reference. depending on the boolean value of the priceFromCatalogRef property. the SKU catalog contains a SKU that identifies blue shorts. getPriceSource returns the productRef property. The ItemListPriceCalculator and ItemSalePriceCalculator read this value and return a price object that contains the price.

where N is the adjuster amount defined in a PricingModel. and it would show that the ItemSalePriceCalculator was responsible for the change. When an item is passed to the ItemSalePriceCalculator. which is a boolean property on the priceSource object that indicates whether the item is on sale. a percentage. it has a catalogRef property that points to a SKU from the SKU catalog.00 and registers that a change has been made to the price. refer to the Default Item Discount Calculator section. The ItemSalePriceCalculator works almost the same way.pricing. The adjustment would be -3.ItemDiscountCalculator class calculates the new price for an item or items based on a given pricing model. The calculator then gets the sale price using the SKU’s salePrice property. The price in this case is 7. and $5 is taken off the price. The 180 9 . For more information on the default implementation of this class.Using and Extending Pricing Services . The onSalePropertyName property of ItemSalePriceCalculator is set to onSale. it uses the value of the SKU’s onSale property to determine if it’s on sale. which in this case is an ItemPriceInfo.00 and returns it.pricing. The ItemSalePriceCalculator has an additional property called onSalePropertyName. In this example.00). The calculator then modifies the input price for the item to be 7.00. The discount can be a fixed amount.00 When the ItemSalePriceCalculator receives this item.00 onSale=true salePrice=7.µ ATG Commerce Programming Guide that object’s listPrice property (10. if an item originally costs $20. A SKU in the SKU catalog has a property called onSale. For example.ItemDiscountMultiplierCalculator class adjusts the amount of a discount by factor N. The ItemDiscountCalculator inherits all the properties of DiscountCalculatorService. or a fixed price. In this example. If a SKU were on sale.00. ItemDiscountCalculator The atg. It calls Qualifier. The pricePropertyName property is set to salePrice. the priceFromCatalogRef property of ItemSalePriceCalculator is set to true. ItemDiscountMultiplierCalculator The atg.commerce.commerce.findQualifyingItems to get this list. the value is true. indicating that the SKU is on sale. This registering is done by creating a new PricingAdjustment and adding it to the adjustments property of the price object. The ItemDiscountCalculator class performs this discounting by consulting the Qualifier service for a list of items that should receive the input discount. the new price is $15. • • • • • color=blue itemType=shorts listPrice=10. the onSale property would be set to true. It applies the discount that the pricing model describes to the price in the ItemPriceInfo corresponding to each passed CommerceItem. The ItemListPriceCalculator then modifies the input price to be 10.

with this calculator providing a starting price for other calculators.pricing.Using and Extending Pricing Services .commerce. ItemListPriceCalculator The atg. If the configurable item is on sale then the sale price will also be modified. The ItemPriceCalculator section includes an example of how the ItemSalePriceCalculator determines a price.” The parent class.pricing. refer to the Default Item Discount Multiplier Calculator section.commerce. This class extends the ItemPriceCalculator. 181 9 .ItemListPriceCalculator class is a calculator that determines the list price of an item and sets the itemPriceInfo to that amount. is used to determine which items qualify for getting a double discount. This class also maintains the audit trail of the ItemPriceInfo.ItemSalePriceCalculator class extends the ItemPriceCalculator. It calculates the list price of a configurable item and sets the itemPriceInfo to that amount.ConfigurableItemPriceCalculator class extends the ItemPriceCalculator. If the number N is 2. the new discount amount would be $10 and the new price would also be $10. It determines the sale price of an item and discounts the itemPriceInfo to that amount. For more information on the default implementation of this class. It computes the price of the configurable item by adding up the price of all the individual subSKUs and the price of the configurable SKU. This sets the list price with the prices of the subSKUs that are configured in the configurable item.ATG Commerce Programming Guide µ ItemDiscountMultiplierCalculator takes this discount amount and multiplies it by the number N. The ItemListPriceCalculator sets the listPrice property of the input price object to the input Price. all input items are discounted to the sale price. There is no rule associated with this calculator. The list price is determined based on the value returned from the getPriceSource property. This calculator could be used to create promotions such as “Double Coupon Days. ItemSalePriceCalculator The atg.commerce. Then the overridden adjust method defined in this class determines the new adjustment. The ItemPriceCalculator section includes an example of how the ItemListPriceCalculator determines a price. The ItemSalePriceCalculator class also contains the following property: • onSalePropertyName: The boolean property of the price source that determines if the price source is on sale.pricing. This is typically the first in a series of calculations. If one of the pricing methods of ItemSalePriceCalculator is invoked. ItemDiscountCalculator. A price source is the catalogRef or productRef of a CommerceItem. ConfigurableItemPriceCalculator The atg.

ShippingDiscountCalculator The atg. such as gift certificates. For more information on the default implementation of this class. If it gets back an order.findQualifyingShipping. The order’s subtotal is always calculated by summing the prices of the items in the order. soft goods. This calculator consults the Qualifer service for the ShippingGroup to be priced.ShippingCalculatorImpl class is an abstract class that acts as a starting point for general price calculation in shipping groups.OrderDiscountCalculator class implements the OrderPricingCalculator. This option is useful for situations in which you do not want to give customers a choice of different shipping methods. If there are items to price for shipping. It calculates OrderPriceInfo values for orders when the calculator is invoked.commerce. should not be priced for shipping. For example.pricing. for example UPS Ground. looking for the order to be priced by calling Qualifier. This calculator consults the Qualifer service. For more information on the default implementation of this class. If it gets back a ShippingGroup. 182 9 . the price quote is reset to zero. it is ignored.commerce. this calculator always attempts to perform pricing. refer to the Default Shipping Discount Calculator section. the amount returned is added to the current ShippingPriceInfo amount.pricing. In addition. Set the shippingMethod property to the name of a particular delivery process that your site offers. If a pricing model is passed in.OrderSubtotalCalculator class computes the rawSubtotal and amount of an OrderPriceInfo that corresponds to the input order. If the ignoreShippingMethod property is true. ShippingCalculatorImpl The atg. there is no rule that determines whether the subtotal should be calculated. OrderSubtotalCalculator The atg. When extending this class. If there are no items.commerce. the performPricing method confirms that the items in the group should be priced. an OrderPriceInfo is computed based on the input PricingModel (RepositoryItem).Using and Extending Pricing Services .findQualifyingOrder. The implementation of priceShippingGroup checks that there are items in the shipping group. implement the getAmount method as the base shipping cost in this calculator. Unlike in the case of discount calculators. it computes a ShippingPriceInfo based on the input PricingModel (RepositoryItem).pricing. It calls Qualifier.ShippingDiscountCalculator class calculates ShippingPriceInfos for specified ShippingGroups. UPS 2-day or UPS Next Day.µ OrderDiscountCalculator ATG Commerce Programming Guide The atg. This behavior allows for the addition of surcharges. refer to the Default Order Discount Calculator section.pricing. then the calculator does not expose a shipping method name (through getAvailableMethods). The amount returned is set into the ShippingPriceInfo.commerce. If the addAmount property is true.

ATG Commerce Programming Guide µ PriceRangeShippingCalculator The atg. ignoreShippingMethod: Setting the ignoreShippingMethod property to true prevents this calculator from exposing the shipping method name (through getAvailableMethods).\ 31.00 Note: The keyword MAX_VALUE indicates the maximum possible value in the range.00:15.99:4. instead of setting the price quote amount to the value of the amount property.commerce.00:30.DoubleRangeShippingCalculator class is an abstract shipping calculator that determines the shipping price by comparing a value from the ShippingGroup to a series of ranges.\ 31. this calculator always attempts to perform pricing. and WeightRangeShippngCalculator classes.50.00:MAX_VALUE:10.99:6.\ 16. UPS 2-day or UPS Next Day.PriceRangeShippingCalculator class determines the shipping price based on the subtotal of all the items in the shipping group.00:30. the calculator adds the amount to the 183 9 .pricing. With the given array of price range configurations (format: low:high:price).00:40.commerce. The service is configured through the ranges property.\ 41.25.Using and Extending Pricing Services .99:6. This can be used to configure a “surcharge” calculator. PropertyRangeShippingCalculator.00.00. It is extended by the PriceRangeShippingCalculator. the service parses the values into their double format for calculating shipping costs. For example: ranges=00. • • shippingMethod: The shippingMethod property is set to the name of a particular delivery process.50.99:4.00:15. which increases the shipping price.00:MAX_VALUE:10.\ 16.25.00:40. the calculator adds the amount to the current amount in the price quote. The PriceRangeShippingCalculator also contains the following properties: • addAmount: If the property addAmount is true. DoubleRangeShippingCalculator This atg. The DoubleRangeShippingCalculator also contains the following properties: • addAmount: If the property addAmount is true.99:7.\ 41. With the given array of price range configurations (format: low:high:price) the service parses the values into their double format for calculating shipping costs. instead of setting the price quote amount to the value of the amount property. For example: UPS Ground. For example: ranges=00.99:7. This option is useful for situations in which you do not want to give customers a choice of different shipping methods.pricing.00 Note: The keyword MAX_VALUE indicates the maximum possible value in the range. The service is configured through the ranges property. In addition.

commerce. ATG Commerce calculates a total of 3 and uses the ranges property to determine how much to charge. For example. In addition. In addition. you set the PropertyRangeShippingCalculator propertyName property to weight.00:MAX_VALUE:10.µ • • ATG Commerce Programming Guide current amount in the price quote.00 184 9 . which provides a shipping cost for each range. which increases the shipping price. This behavior can be used to configure a “surcharge” calculator.FixedPriceShippingCalculator class is a shipping calculator that sets the shipping amount to a fixed price. For example: UPS Ground. This option is useful for situations in which you do not want to give customers a choice of different shipping methods. this calculator always attempts to perform pricing. shippingMethod: The shippingMethod property is set to the name of a particular delivery process.\ 16.50. all items may have a property called weight that correlates to the weight of the item in pounds.00:15. instead of setting the price quote amount to the value of the amount property.Using and Extending Pricing Services . If your shipping group has 3 items. To base shipping cost on the cumulative weight total.25. for example UPS Ground.\ 41.99:6. The range property takes the format of low:high:price and holds these options: ranges=00. UPS 2-day or UPS Next Day. each of which has a weight of 1.PropertyRangeShippingCalculator class is a highly-flexible shipping calculator that identifies some item property and adds the value provided to each item in the shipping group together to create a shipping group total. the calculator adds the amount to the current amount in the price quote.commerce. The total falls into one of the ranges specified in the ranges property. This option is useful for situations in which you do not want to give customers a choice of different shipping methods. this calculator always attempts to perform pricing. FixedPriceShippingCalculator The atg.00.00:40. UPS 2-day or UPS Next Day.\ 31. PropertyRangeShippingCalculator The atg. ignoreShippingMethod: Setting the ignoreShippingMethod property to true prevents this calculator from exposing the shipping method name (through getAvailableMethods).99:4.00:30.99:7. This behavior can be used to configure a “surcharge” calculator.pricing.pricing. which increases the shipping price. ignoreShippingMethod: Setting the ignoreShippingMethod property to true prevents this calculator from exposing the shipping method name (through getAvailableMethods). • • shippingMethod: The shippingMethod property is set to the name of a particular delivery process. The FixedPriceShippingCalculator also contains the following properties: • addAmount: If the property addAmount is true.

the service parses the values into their double format for calculating shipping costs. This option is useful for situations in which you do not want to give customers a choice of different shipping methods. shipping charges total $4. • useCatalogRef: If the useCatalogRef property is set to true.\ 16. UPS 2-day or UPS Next Day.\ 41. • • shippingMethod: The shippingMethod property is set to the name of a particular delivery process.Using and Extending Pricing Services .00.50. For example. The service is configured through the ranges property. instead of setting the price quote amount to the value of the amount property. “weight” would calculate the total weight of an order by adding together the weight property values of all the items.WeightRangeShippingCalculator class is a shipping calculator that determines the shipping price based on the sum of the weights of each item in a shipping group.00:40.pricing. the calculator adds the amount to the current amount in the price quote. For example: UPS Ground. In addition. With the given array of price range configurations (format: low:high:price). the property value is extracted from the catalogRef of the CommerceItem (usually the SKU). If useCatalogRef property is set to false. • propertyName: Set the propertyName property to the name of the property that you want to add across all items.99:7. This can be used to configure a “surcharge” calculator. WeightRangeShippingCalculator The atg.00:30.\ 31. the calculator adds the amount to the current amount in the price quote. The WeightRangeShippingCalculator also contains the following properties: • addAmount: If the property addAmount is true. the product is used as the source. Note that keyword MAX_VALUE indicates the maximum possible value in the range.50.99:6. This can be used to configure a “surcharge” calculator. this calculator always attempts to perform pricing. 185 9 .ATG Commerce Programming Guide µ In this example. For example: UPS Ground.99:4. which increases the shipping price. The PropertyRangeShippingCalculator also contains the following properties: • addAmount: If the property addAmount is true. instead of setting the price quote amount to the value of the amount property.00:15.commerce. ignoreShippingMethod: Setting the ignoreShippingMethod property to true prevents this calculator from exposing the shipping method name (through getAvailableMethods). UPS 2-day or UPS Next Day.00 Note: The keyword MAX_VALUE indicates the maximum possible value in the range.25.00:MAX_VALUE:10. which increases the shipping price. For example: ranges=00. • shippingMethod: The shippingMethod property is set to the name of a particular delivery process.

tax is calculated by total order.payment. • • • • • taxProcessor: The ATG tax integration that this calculator consults for tax amounts.commerce. If false. this calculator always attempts to perform pricing.” Price List ConfigurableItemPriceListCalculator The ConfigurableItemPriceListCalculator calculator assumes the ItemListPriceCalculator has already run. The TaxProcessorTaxCalculator component is located in the ACC at atg/commerce/pricing/calculators. verifyAddresses: If true.TaxProcessorTaxCalculator class if you are setting up a site that uses third-party software such as CyberSource to handle tax calculation.tax.Using and Extending Pricing Services .pricing. For more information. TaxProcessorTaxCalculator You use the atg. TaxProcessorTaxCalculator class has the following properties: • taxStatusProperty: The property in the SKU repository that indicates whether each SKU is taxable or not. This option is useful for situations in which you do not want to give customers a choice of different shipping methods. 186 9 . Note: The default TaxProcessor for ATG Commerce is /atg/commerce/payment/DummyTaxProcessor. pricingTools: The location of the PricingTools class instance.TaxProcessor interface) to determine how much tax to charge for an order.NoTaxCalculator class creates a new TaxPriceInfo object that specifies a tax price of zero for an order. orderManager: The location of the OrderManager class instance.commerce. This class consults a TaxProcessor (an implementation of the atg. ItemListPriceCalculator calculator sets the list price and the amount of the ItemPriceInfo based on the price of the ConfigurableSku. the TaxProcessor verifies the addresses passed in before attempting to calculate tax. In addition. The ConfigurableItemPriceListCalculator calculator then iterates through the subSKUs and modifies the list price and amount accordingly. calculateTaxByShipping: If true. The default is /atg/commerce/order/OrderManager.µ • ATG Commerce Programming Guide ignoreShippingMethod: Setting the ignoreShippingMethod property to true prevents this calculator from exposing the shipping method name (through getAvailableMethods). refer to Integrating Third-Party Software With ATG Commerce. See Integrating CyberSource with ATG Commerce for more information. NoTaxCalculator The atg. the calculator calculates tax by shipping group. currently either CyberSourceTax or TaxWareTax.pricing. which always returns “no tax. The default is /atg/commerce/pricing/PricingTools.

then an error is thrown. 187 9 . The ItemListPriceCalculator component is located in the ACC at atg/commerce/pricing/calculators/ ItemListPriceCalculator. NullPriceListIsError: If true. then the value of the automaticallyUseDefaultPriceList property of the PriceListManager determines if the default price list is used. It has the following properties: • • • • loggingIdentifier: the ID that this class uses to identify itself in logs. pricingSchemePropertyName: the property name in the repository for the pricing scheme. then nothing happens. The ItemPriceListCalculator component is located in the ACC at atg/commerce/pricing/calculators/ItemPriceListCalculator. consider a situation when a parentSKU is $5. If we buy two of this configurable SKU. For more information on this calculator. For more information on this calculator. It first selects the priceList to use based on the profilePriceListPropertyName property. useDefaultPriceList: If true and ProfilePriceListPropertyName is null. The ConfigurableItemPriceListCalculator component is located in the ACC at atg/commerce/pricing/calculators/ConfigurableItemPriceListCalculator. If false. After the ConfigurableItemPriceListCalculator calculator runs the listPrice will be $8 and the amount will be $16.Using and Extending Pricing Services . The ItemPriceCalculator then delegates the pricing to different ItemSchemePriceCalculators based on the item’s pricing scheme by the pricingSchemePropertyName property. and the price list is null or there is no price in the • price list. The pricing scheme for that item is list pricing. and the price list is null. For more information on this calculator. • • priceListManager: points to the location of the PriceListManager. If false.ATG Commerce Programming Guide µ For example. Price List ItemPriceCalculator The ItemPriceCalculator class can either price a single commerce item or price a list of commerce items. See the Price List Calculators section of the Using Price Lists section of this chapter. See the Price List Calculators section of the Using Price Lists section of this chapter. then the default price list is never used. See the Price List Calculators section of the Using Price Lists section of this chapter. subSKU A is $2 and subSKU B is $1. then coming into this calculator the listPrice will be $5 and the amount will be $10. Price List ItemListPriceCalculator A calculator that determines the list price of an item and sets the itemPriceInfo to that amount. profilePriceListPropertyName: the property name in the repository for the user’s price list. pricingSchemeNames: the Map whose key is the allowed scheme names and whose value is the corresponding calculators.

The Qualifier checks on whether anything qualifies for the discount and then figures out which pieces should receive the discount. For more information on tiered pricing. The pricing scheme for that item is tier pricing.Qualifier class is a helper class for discount calculators. The ItemSalesTieredPriceCalculator implements the SalePriceListsTieredCalculator component. which is located in the ACC at atg/commerce/pricing/calculators/PriceListsTieredCalculator.Using and Extending Pricing Services . Note. see the Using Price Lists section of this chapter. the calculator passes to the qualifier the parameters that make up its pricing context. Price List ItemSalesTieredPriceCalculator A calculator which determines the sales tiered price of an item and sets the itemPriceInfo to be that amount. The ItemTieredPriceCalculator implements the PriceListsTieredCalculator component. because Qualifier extends atg. In addition. See the Price List Calculators section of the Using Price Lists section of this chapter. For more information on this calculator. • ItemDiscountCalculator uses the qualifier’s findQualifyingItems method. The calculator goes through the result set returned by the qualifier. The Qualifier does not modify the actual prices. The definition of tiered pricing can be referenced in ItemTieredPriceCalculator. For more information on this calculator. 188 9 .commerce. discounting each element with an appropriate value. it only decides what should change.GenericService. Qualifier Class The atg.nucleus. which returns a list of QualifiedItems. that the calculator alone determines the new price. findQualifyingItems returns a Collection.pricing. see the Price List Calculators section of the Using Price Lists section of this chapter. For more information on this calculator. An instance of the Qualifier class is sometimes referred to as a qualifier service. See the Price List Calculators section of the Using Price Lists section of this chapter. which is located in the ACC at atg/commerce/pricing/calculators/SalePriceListsTieredCalculator. Price List ItemTieredPriceCalculator The ItemTieredPriceCalculator determines the tiered price of an item and sets the itemPriceInfo to that amount. The ItemSalesPriceCalculator implements the SalePriceListsListCalculator component. Each calculator calls its corresponding helper method in the Qualifier class to determine the objects to which it should apply the discount. It does not decide how they should change. however. which is located in the ACC at atg/commerce/pricing/calculators/SalePriceListsListCalculator.µ Price List ItemSalesPriceCalculator ATG Commerce Programming Guide The ItemSalesPriceCalculator sets the sales price for a commerce item.

The Qualifier class can be extended. Each method determines it result set by comparing the PMDL rule of a given promotion (a RepositoryItem) to the input environment.ATG Commerce Programming Guide µ The component type of this collection is QualifiedItem. QualifiedItem maps a DetailedItemPriceInfo to the list of Ranges that qualified for the discount. see Creating Promotions. The ItemDiscountCalculator calls the findQualifyingItems method in the Qualifier class and passes the current pricing context into the helper method’s input parameters.Using and Extending Pricing Services . 3. Qualifier Properties The Qualifier class contains the following properties: • • pmdlCache: The cache that maps pricing model RepositoryItems to their parsed PMDL bean representations. a rule might define a discount in which a customer receives three items for the price of one.) The following steps describe how an existing calculator and its corresponding Qualifier class method (in this case. (For more information on promotions and PMDL rules. the calculator is ItemDiscountCalculator. For example. 4. 2. 1. see the QualifiedItem Class. The promotion contains a PMDL rule that describes the discount. pricingModelProperties: A list of the names of the properties of a pricing model RepositoryItem. For more information. 5. • • OrderDiscountCalculator uses the qualifier’s findQualifyingOrdermethod. If the pricing context matches the conditions specified in the PMDL rule. A pricing engine uses its getPricingModels method to retrieve a promotion from a customer profile. ItemDiscountCalculator and the findQualifyingItems method) work together to generate a price for an item. 189 9 . If you create a new type of pricing calculator. For more information. ShippingDiscountCalculator uses the qualifier’s findQualifyingShipping method. the findQualifyingItems method returns a list containing one or more CommerceItems to discount. refer to Extending the Qualifier Class. you may need to extend the Qualifier class by adding a new helper findQualifyingxxx method for the new calculator. The CommerceItem containing these DetailedItemPriceInfos is also stored. In this example. which returns a MatchingObject identifying the Order to discount. The ItemDiscountCalculator inspects the input discount and generates a new price for each item in the returned list. which returns a MatchingObject object identifying the ShippingGroup to discount. The promotion’s pricingCalculatorService property specifies the calculator to use to determine the amount of the discount.

The default is true. If it is true. If this property is set to true (the default value). or if the promotion hasn’t been used elsewhere in the order. which is called by the Qualifier.filterShippingForTarget protected method. (The Qualifier. then the orange is list price. negative prices cannot act as qualifiers. and the shipping group cannot use the promotion. banana and plum to $1 each. get 1 apple for $1 Promotion #2: Buy 1 apple. it then checks to see if the promotion has been used elsewhere in the order.) filterShippingForTarget: Determines whether the shipping group can receive the discount. it masks the filterForQualifierDiscountedByCurrentDiscountId property. zero prices cannot act as qualifiers. the method returns true. the following three promotions are being applied to an order: Promotion #1: Buy 1 orange.findQualifyingShipping method. and the banana is list price (since the apple was discounted). see Replacing the Way a PMDL Rule Is Evaluated.Using and Extending Pricing Services . • filterForQualifierOnSale: Indicates whether items that were priced with a sale price should be allowed to act as qualifiers.µ • ATG Commerce Programming Guide The following Qualifier class properties determine the objects that the evaluateQualifier method can use to evaluate the qualifier element of a PMDL rule. (For more information. This property is set to False by default. and one plum. get 1 plum for $1 The order in this example is for one orange. then the orange is list price discounting the apple. the method returns false. get 1 banana for $1 Promotion #3: Buy 1 banana. discounting the plum to $1. The value of the filterQualifierDiscountedByAnyDiscountId changes the way the promotions are applied in the following ways: If filterQualifierDiscountedByAnyDiscountId is false.) filterForQualifierNegativePrices: Determines whether items with negative prices can act as qualifiers. The shipping group can use the promotion. The following example demonstrates how the filterForQualifierDiscountedByAnyDiscountId works. one banana. If this property is set to true (the default value). checks the value of the promotion’s oneUsePerOrder property. If this property is set to true (the default value). If this property is set to true (the default value). In this example. filterForQualifierZeroPrices: Determines whether items with zero prices can act as qualifiers. If it has. discounting the apple to $1. 190 9 . items discounted by the current discount cannot act as qualifiers. • filterForQualifierDiscountedByAnyDiscountId: Determines whether items discounted by any discount can act as qualifiers. one apple. If the oneUsePerOrder property is false. filterForQualifierDiscountedByCurrentDiscountId: Determines whether • • • items discounted by the current discount can act as qualifiers. If filterQualifierDiscountedByAnyDiscountId is true.

The default value is true. Evaluating Qualifiers Example This section describes how qualifiers are evaluated using a “buy 1 get 1 free” example.) • • • filterForTargetNegativePrices: Determines whether items with negative prices can act as qualifiers. the promotion points to the ItemDiscountCalculator. The pricing engine calls the calculator specified in the promotion. filterForTargetZeroPrices: Determines whether items with zero prices can act as qualifiers. the shirt is priced at $10. see Replacing the Way a PMDL Rule Is Evaluated. filterForTargetPriceLessThanOrEqualToPromotionPrice: Determines whether items with prices that are already less than the price that would be granted by a “fixed price” promotion should receive the promotion.00. (For more information. The ItemPricingEngine iterates through each of the promotions. 2. The default value is true. this has no effect on the price. The default value is true. filterForTargetDiscountedByCurrentDiscountId: Determines whether items that have been discounted by the current discount can receive the discount again. The default value is true. the “Buy 1 shirt. • filterForTargetActedAsQualifierForAnyDiscount: Determines whether items that have acted as a qualifier for any discount can receive the current discount.00. • • filterForTargetOnSale: Indicates whether items that were priced with a sale price should be allowed to receive the current discount. In this example.00 and the list price of the hat of $5. The default value is false. The default value is true. Because neither item is on sale. In this example. The default value is true. the following occurs during item pricing: 1.ATG Commerce Programming Guide µ The following Qualifier class properties determine the items that the evaluateTarget method can use to evaluate the target element of a PMDL rule. This example uses a promotion of type “Item Discount . This will update the ItemPriceInfo for both the CommerceItem objects in the order.Fixed price” where the fixed price is $0. Based on the list prices.00 and the hat will be priced at $5. The priceItems method of this 191 9 . The ItemSalePriceCalculator looks up the sale price of each item in the order. The ItemPricingEngine iterates through each of the pre-calculators: The ItemListPriceCalculator looks up the list price of each item in the order.Using and Extending Pricing Services . get 1 hat free” promotion is the only promotion.00 and the PMDL rule is: Condition: When order contains at least 1 (product named Shirt) Apply discount to: up to 1 (product named Hat) If the list price of the shirt is $10. filterForTargetDiscountedByAnyDiscountId: Determines whether items that • have been discounted by any discount can receive the discount again.

The value is null because it’s not pricing a shipping group. findQualifyingItems performs the following functions (as well as some standard parameter verification and error checking): wrapCommerceItems . There are three choices for the 192 9 . In this example. this method returns Boolean. This is null if the item price is being retrieved for displaying within the catalog. In this example.runs through the list of the qualifier filters. The user’s locale.Using and Extending Pricing Services . The reason this is a boolean value is because this is a when rule. shippingPriceInfo The costs associated with the shipping group that is being priced.µ ATG Commerce Programming Guide calculator calls findQualifyingItems.TRUE. items List of CommerceItem objects. none of the qualifiers apply. The value is null because it’s not pricing a shipping group. get 1 hat free profile The current profile object.creates FilteredCommerceItems for each item filterItemsForQualifier . This calls QualifierService. The value is null because it has not been calculated yet. The current order being priced. locale order orderPriceInfo The order’s price shippingGroup The shipping group that is being priced.findQualifyingItems. Current promotion Shirt and hat pricingModel Buy 1 shirt. evaluateQualifier .The following arguments are passed to evaluateQualifier: Description priceQuotes Value in this example $10 and $5 A list of the two ItemPriceInfo objects.

(filterItemsForTarget). currency-related methods for use by all pricing engines. Call evaluateTarget. and for. Refer to Extending the ItemDiscountCalculator for more in formation on the uses of this class.pricing. Note: Because this promotion involves a when rule. Item pricing is now complete.findQualifyingItems method. qualifyingDetailsMap: A map keyed by the DetailedItemPriceInfo objects contained in the ItemPriceInfo object (which. This method goes through each detail of each item that qualifies (there is only one in our case) and updates the price. we would first determine which DetailedItemPriceInfo(s) acted as the qualifier.commerce. Assuming none of the target filters applied. The item will be a MatchingObject whose matchingObject property is the hat CommerceItem and whose quantity property is 1. Because the promotion is valid. evaluateQualifier returns a boolean value.ATG Commerce Programming Guide µ condition: always. QualifiedItems are returned from the Qualifier.Using and Extending Pricing Services . The values are Range objects which specify which item prices in each DetailedItemPriceInfo will receive the discount. In the case of always and when. so it calls priceQualifyingItems.PricingTools class performs a variety of pricing functions for different types of pricing engines. In ATG Commerce. The first step is to filter the items for the target. If this was a for rule. the list of arguments here will be the same as the list passed to evaluteQualifier. Note: If the rule were a for rule. The calculator now knows which items should receive the discount. The QualifiedItem class contains the following properties: • • item: The CommerceItem that qualified for a discount. If the promotion was “For next 1 (product named shirt)” then this method would return a List containing one MatchingObject that wrapped the “shirt” CommerceItem and had quantity 1.pricing package. QualifiedItem Class The atg. is contained in the CommerceItem). In this example. we must determine which items will receive the discount. then evaluateQualifier would return the list of items that triggered the promotion. PricingTools Class The atg. The information includes the names of the items that qualify and their quantity. we can immediately evaluate the target. the classes that extend the 193 9 .commerce. in turn.pricing. when. one item should be discounted so this method will return a List with one item in it.QualifiedItem class holds information about a CommerceItem that qualifies for a discount.commerce. The PricingTools class is the main way that business-layer logic interacts with the pricing engines and the other classes in the atg. It also has a number of static.

µ The properties of PricingTools are as follows: • • ATG Commerce Programming Guide ItemPricingDroplet class (PriceItemDroplet and PriceEachItemDroplet) use PricingTools to interface with all the ATG Commerce pricing engines. • void priceEachItem(List pCommerceItems. In addition. orders. This method calls through to the priceEachItem call of ItemPricingEngine. Collection pPricingModels. RepositoryItem pProfile. RepositoryItem pProfile. roundDown and needsRounding methods (see below). When a store using ATG Commerce needs a price for items. RepositoryItem pProfile.Using and Extending Pricing Services . the order might be discounted separately from the constituent items. An order contains one or more shipping groups when the contents of the order require shipping for delivery. and shipping is therefore not calculated for this type of order. Collection pPricingModels. An order has no shipping groups when it is delivered online. These methods consult the configured pricing engines. • void priceItem(CommerceItem pCommerceItem. shipping. Map pExtraParameters) Prices the item outside the context of an order. An item is identified as a set quantity of a SKU or product. However. • double priceOrderForOrderTotal(Order pOrder. and sets each item’s priceInfo property to be the proper price result. Locale pLocale. RepositoryItem pProfile. Map pExtraParameters) Returns the double value of the total price for all items in the order. This property is used by the round. Locale pLocale. PricingTools can be consulted to return the price. Map pExtraParameters) 194 9 . Locale pLocale. It sets each item’s priceInfo property to be the proper price result. • double priceItemsForOrderTotal(Order pOrder. roundingDecimalPlaces: Specifies the number of decimal places to which the an input price is rounded . both individually and in groups. and with no other items present. shippingPricingEngine: The pricing engine that calculates prices for shipping • groups. or tax. orderPricingEngine: The pricing engine that calculates prices for orders. Collection pPricingModels. itemPricingEngine: The pricing engine that calculates prices for items. Typically. Collection pPricingModels. PricingTools contains translation functions that identify which currencyCode goes with which locale. Tax is calculated on the order total. This method calls through to the priceEachItem call of the ItemPricingEngine. Map pExtraParameters) Prices each item as if it were in the order all by itself. PricingTools includes methods that can be called to produce prices. the price is just the sum of the prices of the items in the order. Locale pLocale. • • taxPricingEngine: The pricing engine that calculates tax for orders. This price can then be used as the price for the order containing all these items.

• OrderPriceInfo priceOrderTotal(Order pOrder. Map pExtraParameters) Computes a shipping amount in the form of a double. order total. Collection. and order prices for the input order. Locale pLocale. RepositoryItem pProfile. pTaxPricingModels. All input promotions are factored into the price. Takes into account the tax promotions passed in through pPricingModels. • double round(double pNumber) Rounds the input number to the number of decimal places specified by the roundingDecimalPlaces property. where N is the value of roundingDecimalPlaces. PricingModelHolder pPricingModels. RepositoryItem pProfile. RepositoryItem pProfile. the input number needs to be rounded. order tax. which is the sum total of prices of the constituent items. taking into account any shipping promotions. Unlike in the above method. RepositoryItem pProfile. It is important to always round if you are making a pricing 195 9 . in addition to the promotions derived from the input profile.ATG Commerce Programming Guide µ Returns the double value of the sum of the prices for all of the items in the order. Locale pLocale. The AmountInfo returned also maintains an audit trail of the adjustments made to the price by each order-level promotion. Map pExtraParameters) Computes tax. • double priceShippingForOrderTotal(Order pOrder. Map pExtraParameters) Computes item prices. additionally taking any order level discounts into account. Collection pShippingPricingModels. • OrderPriceInfo priceOrderTotal(Order pOrder. In addition. • OrderPriceInfo priceOrderTotal(Order pOrder. shipping. Locale pLocale. Collection pPricingModels. item. the tax for the order is computed. Uses the promotions already stored in the pricingModelHolder as factors in the prices. Takes into account the shipping promotions passed in by pPricingModels. • boolean needsRounding(double pNumber) Determines whether the input number needs to be rounded based on the value of the roundingDecimalPlaces property. Lastly. RepositoryItem pProfile. Locale pLocale. This method rounds numbers 1 through 4 down and 5 through 9 up. Collection pPricingModels. Map pExtraParameters) Computes a tax amount in the form of a double. • double priceTaxForOrderTotal(Order pOrder. as well as any item or order level discounts. Map pExtraParameters) Returns the AmountInfo object representing the order’s price. Collection pItemPricingModels. Locale pLocale. If the input number has more decimal places than N.Using and Extending Pricing Services . the only discounts this method takes into account are those derived from the input profile. Collection pOrderPricingModels. the shipping costs for the order are computed. and shipping costs for the input order.

first by checking the user’s price list. getCurrencySymbol and getInternationalCurrencySymbol: helper methods for code that calls into PricingTools. All CommerceItem methods call through to the wrapped item except for quantity. then falling back on the defaultLocale. and if the locale passed into the priceTotalOrder method is null. there may be comparison errors. Item points to the wrapped CommerceItem. The caller can use this method to quickly get the symbol with which the price that PricingTools returns should be displayed.pricing classes: • • • • • • FilteredCommerceItem PricingModelHolder PricingAdjustment PricingCommerceItem PricingModelProperties PMDLCacheAdapter FilteredCommerceItem Represents a CommerceItem that is currently participating in a rules evaluation in the Qualifier. use the locale passed to getPricingLocale rather than determining a locale from the price list.µ • ATG Commerce Programming Guide adjustment. 196 9 . useDefaultLocaleIfNotSpecified: If true.commerce. usePassedLocaleAsPricingLocale: if true.pricing.Using and Extending Pricing Services . defaultLocale: the locale passed in to all of the pricing engines if no other locale is passed into PricingTools. • • • Other Classes This section describes the following atg. double roundDown(double pNumber) Rounds the input number to the number of decimal places specified by the roundingDecimalPlaces property.commerce. PricingTools also has some currency and locale properties and methods: • • getPricingLocale: method that determines the locale to use for pricing.getUserLocale to determine the locale. If false. All of the existing pricing components round.FilteredCommerceItem adds two properties that are used to determine if and how the wrapped CommerceItem should participate in pricing: • quantityAsQualifierDetails: a map of DetailedItemPriceInfo objects to Range objects which state which units of the details have acted as a qualifier for something. use ServletUtil. This object holds a reference to the object it is wrapping. atg. If you create one that does not. use the defaultLocale value. Rounds all numbers beyond the specified number of decimal places to zero. The default is false.

for example. that adjusted the price. if any. this component’s initialization methods should be called so that the PricingModelHolder can query the pricing engines again for the new promotions. This is the pattern that the item pricing servlet beans use.commerce. If you create a promotion that is designed to give a discount during a user’s session. Setting the reinitializeTime property to a smaller value (2 minutes) will affect performance.PricingAdjustment class represents an element of a price’s audit trail. 197 9 . You can change this time if desired.pricing. the PricingModelHolder is resolved from the request. which accepts a PricingModelHolder. this service queries each pricing engine and loads the customer’s pricing models. the user’s promotions must be reloaded for the user to see this new discount. If no pricing models are supplied as explicit parameters. The PricingAdjustment class contains the following properties: • • adjustmentDescription: A short description of the adjustment that this object recorded. but will minimize the risk of a user missing a promotion that is added during his or her session. A PricingAdjustment is created by a pricing calculator when it modifies an AmountInfo object. Instantiate an instance of this class only as a session-scoped component that can be resolved through the request. If new promotions are given to the customer during the session. For example. You should also decrease this value if promotions are being delivered by scenarios with short delays in them. order pricing engines take only the pricing models related to order pricing. Developers should not create an instance of this class and call into the PricingTools class. You should consider changing the reinitializeTime value if new promotions are added frequently. giving a promotion two minutes after a user logs in. A chain of these objects represents all changes made to the price. The PricingTools method. Each pricing engine takes only the collection of pricing models related to its own type as a parameter.PricingModelHolder is a session-scoped component that holds all a customer’s active promotions while he or she is using the Web application. After deployment. The reinitializeTime property in the pricingModelHolder is set to reload a user’s promotions every 10 minutes by default.commerce. The pricing engine APIs define a method for collecting a customer’s pricing models. These objects appear in the adjustments list of AmountInfo.ATG Commerce Programming Guide µ • detailsRangesValidForTarget: a map of DetailedItemPriceInfo objects to the number of each details that are available for discounting basic on the exclusion rules defined by various properties in Qualifier. these collections are essentially a session cache of promotions. Because it can be resource intensive to perform this operation. PricingAdjustment The atg. pricingModel: The ID of the pricing model. PricingModelHolder atg. and the collection is retrieved.pricing. extracts individual collections and passes the collections into the appropriate pricing engines. The PricingTools class uses PricingModelHolder to perform order pricing.Using and Extending Pricing Services .

If the name of a property descriptor is changed in the ItemDescriptor that defines the pricing models in the Promotions repository. if any. By default. however. the PricingModelRepository holds all pricing models. the properties have the following names: • • • • • • displayName description creationDate startDate endDate media 198 9 .PricingCommerceItem is a simple CommerceItem used as a placeholder while pricing items. PricingCommerceItem The atg. totalAdjustment: The total adjustment. The total adjustment amount is calculated by multiplying the adjustment property by the quantity of the adjusted object. These CommerceItems cannot be used in the default order management system. The item pricing servlet beans deal with input. There may be times. and “convert” them to CommerceItems. For example. This CommerceItem cannot be added to an order. Products and SKUs are usually represented by RepositoryItems. For example. For more information.Using and Extending Pricing Services . see the ATG Commerce Service Center User Guide.µ • • • • ATG Commerce Programming Guide manualPricingAdjustment: ID of the manual adjustment that was applied to the order. PricingCommerceItem is an inexpensive CommerceItem class into which you can plug the product and SKU objects. adjustment: The unit adjustment. when you want to price an entity for a customer and no CommerceItem is available. Use the OrderManager APIs to add a CommerceItem to an order.commerce. PricingModelProperties The atg.pricing. which are plain RepositoryItems.pricing. Manual adjustments are applied by agents using CSC. This problem is most evident when prices are shown for products in the catalog. The properties of this item descriptor need to appear in the PricingModelProperties class. The PricingModelProperties class stores these names so that they may be internationalized or otherwise changed to suit a particular installation. It contains an item descriptor called pricingModel. This value is calculated by dividing the value of the totalAdjustment property by the value of the quantityAdjusted property.PricingModelProperties class contains the names of properties of the ItemDescriptor in the Promotions repository that represents pricing models. quantityAdjusted: The quantity of the object whose price was adjusted. you must change the corresponding value here as well. The price adjustment per quantity of one object.commerce. CommerceItems might have an adjustment of more than one. The pricing engines can only compute prices in the context of a CommerceItem. refer to the ATG API Reference. which the pricing engines do not handle.

pricing.Using and Extending Pricing Services . The Pricing Servlet Beans This section describes various ATG servlet beans that you can insert on site pages as required and use to perform dynamic pricing. 199 9 . • • • • • • AvailableShippingMethods Servlet Bean ItemPricingDroplet Servlet Bean PriceEachItem Servlet Bean PriceItem Servlet Bean PriceDroplet Servlet Bean ComplexPriceDroplet Servlet Bean Refer to Appendix: ATG Commerce Servlet Beans of the ATG Commerce Guide to Setting Up a Store for detailed information about these servlet beans.PMDLCacheAdapter class is an adapter that stores PricingModels as keys mapped to their Java object representations. Default Pricing Engines ATG Commerce includes four preconfigured implementations of its pricing engine classes.ATG Commerce Programming Guide µ • • • • • • • • • • • • • • URL version global priority type pricingCalculatorService adjuster PMDLRule uses beginUsable endUsable giveToAnonymousProfiles discountType allowMultiple PMDLCacheAdapter The atg. You can use these implementations as they are or adapt them for your own site development needs.commerce.

/promotion/PromotionTools profileProperties=activePromotions promotionsRepository=Promotions promotionItemTypes=\ item-discount globalPromotionsQuery=global=true AND (beginUsable IS NULL OR beginUsable <= ?0) AND (endUsable IS NULL OR endUsable >= ?0) preCalculators=\ calculators/ItemListPriceCalculator scheduler=/atg/dynamo/service/Scheduler updateSchedule=every 15 minutes in 15 minutes You can view and modify this component in the ATG Control Center. Its location is /atg/commerce/pricing/ItemPricingEngine. For more information on how to use this component.ItemPricingEngineImpl defaultLocale^=PricingTools.pricing.µ • • • • Default Item Pricing Engine Default Order Pricing Engine Default Tax Pricing Engine Default Shipping Pricing Engine ATG Commerce Programming Guide Default Item Pricing Engine The ItemPricingEngine component is a preconfigured implementation of the ItemPricingEngineImpl class. It uses the same mechanisms as the ItemPricingEngine component for determining which promotions to apply. refer to the description of ItemPricingEngineImpl in the Pricing Engine Classes section.. The following sample shows the contents of the OrderPricingEngine.pricing.commerce.commerce.properties file: 200 9 .properties file: # The ItemPricingEngine service # $class=atg. The following sample shows the contents of the ItemPricingEngine.ItemPriceInfo pricingModelProperties=PricingModelProperties promotionTools=.Using and Extending Pricing Services . It determines the price of an entire order by invoking a series of OrderPricingCalculators. Default Order Pricing Engine The OrderPricingEngine component is a preconfigured implementation of the OrderPricingEngineImpl class. It determines the price of one or more items by retrieving applicable promotions from the customer’s profile and invoking one or more ItemPricingCalculators.defaultLocale priceInfoClass=atg.

pricing.isTaxable() method. If an item is taxable.commerce..pricing. It uses the same mechanisms as the ItemPricingEngine component for determining which promotions to apply to tax. By default.isTaxable() returns true.defaultLocale priceInfoClass=atg.commerce.defaultLocale priceInfoClass=atg.properties file: # The TaxPricingEngine service # $class=atg. Default Tax Pricing Engine The TaxPricingEngine component is a preconfigured implementation of the TaxPricingEngineImpl class.OrderPriceInfo pricingModelProperties=PricingModelProperties promotionTools=. refer to the description of OrderPricingEngineImpl in the Pricing Engine Classes section.pricing.OrderPricingEngineImpl defaultLocale^=PricingTools.pricing.commerce.calculateTaxableAmount() then determines the tax by returning 0 if isTaxable returns false. For more information on how to use this component. otherwise it returns the price of the item minus its orderDiscountShare.ATG Commerce Programming Guide µ # The OrderPricingEngine service # $class=atg.commerce.TaxPricingEngineImpl defaultLocale^=PricingTools. The TaxPricingCalculator determines if an item is taxable using pricingTools.TaxPriceInfo pricingModelProperties=PricingModelProperties 201 9 . The following sample shows the contents of the TaxPricingEngine. all items are taxable. pricingTools./promotion/PromotionTools profileProperties=activePromotions promotionsRepository=Promotions promotionItemTypes=\ Order Discount globalPromotionsQuery=global=true AND enabled=true AND (beginUsable IS NULL OR beginUsable <= ?0) AND (endUsable IS NULL OR endUsable >= ?0) preCalculators=\ calculators/OrderSubtotalCalculator scheduler=/atg/dynamo/service/Scheduler updateSchedule=every 15 minutes in 15 minutes You can view and modify this component in the ATG Control Center. pricingTools. Its location is /atg/commerce/pricing/OrderPricingEngine. It determines the price of tax for an order by invoking a series of TaxPricingCalculators.Using and Extending Pricing Services .

pricing.ShippingPriceInfo pricingModelProperties=PricingModelProperties promotionTools=./promotion/PromotionTools profileProperties=activePromotions promotionsRepository=Promotions promotionItemTypes=\ Shipping Discount globalPromotionsQuery=global=true AND enabled=true AND (beginUsable IS NULL OR beginUsable <= ?0) AND (endUsable IS NULL OR endUsable >= ?0) preCalculators=\ calculators/FreeShippingCalculator scheduler=/atg/dynamo/service/Scheduler updateSchedule=every 15 minutes in 15 minutes 202 9 ..µ ATG Commerce Programming Guide #promotionTools=. The following sample shows the contents of the ShippingPricingEngine.properties file: # The ShippingPricingEngine service # $class=atg.defaultLocale priceInfoClass=atg. It determines the price of shipping for an order by invoking a series of ShippingPricingCalculators. Its location is /atg/commerce/pricing/TaxPricingEngine.. Default Shipping Pricing Engine The ShippingPricingEngine component is a preconfigured implementation of the ShippingPricingEngineImpl class./promotion/PromotionTools #profileProperties=activePromotions #promotionsRepository=Promotions #promotionItemTypes= #globalPromotionsQuery= #preCalculators=\ # calculators/NoTaxCalculator preCalculators=\ calculators/TaxProcessorTaxCalculator scheduler=/atg/dynamo/service/Scheduler updateSchedule=every 15 minutes in 15 minutes You can view and modify this component in the ATG Control Center.ShippingPricingEngineImpl defaultLocale^=PricingTools. refer to the description of TaxPricingEngineImpl in the Pricing Engine Classes section. For more information on how to use this component. It uses the same mechanisms as the ItemPricingEngine component for determining which promotions to apply.pricing.commerce.Using and Extending Pricing Services .commerce.

properties file: # The ItemPricingCalculator which calculates a discount # $class=atg.pricing. 203 9 .Fixed Price The following sample shows the contents of the ItemDiscountCalculator. Default Item Discount Calculator The ItemDiscountCalculator component is a preconfigured instance of the class atg. a preconfigured instance of the Qualifier class.ItemDiscountCalculator pricingModelProperties=/atg/commerce/pricing/PricingModelProperties qualifierService=/atg/commerce/pricing/QualifierService # negativeAmountException= The following table describes the properties of the ItemDiscountCalculator component.Using and Extending Pricing Services .ItemDiscountCalculator. refer to the description of ShippingPricingEngineImpl in the Pricing Engine Classes section. It is the default discount calculator for the following types of promotion: • • • Item Discount -.Amount Off Item Discount -. Default Pricing Calculators ATG Commerce includes four preconfigured implementations of its discount pricing calculator classes.pricing.Percent Off Item Discount -.ATG Commerce Programming Guide µ For more information on how to use this component. • • • • Default Item Discount Calculator Default Item Discount Multiplier Calculator Default Order Discount Calculator Default Shipping Discount Calculator This section also describes the QualifierService component.commerce.commerce. You can use these calculator implementations as they are or adapt them for your own site development needs. Property pricingModelProperties Description Specifies a bean that hosts the names of all of the properties of a pricing model repository item.

pricing. You can view and modify this component in the ATG Control Center.Using and Extending Pricing Services .pricing.properties file: # The ItemPricingCalculator which calculates a discount # $class=atg. It is the default discount calculator for the following type of promotion: • Item Discount – Multiplier. This property determines what happens when a discount would cause the amount of an item to be negative. refer to the description of the ItemDiscountCalculator class.ItemDiscountMultiplierCalculator. For more information.commerce.ItemDiscountMultiplierCalculator pricingModelProperties=/atg/commerce/pricing/PricingModelProperties qualifierService=/atg/commerce/pricing/QualifierService The following table describes the properties of the ItemDiscountMultiplierCalculator component. a discount amount (for example. $5) is multiplied by a given factor.0 when a discount causes an amount to be negative. True: Throw an exception when a discount causes an amount to be negative. Its location is /atg/commerce/pricing/calculators/ItemDiscountCalculator. ATG Commerce never discounts the price of an item to less than zero. 204 9 . Default Item Discount Multiplier Calculator The ItemDiscountMultiplierCalculator component is a preconfigured instance of the class atg. In this type of promotion. False: (default) Log a warning message and set the amount to 0.commerce. Property pricingModelProperties Description Specifies a bean that hosts the names of all of the properties of a pricing model repository item. N.µ qualifierService negativeAmountException ATG Commerce Programming Guide Specifies a Qualifier that performs the actual evaluation of a pmdlRule of the PricingModel against the running environment. The following sample shows the contents of the ItemDiscountMultiplierCalculator. Double coupon promotions are a common application of this type of discount.

commerce.properties file: # # The OrderPricingCalculator which calculates a discount # $class=atg. It is the default discount calculator for the following types of promotion: • • • Order Discount -. refer to the description of the ItemDiscountMultiplierCalculator class.OrderDiscountCalculator.Percent Off Order Discount -.Using and Extending Pricing Services . You can view and modify this component in the ATG Control Center. pricingModelProperties are used so you do not have to hard code the properties into a pricing model.pricing.ATG Commerce Programming Guide µ qualifierService Specifies a Qualifier that performs the actual evaluation of a pmdlRule of the PricingModel against the running environment. Its location is /atg/commerce/pricing/calculators/ItemDiscountMultiplierCalculator.pricing.Fixed Price The following sample shows the contents of the OrderDiscountCalculator.OrderDiscountCalculator pricingModelProperties=/atg/commerce/pricing/PricingModelProperties qualifierService=/atg/commerce/pricing/QualifierService # negativeAmountException= The following table describes the properties of the OrderDiscountCalculator component.commerce.Amount Off Order Discount -. Property pricingModelProperties Description Specifies a bean that hosts the names of all of the properties of a pricing model repository item. qualifierService 205 9 . Default Order Discount Calculator The OrderDiscountCalculator component is a preconfigured instance of the class atg. Specifies a Qualifier that performs the actual evaluation of a pmdlRule of the PricingModel against the running environment. For more information.

ShippingDiscountCalculator pricingModelProperties=/atg/commerce/pricing/PricingModelProperties qualifierService=/atg/commerce/pricing/QualifierService # negativeAmountException= The following table describes the properties of the ShippingDiscountCalculator component.commerce. It is the default discount calculator for the following types of promotion: • • • Shipping Discount -. For more information. You can view and modify the OrderDiscountCalculator component in the ATG Control Center.Fixed Price The following sample shows the contents of the ShippingDiscountCalculator. Specifies a Qualifier that performs the actual evaluation of a pmdlRule of the PricingModel against the running environment.Percent Off Shipping Discount -.commerce.0 when a discount causes an amount to be negative. False: (default) Log a warning message and set the amount to 0.Amount Off Shipping Discount -. refer to the description of the OrderDiscountCalculator class.ShippingDiscountCalculator. Default Shipping Discount Calculator The ShippingDiscountCalculator component is a preconfigured instance of the class atg.µ negativeAmountException ATG Commerce Programming Guide Determines what happens when discounts cause the amount of an item to be negative.pricing. Property pricingModelProperties Description Specifies a bean that hosts the names of all of the properties of a pricing model repository item.Using and Extending Pricing Services .pricing.properties file: # The ShippingPricingCalculator which calculates a discount # $class=atg. The component is located in /atg/commerce/pricing/calculators/OrderDiscountCalculator. True: Throw an exception when a discount causes an amount to be negative. qualifierService 206 9 .

refer to the description of the ShippingDiscountCalculator class. False: (default) Log a warning message and set the amount to 0.pricing.properties file: # The QualifierService which determines whether the running # environment satisfies the preconditions for a discount # and contains objects that qualify for the discount # $class=atg.0 when a discount causes an amount to be negative.pricing. Default Qualifier Service The QualifierService component is a preconfigured instance of the helper class atg.Qualifier pricingModelProperties=PricingModelProperties PMDLCache=PMDLCache The following table describes the properties included in QualifierService. Property pricingModelProperties Description Specifies a bean that hosts the names of all of the properties of a pricing model repository item. True: Throw an exception when a discount causes an amount to be negative.Qualifier. You can view and modify the ShippingDiscountCalculator component in the ATG Control Center. For more information.commerce. 207 9 . The following sample contains the contents of the QualifierService. The component is located in /atg/commerce/pricing/calculators/ShippingDiscountCalculator.Using and Extending Pricing Services . The default ATG Commerce discount calculators use this component to determine the objects to which they should apply their discount.commerce.ATG Commerce Programming Guide µ negativeAmountException Determines what happens when discounts cause the amount of an item to be negative.

For example. however. The ItemPricingEngine could be extended to get its global promotions from the integration. you could implement the expirePromotion method to send a JMS event enabling the creation of scenarios related to unused and expired promotions. After you complete your extensions. (For more information.Using and Extending Pricing Services . The relevant interfaces are as follows: • atg.service.service. you may want to disable caching for pricing models so that changes you make to PMDL rules appear on your development site immediately. you can extend ItemPricingEngineImpl to create an algorithm that prices a set of items differently from the current implementation of priceEachItem. In a development environment. You could create an algorithm that applies promotions in a random order rather than in order of ascending precedence. you can extend one or all of the implementations to alter the behavior of a method of PricingEngineService. For example. refer to the description of the Qualifier class. Extending a Pricing Engine You can extend one or more of the pricing engine implementations to provide new pricing functionality. Extending and Creating Pricing Engines ATG Commerce provides several preconfigured pricing engines (see Default Pricing Engines).µ PMDLCache ATG Commerce Programming Guide An instance of atg.ItemPricingEngine 208 9 . without requiring you to flush the cache. configure the corresponding pricing engine component to use the class.pricing. You can view and modify the QualifierService component in the ATG Control Center. Because each implementation of the PricingEngine interface extends the PricingEngineService class. locate the maximumCacheEntries property in the appropriate instance of atg.) Each engine can also be extended to leverage existing code. For example.commerce.cache.cache.Cache that maps a Pricing Model to its parsed Java form. and you can also create new pricing engines if necessary. see the description of PricingEngineService. In a production environment. caching increases site performance by allowing ATG Commerce to evaluate pricing models more quickly. For more information. A setting of -1 indicates an unlimited cache size. To disable caching for pricing models.Cache and set the property to 0. The component is located in /atg/commerce/pricing/QualifierService. You can extend these engines to fit your site’s requirements. you can extend the pricing engine to determine global promotions using a Personify or NetPerceptions integration.

ShippingPricingEngine atg.commerce. Create properties files for the HandlingPricingEngine and each of the calculators.ItemDiscountCalculator atg. Create a HandlingPricingInfo that extends the AmountInfo price holding class. the better promotion would be the one that provides a 25% discount on the shoes that cost $150. see AmountInfo.pricing.TaxPricingEngine atg. You create a HandlingPricingEngine that acts independently of the ShippingPricingEngine. you have decided you want to create a new pricing engine that prices handling costs separately from shipping. 2. For each engine with this behavior. 209 9 .pricing. 4. you can create an engine that prevents a customer from using a “25% off any full-price item” promotion during the same period.commerce. Modify the Promotions repository definition file (by default. For example. 3. Create an interface called HandlingPricingEngine that extends PricingEngine.commerce. 5.xml).PricingModelProperties.Using and Extending Pricing Services .ShippingDiscountCalculator The properties of a promotion Repository Item are in atg. include a getPricingModels method that constructs and returns a Collection in order to aid in the algorithm. For example.) Create a calculator called HandlingPricingCalculator and implementations of it that calculate and discount handling as your business requires.OrderPricingEngine atg. (For more information.commerce. Create an implementation called HandlingPricingEngineImpl that extends PricingEngineService. Add an item-descriptor for the Handling discount type and sub-descriptors for the various implementations of the HandlingPricingCalculator that you created. if one pair of shoes costs $150 and the second pair only $30.commerce. For example. In addition.pricing. the engine could ensure that the customer always uses the promotion that provides the greater savings. replacing ItemPricingEngineImpl involves implementing ItemPricingEngine.commerce. if your site is running a “Buy one pair of shoes. In the new implementation. get a second pair free” promotion. pricingModels.pricing.pricing. The Qualifier class that holds helper methods is atg. you might want to create a pricing engine that prevents people from using certain discounts at the same time while also making sure they use the best discount available.ATG Commerce Programming Guide µ • • • • • • atg. Replacing a Pricing Engine You can replace the standard implementations of the pricing engines with your own.OrderDiscountCalculator atg. 6. write a new implementation of its interface. 1. In this example.pricing.commerce. Creating a New Pricing Engine In the following example.Qualifier.pricing.commerce.pricing.

ATG Commerce Programming Guide Depending on your needs. In addition to modifying an item’s price. if you want to make calculations on order prices. and you can also create new pricing calculators if necessary. you create a class called HalfPlusOneItemDiscountCalculator that implements the ItemPricingCalculator interface. To create the new calculator. The existing ATG Commerce tools include an ItemDiscountCalculator that discounts items. The HalfPlusOneDiscountCalculator is an example of a discount calculator that leverages existing ATG Commerce functionality to perform its own unique task.pricing. assume you have identified a need for a calculator that sets an item’s price to half its current price plus one. You can extend these calculators to fit your site’s requirements. the ATG Commerce item discount calculators also do the following: • Consult the Qualifier class to determine the items to be discounted from among all the items in the environment. easily gives a “half off plus one” discount. Extending and Creating Pricing Calculators ATG Commerce provides several preconfigured pricing calculators (see Default Pricing Calculators for more information).commerce.µ 7.commerce. implement OrderPricingCalculator.pricing. None of these three options.pricing.OrderPricingCalculator atg.ItemPricingCalculator atg.ShippingPricingCalculator atg. you would have to use two different discounts: one to give 50 percent off.Using and Extending Pricing Services . To achieve that result. configure the new engine with some preCalculators that calculate the base cost of handling. In the following example. It can give a percent off a price or an amount off. however. 210 9 .TaxPricingCalculator Implement the interface that corresponds to the type of price you want to calculate. or it can set an item’s price to a fixed amount. For example. Creating a New Pricing Calculator Use the following interfaces to create a new pricing calculator that fits into the existing ATG Commerce pricing architecture: • • • • atg.commerce.pricing. and another to add 1 to that total. Adding a New Pricing Calculator This section explains how to create a new implementation of a pricing calculator interface and how to use the new calculator.commerce. A better alternative would be to create a new calculator that discounts an item’s price to half its current price plus one.

RepositoryItem pProfile. Maintain DetailedItemPriceInfo objects. return ( currentAmount / 2) + 1.getAmount(). * * @param pDetailedItemPriceInfo the details on the item being priced * @param pPriceQuotes list of itemPriceInfo * @param pItems list of commerceItems * @param pPricingModel pricing model being used to calculate price * @param pProfile users profile. In this case. Locale pLocale. The overridden findAdjustedPrice method is shown below: /** * Override the findAdjustedPrice to allow us to always compute the * new price of the input DetailedItemPriceInfo to be half its current * price plus one. Map pExtraParameters) throws PricingException { // current price of an item double currentAmount = pDetailedItemPriceInfo. not used here * @param pLocale users locale.ATG Commerce Programming Guide µ • • Maintain an audit trail of the changes made to the price using the PricingAdjustments property in the AmountInfo price object. not used here * @return a value of type 'double' * @exception PricingException if an error occurs */ public double findAdjustedPrice(DetailedItemPriceInfo pDetailedItemPriceInfo. • The HalfPlusOneDiscountCalculator leverages all the above functionality from the ItemDiscountCalculator. } // end findAdjustedPrice 211 9 . which modifies an input DetailedItemPriceInfo to be the right amount. List pItems. List pPriceQuotes.Using and Extending Pricing Services . not used here * @param pExtraParameters map of extra params. the class modifies the price of the detail to half its current price plus one. The only method it overrides is the findAdjustedPrice method. not used here * @param pOrder users order. Order pOrder. Maintain flags on the items’ prices that state whether each item has acted as a qualifier for any discount (and therefore might not be usable as the qualifier for another discount). RepositoryItem pPricingModel.

It also verifies that the item’s audit trail is maintained and. The priceQualifyingItem method modifies the price of the input item. it marks the item so that it cannot act as a qualifier for another discount. the engine invokes the calculator and modifies the input item’s price. The pricing calculator can use a pricing model (a promotion) to alter an item’s price conditionally. it is easier to replace calculators other than the ItemDiscountCalculator with other implementations of the interfaces rather than extending them. They can be extended. The findQualifyingItems method selects items to be discounted. 4. When the pricing model is passed to the ItemPricingEngine. are only implementations of various pricing calculator interfaces. 212 9 . It first calls findQualifyingItems to get items whose prices need changing. Extending Calculators You can extend any of the pricing calculators. however. The configuration invokes the calculator on the price of every item that passes through the engine. priceQualifyingItem calls each 2. the OrderDiscountCalculator is an implementation of OrderPricingCalculator and does not provide additional functionality in its implementation of that interface. you must associate it with its corresponding pricing engine. priceQualifyingItems calls priceQualifyingItem once for each input item to be priced. The following list describes the order of calls in ItemDiscountCalculator: 1. The priceQualifyingItems method modifies the prices of an input collection of items. It bases item selection on attributes of the input environment as represented by the method’s parameters. if the item acted as a qualifier for this discount calculation. You can do this in either of two ways: Add the calculator to an engine’s list of pre. The priceItems method changes the price of input items. For example.µ Using a New Pricing Calculator • • ATG Commerce Programming Guide After you have created a new calculator. This option is appropriate for discount calculators. It calls the findQualifyingItems method of the Qualifier. In most cases. It then calls priceQualifyingItems to change their price. The ItemDiscountCalculator can be extended to calculate different discounts.Using and Extending Pricing Services . Subclasses could re-implement the appropriate calculator interface just as easily. 3. Extending the ItemDiscountCalculator The ItemDiscountCalculator can be extended to calculate different discounts. The other calculators. you should re-implement OrderPricingCalculator. You can set a pricing model’s pricingCalculatorService property to the Nucleus path of an instance of the new calculator. but there is not much functionality for the subclasses to leverage.or post-calculators. It also verifies that the items’ audit trail is maintained and marks the items that acted as qualifiers for this discount calculation so that they cannot act as a qualifier for another discount. Instead of extending OrderDiscountCalculator. It provides a number of extension points.

) Extending the Qualifier Class As described in the section Qualifier Class.Using and Extending Pricing Services . The findAdjustedPrice method produces a number that is the new price of a DetailedItemPriceInfo. Override priceDetailedItemPriceInfo to change how a DetailedItemPriceInfo within an ItemPriceInfo is adjusted.Qualifier is a helper class that determines the objects that a calculator should discount. The priceDetailedItemPriceInfo method modifies the price of a detailedItemPriceInfo.pricing. If you create a new calculator. discounting details until the total number of items to discount has been reached. 6. It calls findAdjustedPrice to find the new price of the details. 5. and it returns the new price. Override findAdjustedPrice to change how the calculator determines new prices. atg. • Override findQualifyingItems to change the way the calculator finds the items to discount. This calculator computes the difference between an item’s list price and its current price and multiplies that difference by a variable. (For more information about this calculator. N. and it processes a type of object not returned 213 9 .ATG Commerce Programming Guide µ priceDetailedItemPriceInfo.commerce. You could extend the Qualifier class for the following reasons: • • • • Adding a Helper Method for a New Calculator Adding New Criteria to the Filter Methods Replacing the Way a PMDL Rule Is Evaluated Replacing the Way the Qualifier Determines the Result Set Adding a Helper Method for a New Calculator Each ATG Commerce calculator type has a helper method in the Qualifier class. It maintains the audit trail and marks the details that have acted as qualifiers. It examines the existing price and the input parameters. Override priceQualifyingItems to change how a group of ItemPriceInfos are adjusted. Multiple calculators can use the same helper method. the ItemDiscountMultiplierCalculator extends existing ATG Commerce pricing functionality by overriding the findAdjustedPrice method. You must override this method if you do not want to use the Qualifier service. • • • • For example. You can override any of these methods to provide new functionality while leveraging the existing code. Override priceQualifyingItem to change how an individual ItemPriceInfo is adjusted. see the description of the ItemDiscountMultiplierCalculator class.

findQualifyingItems. This behavior prevents a customer from buying just one item and getting that one item free. The filtering process prevents problems with pricing rules. The findQualifyingShipping method returns ShippingGroups (specifically. where XXX is the name of the object in the result set that the method returns. suppose you created a HandlingDiscountCalculator to calculate an order’s handling costs separately from its shipping costs. • filterItemsForQualifier: Every PMDL rule has a qualifier element that describes the conditions under which a discount is given. a list of QualifiedItem objects that map a CommerceItem to the number of times it qualified for a discount). If the input environment does not match the qualifier element. a MatchingObject object that identifies the shipping group to discount). the target element is not evaluated. For new helper methods.” most retailers exclude the item that acts as a qualifier from receiving the discount. Because there is an existing method in the Qualifier to process CommerceItems. the HalfPlusOneItemDiscountCalculator could reuse existing ATG Commerce code by calling Qualifier.) The filterItemsForQualifier and filterItemsForTarget methods in Qualifier implement this behavior. a MatchingObject object that identifies the order to discount). In contrast. The qualifier element is always evaluated first. Therefore.µ • ATG Commerce Programming Guide in the result set of an existing helper method. See the Using PMDL Rules section for more information. use the naming convention findQualifyingXXX. The following list shows existing helper methods and the type of object they return: The findQualifyingItems method returns a list of CommerceItems (specifically. No helper method exists for determining the handling objects to discount. Adding New Criteria to the Filter Methods The existing Qualifier helper methods use two methods to filter items out of the environment before comparing it to a promotion’s PMDLRule. you would need to create a new findQualifyingHandling method to help the HandlingDiscountCalculator. you must add a new corresponding helper method to the Qualifier class. 214 9 . filterItemsForTarget: A target element in a PMDL rule identifies objects to be • discounted from a larger pool of all available objects of the same type. The filterItemsForQualifier and filterItemsForTarget methods correspond to two parts of a PMDL rule: the qualifier rule and the target rule. • • The following example describes a situation in which a new calculator could use an existing helper method. The findQualifyingOrder method returns Orders (specifically. get one item free.Using and Extending Pricing Services . (The customer must put two items in the cart in order to get the discount. A target element is not a mandatory part of the PMDL rule. For example. You would not need to create an additional helper method for this new calculator. in the promotion “buy one item. Assume you created a HalfPlusOneItemDiscountCalculator that discounts a set of CommerceItems to half their existing price plus one.

You can change the criteria by which items are filtered out of the environment before a rule is evaluated. (For more information on these methods. the item is removed. Replacing the Way a PMDL Rule Is Evaluated. the item is removed. if there is one. discount up to 1 item that is green. ATG Commerce currently performs this selection for CommerceItems only. If an item has already acted as a qualifier. evaluateQualifier selects one blue item from the environment that acts as a qualifier. new filterOrdersForQualfiier and filterItemsForTarget methods will have to be added to the Qualifier class. your filter could allow items with a price of zero to act as qualifiers for a rule. refer to the next section. because only one Order object can be discounted. This example uses the rule “for next 1 item that is blue. the item is removed.” The filterItemsForQualifier method is invoked first. By default. is the only Qualifier method that returns a set of objects rather than a single object.Using and Extending Pricing Services . the item is removed. the filterItemsForTarget method must be invoked. ATG Commerce supports discounting multiple orders at the same time. The following example shows how the filterItemsForQualifier and filterOrdersForTarget methods work. After items are filtered out of the environment. For example.which returns a list of CommerceItems. to determine which objects among all those available should receive the discount that is enabled by the one blue item. After the filterItemsForTarget method is invoked. PMDL rules do support the use of target elements to identify Order objects from a pool of available Orders. this method uses the following criteria to remove items from the environment. the evaluateTarget method is called. However. This method returns a set of items that can receive the discount because they satisfy the target element of the rule. The filterItemsForTarget method uses the following criteria to remove items from the environment against which the target is compared: • • If an item already acted as a qualifier.) If the qualifier is satisfied.ATG Commerce Programming Guide µ findQualifyingItems. If an item already received the discount that is currently being evaluated. 215 9 . You could rewrite the filterItemsForQualifier method to remove that restriction. A PMDL rule that does not deal with CommerceItems does not need to contain a target element because it has no need to select objects from a larger pool. the evaluateQualifier method is invoked. For example. Before the target element is evaluated. the item is removed. the system invokes the target. This prevents the methods from helping to satisfy the constraints specified in the “qualifier rule” portion of the input PMDL rule: • • • If an item’s price is zero. If an item has already received the discount that’s currently being evaluated. If. in the future. there’s no need for a rule that discounts an order to have a target element.

get 1 hat free. If you extend the Qualifier class.Boolean indicating whether or not the environment matched the rule.” the “green item” element of the rule is evaluated through the evaluateTarget method. evaluateQualifier determines which objects acted as qualifiers in satisfying the rule. The evaluateTarget method is invoked only in situations where the Qualifier must select objects for discounting from a larger pool of available objects.) This situation occurs only for discounts on CommerceItems.lang. Consider the PMDL rule “When there is at least 1 blue item. read the items to discount. it can get it by calling the getWrappedItem method of the FilteredCommerceItem. Promotions can be delivered to users without any action required by the user. discount 1 green item. In this case. Replacing the Way the Qualifier Determines the Result Set You can replace the way that a helper method determines its result set by extending the Qualifier to override any of the existing findQualifyingXXX methods. findQualifyingOrder. The method returns the shirt item that satisfies the constraint. You could use a repository query to select the items that a given promotion should discount. Not all rules need qualifiers. Creating Promotions Promotions are a way of encouraging a user to make a purchase by highlighting and offering discounts on products and services. see the Evaluating Qualifiers Example section For example.” In this example. and return them. In the example “When there is at least 1 blue item. It selects one green item to discount from all the items in the environment. A 216 9 .” the “one shirt” element of the rule is evaluated through evaluateQualifier. the qualifier just returns a java.Using and Extending Pricing Services . and the extension needs access to a wrapped item. discount up to 1 green item. you might not want to use a PMDL rule to determine the objects to discount. (See the information above on filterItems for more details. For more information. For example. The evaluateQualifier method determines if the input environment (the pricing context) satisfies the constraints of the qualifier rule. The findQualifyingItems method could access the promotion. If the constraints are satisfied. Accessing FilteredCommerceItems The findQualifyingItems. The input environment is represented by the parameters passed into the method. that are responsible for evaluating different elements of a PMDL (discount) rule. The rule requires only that one blue item be in the input environment. evaluateQualifier and evaluateTarget. in the rule “Buy 1 shirt.µ ATG Commerce Programming Guide Replacing the Way a PMDL Rule Is Evaluated The Qualifier class contains two protected methods. the qualifier rule does not require a customer to buy one blue item in order to receive a discount on one green item. The list of items to discount could be stored in the promotion itself. and findQualifyingShipping methods wrap the input CommerceItems with FilteredCommerceItems.

What promotion to give: all other properties. This property has a custom property editor associated with it in the Promotions section of the ATG Control Center. Using PMDL Rules The promotions user interface consists of the standard repository editor. access the promotions interface by clicking the Promotions link under the Pricing topic. The PMDL rule editor functions exactly like any other ATG expression editor. These properties work together to form a description of what discount to give. For more information. discountType.ATG Commerce Programming Guide µ typical way to deliver a promotion is through the Scenarios module. refer to the ATG Control Center online help and the Using the Discount Rule Editor to Create PMDL Rules section. The PMDL editor allows you to create a sentence out of the available building blocks. and the mechanism by which the discount is applied. etc. This sentence describes the circumstances under 217 9 . and so on. This is defined in the pmdlRule property. including amount. In the ATG Control Center. For more information. Most of the property types should be familiar to anyone who has used an ATG platform repository editor before. These common types include strings. see the Creating and Maintaining Promotions chapter of the ATG Commerce Guide to Setting Up a Store. numbers. These properties serve the following functions: • • • Mechanism of discount: discountCalculatorService Under what conditions the promotion should be applied. Also includes the ItemDescriptor type. The new property type unique to promotions is the pmdlRule property that stores the PMDL (Pricing Model Description Language) rule.Using and Extending Pricing Services . The properties of a promotion RepositoryItem are documented in the table below. Types of Promotions There are various ways to offer special prices on products including the following: • • • • • • • Specific amount off a particular product Specific amount off a whole order Percentage amount off a particular product Percentage amount off a whole order Specific amount or percentage off a product based on an attribute Free product or free order Free shipping for a specific product See the Creating and Maintaining Promotions chapter of the ATG Commerce Guide to Setting Up a Store for more information. under which conditions it should be given. dates.

µ ATG Commerce Programming Guide which a promotion will be delivered. Shipping. an adjuster of 15 and a discountType of percentOff produce a discount of “15 percent off. Tax. and Order descriptors when you create a commerce item. If set to false. The available building blocks are listed in pull-down menus in the ATG Control Center. 218 9 .xml. Used when the relativeExpiration property is set to false. The following table describes the pricing model properties available in the Item. creationDate date any date readonly (display name: Creation date) description The date when the promotion was created. a single order may be discounted by multiple copies of the promotion. string any string none (display name: Description) Provides a short description of the item.Using and Extending Pricing Services . These descriptors are defined in /atg/commerce/pricing/pricingModels. depending on the discount type) Number by which the item is discounted. Note: This property is ignored if the global property is set to true. Consequently. For example. the system adds a copy of the promotion to the customer’s profile every time the customer performs an action that qualifies him or her to receive it. Works in conjunction with discountType to specify the discount to be applied.” Boolean true or false allowMultiple none (display name: Give to a customer more than once) Determines whether the promotion is given to a customer only once. which is located in <ATG9dir>/DCS/config/config. Note: This property is ignored if the global property is set to true. the system delivers the promotion only once.jar. If set to true. Property Name adjuster Type double Values any double Flags none (display name: Discount Price or Percentage. beginUsable date any date none (display name: Usage start date) The date that the promotion becomes effective.

endDate date any date none (display name: Distribute through) The date that the promotion stops being delivered to people. global Boolean true or false none 219 9 . Note: This property is ignored if the global property is set to true. Note: This property is ignored if the global property is set to true. then anonymous visitors and registered visitors who qualify receive the promotion. if the collection filtering feature is implemented to use this property.ATG Commerce Programming Guide µ percentOff amountOff fixedPrice discountType string (display name: Discount type) readonly The type of discount this promotion gives. giveToAnonymousProfiles Boolean true or false none (display name: Give to anonymous customers) If both this property and the global property are false. See the type property. Boolean true or false none (display name: Enabled) Specify true to enable the promotion. date any date none endUsable (display name: Usage end date) The date that the promotion stops being effective. and the global property is false. This is set during item creation. which produces errors. the promotion takes effect according to the specified distribution period. (Note that two promotions can have different values for type and the same values for discountType. then only registered visitors who qualify receive the promotion.) displayName string any string none (display name: Name) enabled Specifies the name visible through user interface. This approach eliminates the possibility of deleting a promotion that has been used in orders on your site.Using and Extending Pricing Services . the promotion never takes effect regardless of the distribution period. If enabled. Used when the relativeExpiration property is set to false. you should never delete promotions and instead disable them by setting the enabled property to false. If disabled. If this property is true. Note: As a general rule.

associated with this discount.Using and Extending Pricing Services .uses Setting the global property to false indicates that the system delivers and applies the promotion according to all of the values specified for the promotion.allowMultiple -. string any valid PMDL rule none pmdlRule (display name: Discount rule) This is the Pricing Model Description Language (PMDL) rule describing the conditions under which this promotion should take effect. 220 9 .beginUsable -.endUsable -.timeUntilExpire -. enumerated for example.relativeExpiration -. The rule is created in the ATG Control Center using the interface designed for promotion creation. see the Using the Discount Rule Editor to Create PMDL Rules section. /atg/commerce/pricing/ calculators/ ItemDiscountCalculator pricingCalculatorServic e none (display name: Pricing Calculator) Specifies the calculator that computes and applies this promotion’s discount. If set to true. such as icons. during the specified distribution period – regardless of the values set for the following properties: -. media map map of object to object none (display name: Media) oneUsePerOrder The media. then it is possible for each shipping group in the order to be discounted by the promotion. If set to false.µ (display name: Automatically apply to all orders) ATG Commerce Programming Guide Setting the global property to true indicates that this promotion will be offered an unlimited number of times. to all visitors (including anonymous visitors). It determines whether a shipping promotion can discount a single order multiple times. For more information. Boolean true or false none (display name: One use per order) A property used for shipping promotions only. then only one shipping group in the order can use the promotion.giveToAnonymousProfiles -. for use on an unlimited number of orders.

If true. For example. The expiration date and time is then determined by the number of minutes in timeUntilExpire to the current time. relativeExpiration Boolean true or false none (display name: Usage Period) Determines whether the usage period for the promotion is fixed or relative. The start date and time is set when the user receives the promotion. you can specify how a given promotion of Type A is applied compared to other Type A promotions. startDate date any date none (display name: Distribute starting) The date that the promotion begins to be able to be delivered to people. the promotion’s usage period is determined by the dates set in the beginUsable and endUsable properties. The end date and time is set by the start date/time and the value of the timeUntilExpire property. with low priority numbers applied first. but not the order in which the types are applied. Note: This property is ignored when the global property is set to true. when the promotion is added to the user’s activePromotions profile property). the promotion is added to the list of promotions in the user’s activePromotions profile property. Engines sort the value of this property. the promotion’s usage period is set according to the date it is received by the user (that is. If false. 221 9 . that is. if the collection filtering feature is implemented to use this property. Used when the relativeExpiration property is set to true.Using and Extending Pricing Services .ATG Commerce Programming Guide µ any integer none priority integer (display name: Order of application) The priority of the promotion.. Promotions are applied in order of priority. Note that this property functions within the context of a particular promotion type. The promotion becomes active as soon as the user receives the promotion. int any int none timeUntilExpire (display name: Redeemable for) Determines the usage period in minutes for the promotion.

xml.Amount Off Shipping Discount . version long any long hidden (display name: Version) Used by the SQL Repository to protect against data corruption caused by two different threads attempting to modify the same item the same time.µ type ATG Commerce Programming Guide enumerated (hidden) Item Discount– Percent Off Item Discount– Amount Off Item Discount– Fixed Price Item Discount– Multiplier Shipping Discount. zero none (display name: Number of uses allowed per customer) The number of orders for a given customer to which the promotion can be applied. One important part of promotion creation is making sure that the promotion can only be used in the way you intend it to be used. To alter the values in the enumerated list. This is set during item creation.xml. Note 1: A promotion can sometimes discount a single order multiple times.Amount Off Order Discount . If this number hits zero. The enumerated list from which this property value is first set (when the promotions is created via the ACC) is defined in /atg/commerce/pricing/pricingModels. Incorrectly worded or configured promotions could allow customers to receive greater benefits from the promotion than you intended.Fixed Price readonly The type of discount this promotion gives.Percent Off Order Discount .Percent Off Shipping Discount. See the discountType property.Using and Extending Pricing Services . The following list describes issues to keep in mind when you are creating promotions for your site. you must change the values in pricingModels.jar. Note 2: This property is ignored when the global property is set to true. (Note that two promotions can have different values for type and the same values for discountType.) uses int any positive integer.Fixed Price Order Discount . which is located at <ATG9dir>/DCS/config/config. the promotion can no longer be applied. This is still considered one “use. you can prevent the promotion from discounting a single order multiple times by setting the oneUsePerOrder property to true.” For shipping promotions only. 222 9 .

To retrieve the list of global promotions.) For more information on the PricingModelHolder class. UserPricingModels queries each pricing engine for the customer’s promotions. make sure you create a scenario to remove the promotion at the end of the week. and it does so every x minutes as defined by the schedule specified in its updateSchedule property. or pricing models.pricing. the pricing models in UserPricingModels are then used for all pricing operations during the user’s session. that user will never receive the new promotion. if you put all sneakers on sale for a given week. For more information on the pricing engine APIs. where x is determined by the schedule set for the pricing engine component. Note: When setting the “go live” dates of a promotion. if a user’s session is created after you have added a new global promotion but before the next scheduled job to update the pricing engine’s list of global promotions. the pricing engine uses its globalPromotionsQuery property to query the Promotions repository for all promotions where the global property is set to true. (Note that the pricingModelHolder. For example. be aware that a number of factors can cause the promotion to be unusable for x minutes after it is set to be active and to be usable for x minutes after it is set to expire. • Because it can be resource intensive to collect a user’s list of promotions. specify the brand in the rule rather than relying on an attribute of the brand that you might think is unique.loadGlobalPromotions method in order to collect all new global promotions. Consequently. the user will not receive the new global promotion. manually call the pricingModelHolder. For example.Using and Extending Pricing Services .initializePromotions method should be called after the pricingEngine. • When creating promotions. The initializePromotions method generates a new list of pricing models to store in the user’s UserPricingModels. • 223 9 . These promotions include both the promotions in the user’s activePromotions profile property and the list of global promotions. evaluate the wording of the discount rule carefully to make sure that only the intended products receive the promotion. This is usually set in the ‘start date’ and ‘end date’ properties.commerce. Use caution when creating “infinite use” promotions (ones that a customer can use an infinite number of times during a specified time period). Be as specific as possible when creating rules. see the Public Pricing Interfaces and Classes and Default Pricing Engines sections.PricingModelHolder) stores them in a session cache. To prevent this situation.loadGlobalPromotions method when you add the new global promotion. see the PricingModelHolder section. Once collected. You can prevent this situation by manually calling the pricingEngine.initalizePromotions method when you add any new promotion (targeted or global). Additionally. if a particular brand is on sale. This is because the user’s list of pricing models has already been collected and stored in the user’s UserPricingModels.ATG Commerce Programming Guide µ • Check the “go live” dates of all promotions to prevent a promotion from taking effect before you’re ready for it. the session-scoped UserPricingModels component (class atg. When a session starts for a user. if a user’s session was created before you added a new promotion (either targeted or global).

Using the Discount Rule Editor to Create PMDL Rules The ATG Control Center includes a user interface for creating and editing PMDL (discount) rules.µ PromotionStatus Repository Items ATG Commerce Programming Guide When a promotion is associated with a customer’s profile.Using and Extending Pricing Services . During the pricing process. Refer to the following list for more information on the available comparison operators: • • • • is less than = is not greater than or equal to is greater than = is not less than or equal to is not less than = is greater than or equal to is not greater than = is less than or equal to 224 9 . The Discount rule editor provides a series of pull-down menus that allow you to set up a discount: Note: The Discount rule editor uses comparison operators such as “is not less than” to set conditions for promotion delivery. Access the editor by opening an existing promotion or creating a new promotion. Click on the field that holds the value of the promotion’s Discount Rule property. A PromotionStatus RepositoryItem is a repository item with an ItemDescriptor that describes the status of the promotion. pricing engines inspect the customer’s profile to see which promotions should be considered when generating prices. The number of times that a customer can use the promotion. Click on the “…” button to open the Discount rule editor. A customer’s profile has an activePromotions property that contains a list of PromotionStatus RepositoryItems. Each PromotionStatus item contains the following information: • • A reference to the underlying promotion that was created in the ATG Control Center’s Promotions editor. This repository item tracks the number of times a customer can use an individual promotion. it is wrapped inside a PromotionStatus RepositoryItem.

Fixed pricing: Get Y for $0. then set its adjuster to . For example. Examples of PMDL Rules The tables in this section demonstrate how to represent some standard promotions using PMDL rules in the discount rule editor. the following is one possible PMDL representation: “always discount every item whose SKU’s color is green” This rule is written for items that register their color in the “color” property of their SKU.25 The “$. You can create an “Item Discount - percent off” promotion.Using and Extending Pricing Services . The PMDLRule describes Y.25” part of this rule is contained at the PricingModel level You create an “Item Discount .” you can define the rule using “if age is not greater than 30.” For more information on creating promotions in the ACC. if Y is something red. Item Pricing Model Examples The following table describes how to set up Item pricing models using PMDL rules: Percentage off price: Get Y for 25% off. if Y is something green. if Y is something blue.fixed price” promotion. see the Creating and Maintaining Promotions chapter of the ATG Commerce Guide to Setting Up a Store. You create an “Item Discount - amount off” promotion. For more examples of PMDL Rules. The PMDLRule describes Y. For example. then set its adjuster to 25.ATG Commerce Programming Guide µ For example. the following is one possible PMDL representation: “always discount every item whose SKU’s color is blue” This rule is written for items that register their color in the “color” property of their SKU. to create a condition to deliver a promotion “if age is less than or equal to 30. For example. see the Creating and Maintaining Promotions chapter of the ATG Commerce Guide to Setting Up a Store. then set its adjuster to 10.25. the following is one possible PMDL representation: “always discount every item whose SKU’s color is red” This rule is written for items that register their color in the “color” property of their SKU. The PMDLRule describes Y. 225 9 . Dollar amount off price: Get Y for $10 off The “$10 off” part of this rule is contained at the PricingModel level. The “25% off” part of this rule is contained at the PricingModel level.

The following table describes how to set up quantity pricing models using PMDL rules: Buy one. This rule converts to give a discount to a “CommerceItem whose auxilliaryData. discount up to 1 items whose SKU color is blue” The second half of this rule refers to “up to 1 item” means that only one blue item will be discounted for every blue item purchased.” By default. the productRef needs to have its ancestorCategoryIds populated. Quantity Pricing Model Examples The quantity rules have one thing in common: they all depend on a set of items that match the description “X. Create a “Item Discount – fixed price” promotion. get one free This rule indicates that if a customer buys 3 items.µ ATG Commerce Programming Guide Note: You can create a rule that gives a discount to a product that is in a specific category. rules of this type always evaluate to false. Create a “Item Discount – fixed price” promotion. you could create a rule that gives a 10% discount to all products that are part of the shoe category. discount up to 1 item whose SKU color is blue” 226 9 . the items that act to satisfy this precondition are not eligible to receive the discount. Next. Buy three. they will receive one item free. get one free If the free item is “anything blue” then the rule is actually “buy one blue item.” A number of X items are needed as a precondition for the rule being applied to any items. create the following PMDL representation: “For next 1 items whose SKU color is blue. they will receive 2 items free.productRef. For example. get one blue item free. see the Using and Extending the Standard Catalog chapter. If they buy 6 items. Set the adjuster to Zero. This rule is written for items that register their color in the “color” property of their SKU. Set the adjuster to Zero.” The “free” part of the discount is configured in the promotion itself. the productRef is an item from the Product Catalog.ancestorCategoryIds contains categoryIdX. For more information on the product catalog. To use a rule that discounts based on category. Create the following PMDL representation: “For next 3 items whose SKU color is blue. etc.Using and Extending Pricing Services . By default. If this property is not populated.

discount up to 1 item whose SKU’s color is blue” Buy 2 of X. Next. Set the adjuster to Zero. the item being purchased is “something blue. Next. create the following PMDL rule: “for next 2 items whose SKU’s color is blue. Order of Application: 1” 2) Create another “Item Discount . discount up to 5 (sku whose color is blue).ATG Commerce Programming Guide µ Buy three or more.” and set its adjuster to zero. Next.” Create a discount of type “Item Discount – fixed price. get 1 X free. get 1 free” promotion that limits the promotion to one free item per order. For example. This is necessary because the promotion given is different based on the number of items bought.” 1) Create one “Item Discount . In the following example. Create a “Item Discount – percent off” promotion (or “Item Discount .Using and Extending Pricing Services .fixed price” promotion and set its adjuster to 10. create the following PMDL rule: “for next 12 items whose SKU’s color is blue. get one free This rule is a version of the “Buy 3. Order of Application: 2” 227 9 . create the following PMDL rule: “Always. Create the following PMDL representation: “When order contains at least 3 (product in category named clothing). if you buy six items. buy the next 5 at $5 each This promotion can be created through a combination of two promotions. create the following PMDL rule: “Always. Set the adjuster to 20.” If X is “something blue. you still just get one free item. get one free. Next.fixed price” promotion and set its adjuster to 5.” or more simply “buy 12. Create a “Item Discount – fixed price” promotion.” Tier pricing: Buy the first 5 at $10 each. discount up to 1 item whose SKU’s color is blue. Apply discount to up to 1 (product in category named clothing)” Buy 13 of X for the price of 12 X’s This rule could be rewritten as “for every 12 Xs that you buy. If X is something blue.amount off”). except that the applied discount is different. discount up to 5 (sku whose color is blue). get the 3rd X for 20% off [or $20 off] This example follows the same pattern as the above two examples.

the conditions are that there is at least one blue thing in the order. discount shipping group” Upgraded shipping: Upgrade from regular 7-day shipping to next day shipping for the price of 7day shipping.Using and Extending Pricing Services . In the following example. Next. Next.” Set the adjuster to the price of seven-day shipping. create the following PMDL rule: “when order contains at least 1 ( sku whose color is blue ). the condition is that the order contains a blue item.µ Shipping Pricing Model Examples Free shipping ATG Commerce Programming Guide The following table describes how to set up shipping pricing models using PMDL rules: This promotion is written out in the form “under these conditions. Create a promotion of type “Shipping Discount – fixed price. discount order total. the conditions for this promotion taking effect are that the order contains at least one SKU that’s blue. create the following PMDL rule: “when order contains at least 1 ( sku whose color is blue ) and Shipping Group’s shippingGroupType is ‘Next Day’ discount shipping group” Order Pricing Model Examples The following table describes how to set up Order pricing models using PMDL rules: 10% of the total price of the order This rule requires a condition under which the Y% should be taken off. This promotion is represented by a “fixed price” promotion.” 228 9 . In the following example. Create a promotion of type “Shipping Discount – fixed price. Next.” Set its adjuster to 0.” In the following example. give free shipping. The rule ensures that you only discount next day air. Create a new discount of type Order Discount – percent off. Set the adjuster to 10. create the following PMDL rule: “when order contains at least 1 ( sku whose color is blue ).

Create a new promotion of type “item Discount fixed price. “when order contains at least 1 ( sku whose color is blue). there may be a more efficient way of implementing that promotion.” Set the adjuster to 0.” “when Order’s priceInfo's amount is greater than 100. performance is noticeably affected when a customer profile contains thousands of promotions. Create a new discount of type “Order Discount – Percent Off. Y is a blue item. In the following example. the longer it takes to generate a price for that customer. As a general rule. See the ATG Personalization Guide for Business Users for more information on scenarios.ATG Commerce Programming Guide µ This rule requires a condition under which the Y% should be taken off. Next. A customer can have hundreds of promotions without it significantly affecting the time it takes to price an item. assign customers as few promotions as possible to accomplish the business goals for the site. Use properties of the SKU (for example. Performance Issues Related to Promotion Delivery In general. Free Y with the order This rule is actually an Item Discount because it’s the Y that’s being described and Y’s price that is being discounted. the condition is that the order contains a blue item. In the following example. discount order total. Create a new discount of type Order Discount – amount off. create the following PMDL rule: “when order contains at least 1 ( sku whose color is blue ). if a promotion does not refer to information that might change from one request to another. In general. Do not rely on promotions to do the bulk of price generation for a site. discount all items. Set the discount percentage to 10. However. the salePrice property) to provide varied pricing.Using and Extending Pricing Services . 229 9 . discount up to 1 ( sku whose color is blue )” Note that this will not automatically add the item to be discounted to the customer’s shopping cart. You must create a scenario to add the item to the cart. the more promotions a customer has in his or her profile.” $10 off the total price of the order 10% off orders of $100 or more This rule is an order discount based in the order’s priceInfo property.

230 9 . For example. or to other conditions that do not change on a request basis. and configurable SKU IDs. This way. Using Price Lists Price Lists allow you to target a specific set of prices to a specific group of customers. It is not always efficient to refer to the date. not both. price lists can be used to implement business to business pricing where each customer can have its own unique pricing for products based on contracts. Rather than creating a promotion that puts black shoes on sale and giving it to every customer. RFQ and pre-negotiated prices. but no undue load is placed on the promotion evaluation engine. as part of the promotion evaluation process. Each list has the following properties: • • • • • • • Name Base price list Creation date Last modified date Start date End date Locale The list will display the following information about a product and a SKU: • • • • • • Product ID SKU ID Description Pricing scheme List price Complex price Note: Either the List Price or the Complex Price is required. SKU IDs. For example. The profile will probably be different for every price being generated throughout the site. referring to a customer’s profile is an efficient way to structure a promotion. Price lists are managed through a single interface in the ACC. which includes a list of product IDs.99 for product X. you could set the sale price of the black shoes in either the SKU repository or the underlying database. Pricing can be inherited based on products and/or SKUs. Multiple lists can be created and managed. For example. if a price is defined as $9. since many different customers will be using the site. consider a situation in which you put all black shoes on sale one week. the promotion is still applied.µ ATG Commerce Programming Guide For example. all SKUs that are in product X will be given a price of $9.Using and Extending Pricing Services .99 unless the price is explicitly overwritten.

The price list that is used to price an order is stored in the user’s profile. Note: ATG Business Commerce users can also store this price list in the contract used by the customer’s organization. There are price list-specific versions of each of the precalculators used by the ItemPricingEngine. This section contains information on the following price list topics: • • • • • • • • • • Overview of Setting Up Price Lists Description of Volume Pricing Setting up Price List Functionality in ATG Consumer Commerce PriceListManager Price List Calculators Implementing Sale Prices using Price Lists Calculating Prices with a Specific Price List Using the CurrencyConversionFormatter to Convert Currency Price List Security Policy Converting a Product Catalog to Use Price Lists Overview of Setting Up Price Lists The following steps describe how to price items using price lists. 1.Using and Extending Pricing Services . The PriceDroplet servlet bean is used for looking up the price of an item. ConfigurableItemPriceListCalculator is the precalculator for configurable item pricing. 231 9 . The PriceCache settings are located in liveconfig/atg/commerce/pricing/priceLists/PriceCache. ItemPriceListCalculator is the precalculator for list pricing. View a price through JSP code in JSPs.ATG Commerce Programming Guide µ For more information on setting up price lists using the ACC. Assign a price list to a user. 3.properties. If you do not want the PriceCache to hold all the prices in the prices list. There will be a property called priceList of type priceList. see the Managing Price Lists chapter of the ATG Commerce Guide to Setting Up a Store. see the PriceDroplet section in this chapter in the ATG Commerce Guide to Setting Up a Store. 2. Price an item with a price list. adjust the PriceCache settings in your liveconfig directory. For more information on the PriceDroplet servlet bean. Caching Price Lists PriceCache allows you to cache the prices in price lists. Price lists can contain a large number of prices.

Using and Extending Pricing Services . and the path points to the ListPriceCalculator. it falls back to the catalog price. create the price lists as normal. purchase beams 11 through 20 for $45 each. your lists need only include the specific products for which you want to offer multiple prices. Consider using combined price lists and SKU-based pricing if most of your customers pay the same prices for most of your products.commerce. after purchasing 10 beams for $50 each and purchasing beams 11 through 20 for $45 each. with only a few variations.µ ATG Commerce Programming Guide Using Price Lists in Combination with SKU-Based Pricing ATG Commerce supports three pricing model options: SKU-based pricing alone.pricing. Tiered pricing calculates the price of a product using fixed quantity or weight at different pricing levels. Description of Volume Pricing Price lists can be used to implement many pricing models. if you want to allow missing non-sale prices to use SKU pricing. For example. For example. Each of the 23 beams would cost $40. See the Price List Calculators section of this chapter for further information on these components. In the combination case.ItemPriceCalculator component: noPriceIsError=false noPriceCalculator=path_to_an_ItemPricingCalculator Which ItemPriceCalculator component to configure depends on the desired behavior. Then configure the following two properties of the atg. Bulk pricing calculates the price of a product based on the minimum quantity that is ordered. you could: • • • purchase up to 10 steel beams for $50 each purchase 11 to 20 steel beams for $45 each purchase 21 or more steel beams for $40 each In this bulk pricing example. you could: • • • purchase up to 10 steel beams for $50 each after purchasing 10 beams for $50 each. configure the ItemPriceListCalculator as shown: noPriceIsError=false noPriceCalculator=/atg/commerce/pricing/calculators/ItemListPriceCalculator Note that the component being configured is the PriceListCalculator. Two popular models are bulk pricing and tiered pricing. To use this pricing method. your pricing system is configured to use price lists. however. purchase any more than 20 beams for $40 each 232 9 . if you bought 23 steel beams. but if no price is found in the lists you have specified. the total cost of the order would be $920.priceLists. For example. price lists alone. and a combination of both.

1 2001/04/26 </version> </header> <item-descriptor name="user" default="true" sub-type-property="userType"> <table name="dcs_user" type="auxiliary" id-column-name="user_id"> <property category-resource="categoryCommerceContract" name="priceList" item-type="priceList" display-name-resource="priceList" column-name="price_list" repository="/atg/commerce/pricing/priceLists/PriceLists"/> </table> </item-descriptor> </gsa-template> 2. you should: 1.xml in your localconfig: <gsa-template> <header> <name>Commerce Related Profile Changes</name> <author>DCS Team</author> <version>$Id: userProfile.ATG Commerce Programming Guide µ In this tiered pricing example.\ calculators/ConfigurableItemPriceListCalculator 233 9 . The following code example shows how the /atg/commerce/pricing/ItemPricingEngine.Using and Extending Pricing Services .xml.v 1. 23 steal beams would cost $1070: • • • 10 beams (beams 1-10) for $50= $500 10 beams (beams 11-20) for $45= $450 3 beams (beams 21-23) for $40= $120 Setting up Price List Functionality in ATG Consumer Commerce ATG Consumer Commerce users do not have a price list functionality available by default. There are price list-specific versions of each of the precalculators used by the ItemPricingEngine. Configure the ItemPricingEngine to use the appropriate precalculator. Add the following code to /atg/userprofiling/userProfile. Add a price_list column to dcs_user table.properties file should change to use the priceList calculators preCalculators=\ calculators/ItemPriceListCalculator. To add price list functionality. ConfigurableItemPriceListCalculator is the precalculator for configurable item pricing. ItemPriceListCalculator is the precalculator for list pricing. 3.

the property name of a default price list can be added as an input parameter. When a match is found. For example: listPrice corresponds to the PriceListsListCalculator bulkPrice corresponds to the PriceListsBulkCalculator tieredPrice corresponds to the PriceListsTieredCalculator Also. The major public API exposed by this class includes: • • getPricingScheme: returns the pricing scheme for the CommerceItem priceItem: examines the allowed PricingSchemeNames HashMap.µ PriceListManager ATG Commerce Programming Guide Note: The configurable item calculator is optional. using the defaultPriceListId. A price may be retrieved from the PriceListManager from a given price list by product. For more information on bulk and tiered pricing.Using and Extending Pricing Services . The most important method in PriceListManager is getPrice. Using DefaultSalePriceListID. or by a product/SKU pair. Otherwise. by SKU. The ItemPriceCalculator has the following important properties: • • PriceListManager: holds the reference to PriceListManager PricingSchemeNames: holds the key/Value pair for each allowed pricing scheme and its corresponding Calculator. Three sub-calculators correspond to the three different pricing schemes. For example: public RepositoryItem getDefaultPriceList(String pPriceListName) Price List Calculators An ItemPriceCalculator class maintains all the functionality common to all the pricing schemes. PriceListManager can be used to assign a default price list (DefaultPriceListId) and a default sale price list(DefaultSalePriceListId) in the event that one cannot be found for a customer. see the Using Price Lists section. it will call the corresponding Calculator’s priceItem method. 234 9 . This is used during pricing of an order to get the correct price for a given product/SKU pair. the pricing calculators will use the price lists defined here to determine what price to use. It only needs to be used if your site supports configurable commerce items. and calculating the price of an item using tiered pricing. The PriceListManager class maintains the price lists. determining which default list should be displayed. calculating the price of an item using bulk pricing. an exception is thrown to indicate that the pricing scheme is not found. The three different schemes are calculating the list price of an item. see the Using Price Lists in Combination with SKU-Based Pricing section for properties related to that capability. When an item is priced.

The priceList property of ItemPriceInfo is set to the priceList that was actually used to calculate it. This is because of the Range property in both ShipItemRels and DetailedItemPriceInfos. a price repository item has a listPrice (or a complexPrice) but no salePrice. Using ItemPriceInfo with Price Lists One ItemPriceInfo class fits three different pricing schemes. even if they have the same price list normally. It then multiplies the price by the quantity returned by the getQuantity method of CommerceItem to get the total price. you could have different sale prices for two different users. This is nullable since other calculators other than those mentioned here will not set this. Creating the sale price list 235 9 .Using and Extending Pricing Services . In the standard pricing model (where the price is stored directly in the SKU in the product catalog) there is a listPrice property and a salePrice property. there is no sale pricing configured when using price lists. The quickest way to implement sale pricing using price lists is to create a sale price list. you could store all the list prices for a specific user in one price list and all the sale prices for a specific user in another price list. The ItemPriceInfo will might several DetailedItemPriceInfos to reflect different unit prices for each tier. Follow these steps to implement sale pricing using price lists. It will check each price level of that complex price based on the quantity of the CommerceItem to decide the correct unit price for the item. In the price list model. The SKU also has a boolean onSale property that indicates that the given SKU should be priced using the sale price. This set up provides flexibility. It will check • • each price level of that complex price to decide which unit price is used for each tier. It also allows us to inherit sale prices while overriding the list prices (or vice versa). Implementing Sale Prices using Price Lists By default. The ItemPriceInfo will contain one DetailedItemPriceInfo for each ShippingGroupCommerceItemRelationship. Each calculator uses a different description for the PricingAdjustment added to the ItemPriceInfo. ItemTierPriceCalculator: Calls the getPrice method from the PriceListManager to retrieve the complex price for the CommerceItem. • ItemListPriceCalculator: Calls the getPrice method from the PriceListManager to retrieve the list price of the CommerceItem. ItemBulkPriceCalculator: Calls the getPrice method from the PriceListManager to retrieve the complex price for the CommerceItem. which only has a priceItem method.ATG Commerce Programming Guide µ All of these calculators implement the ItemSchemePriceCalculator. For example. 1. The ItemPriceInfo will contain one DetailedItemPriceInfo for each ShippingGroupCommerceItemRelationship in the CommerceItem. This section describes how to implement sale pricing with price lists. The ItemPriceCalculator is responsible for setting this value. In this situation.

The ItemPriceInfo stores both pieces of information.ItemPriceCalculator loggingIdentifier=ItemSalePriceCalculator profilePriceListPropertyName=salePriceList useDefaultPriceList=false noPriceIsError=false pricingSchemePropertyName=pricingScheme priceListManager=/atg/commerce/pricing/priceLists/PriceListManager pricingSchemeNames=\ listPrice=/atg/commerce/pricing/calculators/SalePriceListsListCalculator. The item is then priced with the sale price. the following steps occur: There are two precalculators in the ItemPricingEngine. useDefaultPriceList=false 236 9 . create a new instance of this calculator called ItemSalePriceCalculator.µ 2. allowing users to calculate the discount that the user received. Structurally there is no difference between a sale price list and any other price list. # The ItemSalePriceCalculator which prices an item on sale # $class=atg. Since we want the flexibility of keeping sale prices completely separate from list prices.priceLists.commerce. Create this new property by copying the priceList property and changing the name.pricing. For sale pricing. Assign the sale price list to a user.\ bulkPrice=/atg/commerce/pricing/calculators/SalePriceListsBulkCalculator.priceLists.commerce.pricing.\ tieredPrice=/atg/commerce/pricing/calculators/ SalePriceListsTieredCalculator The following list describes the important properties of ItemSalePriceCalculator: profilePriceListPropertyName=salePriceList This property forces the calculator to use the sale price list for pricing. Price lists use a similar approach: The first calculator in the list by default is: /atg/commerce/pricing/calculators/ItemPriceListCalculator This is an instance of atg. It configures the name of the profile property that stores the price list as well as the map that configures which calculator to use for each pricingScheme. Pricing an item with a price list If you want to price an item without price lists. user’s will need to have two price lists assigned to them. There will need to be an additional property in the user’s profile to store the salePriceList. Note: ATG Business Commerce users can create an additional property for the user and the contract. 3.ItemPriceCalculator.Using and Extending Pricing Services . The item is first priced with the list price. ATG Commerce Programming Guide Create a sale price list the same way you create other price lists.

For example: $class=atg. this would only mean the item is not on sale. noPriceIsError=false When calculating a list price. Calculating Prices with a Specific Price List You can specify a price list that will be used to price items regardless of what price list is specified in a user’s profile.pricing. View a price through a JSP using JSP code. The ItemPricingEngine defines the following precalculators: preCalculators=\ calculators/ItemPriceListCalculator. A ConfigurableItemPriceListSaleCalculator provided out of the box. 237 9 .\ calculators/ConfigurableItemPriceListSaleCalculator 4. you could extend the Customer Service Module to price items in all available price lists or use this method as an alternative if pricing with price lists in the standard way is not sufficient.commerce.priceLists.Using and Extending Pricing Services . This is usually not needed when using sale pricing so this is set to false. Sale price calculators add different PricingAdjustments and update salePrice instead of listPrice. If this is false.\ calculators/ItemPriceListSaleCalculator. it is an error if there is no price defined (since we wouldn’t know how much to charge).\ calculators/ConfigurableItemPriceListCalculator. You also need to price the configurable items. pricingSchemeNames=\ listPrice=/atg/commerce/pricing/calculators/SalePriceListsLis tCalculator.\ tieredPrice=/atg/commerce/pricing/calculators/SalePriceListsT ieredCalculator These calculators are provided by default with ATG Commerce because sale price calculators manipulate the ItemPriceInfo in a different way than list price calculators. It is most probably not an error if there is no sale price. Another instance of this servlet bean retrieves the sale price. For example.\ bulkPrice=/atg/commerce/pricing/calculators/SalePriceListsBul kCalculator.PriceDroplet $scope=global priceListManager=/atg/commerce/pricing/priceLists/PriceListManager profilePriceListPropertyName=salePriceList useDefaultPriceList=false This servlet bean is used in the same way as the PriceDroplet servlet bean. Using the PriceDroplet servlet bean retrieves the list price. you can assign a default price list. then no error is thrown. and no change is made to the price.ATG Commerce Programming Guide µ When using list pricing.

and delete price lists.processor.service. if extraParameters maps the string priceList to a price list (or a price list ID) and profilePriceListPropertyName is set to priceList (default). For example. The amount can be converted from one currency to another. ConfigurableItemPriceListCalculator. AddExtraParamsEntry adds a string key and string value to the extra parameters map.xml as follows: <pipelinechain name="repriceOrder" transaction="TX_REQUIRED" headlink="useDifferentPriceList"> <pipelinelink name="useDifferentPriceList" transaction="TX_MANDATORY"> <processor jndi="/atg/commerce/pricing/processor/UseDifferentPriceList"/> <transition returnvalue="1" link="priceOrderTotal"/> <transition returnvalue="2" link="priceOrderTotal"/> </pipelinelink> <pipelinelink name="priceOrderTotal" transaction="TX_MANDATORY"> <processor jndi="/atg/commerce/pricing/processor/PriceOrderTotal"/> </pipelinelink> </pipelinechain> This causes all orders (regardless of what is in the profile) to be priced with priceList 100012. then the price list in the map is One way to implement this is to use the generic pipeline processor AddExtraParamsEntry. To use this with pricing. certain objects might 238 9 . Additionally. For more information on this servlet bean. It adds pipeline support for specifying price lists. see Appendix B: ATG Servlet Beans in the ATG Page Developer’s Guide. if a user does not have write access to a particular item. edit. Price List Security Policy The ATG Control Center allows users to create. create a properties file in /atg/commerce/pricing/processor/UseDifferentPriceList.AddExtraParamsEntry value=200005 key=priceList Then modify the repriceOrderChain in the commercepipeline. and ConfigurableItemPriceListSaleCalculator all look in pExtraParameters for the price list before looking in the profile. ATG Commerce Programming Guide ItemPriceCalculator.properties with the following code: $class=atg.Using and Extending Pricing Services . When a user attempts to view or edit a price list. Using the CurrencyConversionFormatter to Convert Currency The CurrencyConversionFormatter servlet bean can be used to convert and format a numeric amount. You can set a specific price list by adding an entry to pExtraParameters with a key of profilePriceListPropertyName and a value of the priceList that you with to use (or the ID of the priceList). For example. then the ACC will display the item in gray characters.pipeline. the security system checks the security information associated with the object and grants or denies access based on the information.µ used instead of the profile’s price list.

these objects will have the same security information as the priceList. all objects under Price List A would share the same security information. The goal of this section is to outline a policy that Commerce implemented. all security information flows from a priceList down.Using and Extending Pricing Services .commerce. This means that if there is a group of price and complexPrice that live in a priceList. The ACC is capable of checking this security information for all items contained in the price list repository: • • • • Price List Prices Complex Prices Folders While having the ability to specify security information for each item is a very powerful concept. This prevents an administrator from having to enter security information for every object in the repository. To alleviate this burden. In the price list security policy. users would only need to enter data for some of the items and then other items could derive their security information from these few items. For more information. By having a logical policy. The default security policy returns the ACL information stored on each repository item. then those same users would be the only ones that could edit the price entries in the price list. if only users in the admin group can edit a particular price list. policies can be created that group logical items together. The price list security policy “walks” up the tree until an item finds the priceList to which it belongs and then retrieves the security information from the price list item. It should 239 9 . In the following example.security package. Price List A Price Entry for SKU A Price Entry for SKU B Complex Price The PriceListSecurityPolicy Class The PriceListSecurityPolicy class is located in the atg. This is method // that will perform special logic to get ACLs for a repository // item that lives in the PriceList repository. see the discussion on security measures for deployment in the ATG Installation and Configuration Guide. Therefore. it can place a burden on both the system as well as the administrator entering security information.ATG Commerce Programming Guide µ not be visible to certain users. The class needs to has the following signatures: public class PriceListSecurityPolicy extends SecuredRepositorySecurityPolicy { // overridden method from the super class. Note: You can also plug in a different security policy if your business needs are not met by the policy described in this section.

To use the PriceListMigration component: 1. 1. For each SKU in the product catalog. The PriceListMigration component first creates two price lists: one for the list price. This component should reference the PriceListSecurityPolicy component created in the previous step. 3. If the onSale property for the SKU is true.) // get ACL for complexPrice repository item protected AccessControlList getACLForComplexPrice(SecuredRepositoryItem pItem). Edit the configuration of the SecurePriceLists component located in /atg/commerce/pricing/priceLists/. } Configuring the Price List Security Policy Follow these steps to implement the security policy used by the SecuredPriceList repository: Note: These configuration steps should be performed at the Commerce configuration layer. 2. Point the securityConfiguration property to the PriceListSecurityConfiguration component defined in the previous step. This script can be found at: <ATG9dir>/DCS/sql/db_components/dbvendor/priceLists_ddl. the PriceListMigration component creates a price that points to the list price list and sets its list price as the SKU’s list price. public AccessControlList getEffectiveAccessControlList(Object pObject). The methods // it could dispatch to are below.µ ATG Commerce Programming Guide // figure out if the repository item type is "interesting" // and then dispatch to an appropriate method.sql 2. Run the price list SQL script against your catalog database. it creates another price that points to the sales price list and set its list price as the SKU’s salePrice.Using and Extending Pricing Services . Create a new PriceListSecurityConfiguration component located in /atg/dynamo/security/. Start the /atg/commerce/pricing/priceLists/PriceListMigration component. This component should have PriceListSecurityPolicy as its class. Converting a Product Catalog to Use Price Lists ATG Commerce includes a tool that can be used to convert your existing product catalog without price lists so that it can use price lists. 240 9 . // get the ACL for a Price repository item protected AccessControlList getACLForPrice(SecuredRepositoryItem pItem. Create a new PriceListSecurityPolicy component located in /atg/dynamo/security/. and the other for the sales price.

241 9 . Invoke the runMigration method from the methods tab in the component editor.ATG Commerce Programming Guide µ 3. Open the component editor for the PriceListMigration component.Using and Extending Pricing Services .

Using and Extending Pricing Services .µ ATG Commerce Programming Guide 242 9 .

PaymentGroup. retrieving an order. and Relationship. The base commerce interfaces are Order. and Relationship. • • 243 10 . For example.Working With Purchase Process Objects . ShippingGroup. an Order interface implementation contains implementations of CommerceItem. CommerceItem. These classes use the base commerce classes and the base commerce interfaces. It includes the following sections: The Purchase Process Subsystems Creating Commerce Objects Using Relationship Objects Assigning Items to Shipping Groups Assigning Costs to Payment Groups Setting Handling Instructions ATG Commerce States Purchase Process Class Diagrams The Purchase Process Subsystems The purchase process can be broken down into the following subsystems: • Base Commerce Classes and Interfaces The base commerce interface implementations hold and manage other commerce interface implementations. and adding payment methods. ShippingGroup. The interfaces define a mechanism for accessing the data stored in an object in a manner that frees it from the underlying implementation. the Address and ContactInfo classes play important roles in the purchase process. Business Layer Classes The business layer classes hold the business logic for tasks like adding an item to an order. Address Classes While not commerce-specific objects. PaymentGroup. adding shipping methods.ATG Commerce Programming Guide µ 10 Working With Purchase Process Objects This chapter includes foundational information on the various commerce objects used in the purchase process and how they interrelate.

A ShippingGroup could contain a physical delivery address. see the Using Relationship Objects section. shipping costs. Interface Order Description The Order interface represents the delivery and payment information for a collection of items. and tax information for each item or the entire Order. It is important to understand the concept of relationships. pricing information. The CommerceItem interface represents information about a product to be purchased. The interfaces provide access to the data in the objects in a way that frees it from the underlying implementation. The PaymentGroup interface contains payment information. This includes information such as a credit card number. and payment information. The commercespecific interfaces that extend Relationship are CommerceItemRelationship. Base Commerce Classes and Interfaces The base commerce classes and interfaces are the core objects that are used throughout ATG Commerce. and the amount to be charged. For information on how all the classes and interfaces are related. and Relationships. items to be purchased. Order Repository The Order Repository is the layer between ATG Commerce and the database server. such as the relationship between a CommerceItem and a ShippingGroup. ShippingGroups.Working With Purchase Process Objects . A CommerceItem contains the SKU (also called the catalogRefId) and the quantity of the item purchased. The ATG Commerce class hierarchy is divided into classes and interfaces. and OrderRelationship. an expiration date. The Relationship interface represents an association between two or more of the commerce objects listed above. The interfaces are described below. refer to the Purchase Process Class Diagrams section. although they are usually hidden from the ATG Commerce user. For more information. PaymentGroupRelationship. shipping information. These objects store the data that represent shopping carts. CommerceItem ShippingGroup PaymentGroup Relationship 244 10 .µ • • ATG Commerce Programming Guide Pipelines The purchase process pipelines execute a series of operations when called by the business layer classes. An Order contains CommerceItems. All the individual parts of ATG Commerce use these classes. PaymentGroups. ShippingGroupRelationship. The ShippingGroup interface contains information about the delivery of a collection of CommerceItem objects.

Note1: Order equality is determined by comparing the orderId. Shipping Classes 245 10 .Working With Purchase Process Objects . Gift wrapping is an example of HandlingInstruction. The following types of classes implement the interfaces described above: Order Classes Item Classes Shipping Classes Payment Classes Relationship Classes Handling Classes In some cases.ATG Commerce Programming Guide µ HandlingInstruction The HandlingInstruction interface describes special handling for a CommerceItem within a given ShippingGroup. It manages collections of CommerceItem. Note2: If you write any new code that modifies the Order object. there may be only one implementation. It stores the data about a specific item in an Order. and GiftCertificate all implement the PaymentGroup interface. It contains data structures for managing collections of other commerce objects. the lastModified time. ShippingGroup. Other interfaces are implemented by more than one class. For example. and transient properties. CreditCard. PaymentGroup. PaymentGroupImpl. Order Classes Class OrderImpl Description This class implements Order. and Relationship objects. make sure the code synchronizes on the Order object before it is modified. Item Classes Class CommerceItemImpl Description This class implements CommerceItem.

In addition to storing inherited data. shipping costs. This class implements ShippingGroup and extends ShippingGroupImpl. shipping costs. This class implements ShippingGroup and extends ShippingGroupImpl. such as the carrier and postal address.µ Classes ShippingGroupImpl ATG Commerce Programming Guide Description This class implements ShippingGroup. It stores the data describing where and how to ship CommerceItems. such as an e-mail address. In addition to storing inherited data. it stores information about how CommerceItems. CreditCard GiftCertificate StoreCredit 246 10 . In addition to storing inherited data. This class implements PaymentGroup and extends PaymentGroupImpl. as well as the Relationships to items in the shipping group. and tax. it is used through the HardgoodShippingGroup and ElectronicShippingGroup subclasses (described below). In addition to storing inherited data. it stores information about how the CommerceItems are to be shipped to a physical street address. HardgoodShippingGroup ElectronicShippingGroup Payment Classes Payment Classes PaymentGroupImpl This class implements PaymentGroup. This class implements PaymentGroup and extends PaymentGroupImpl. It stores the payment information for CommerceItems. it stores information about how CommerceItems.Working With Purchase Process Objects . it stores information about how CommerceItems are to be delivered electronically. This class provides no functionality itself. This class provides no functionality itself. shipping costs. it stores information about how CommerceItems. and tax costs are paid for using a credit card. In addition to storing inherited data. This class implements PaymentGroup and extends PaymentGroupImpl. shipping costs. but is used through the CreditCard and GiftCertificate subclasses (described below in this table). and tax costs are paid for using a store credit. shipping costs. and tax costs are paid for using a gift certificate. or tax costs in the PaymentGroup. It also can contain Relationships to those items.

as well as data about what quantity of CommerceItems in which ShippingGroups need special handling. it also stores data about which CommerceItems in the Order were added from a gift list. GiftlistHandlingInstruction 247 10 . This Relationship object itself contains data such as the quantity of the item to be paid for using the PaymentGroup. When this Relationship is added to a PaymentGroup and ShippingGroup. When this Relationship is added to a PaymentGroup and Order. This Relationship object itself contains data such as the amount of the shipping cost to be paid for using the PaymentGroup. This class provides no functionality itself.ATG Commerce Programming Guide µ Description When this Relationship is added to a ShippingGroup and CommerceItem. the tax cost or order cost is paid for using the information in the PaymentGroup. CommerceItem ID.Working With Purchase Process Objects . the shipping cost is paid for using the information in the PaymentGroup. This Relationship object itself contains data such as the quantity to be shipped. but should be used through a subclass. In addition to storing all the basic data that it inherits. This Relationship object itself contains data such as the amount of the tax cost to be paid for using the PaymentGroup. It contains a ShippingGroup ID. When this Relationship is added to a PaymentGroup and CommerceItem. the CommerceItem is paid for using the information in the PaymentGroup. and quantity. the CommerceItem is shipped using the information in the ShippingGroup. This class implements HandlingInstruction and extends HandlingInstructionImpl. Relationship Classes Classes ShippingGroupCommerceItemRelationship PaymentGroupCommerceItemRelationship PaymentGroupShippingGroupRelationship PaymentGroupOrderRelationship Handling Classes Classes HandlingInstructionImpl Description This class implements HandlingInstruction.

Working With Purchase Process Objects .core. These methods contain the logic that alters the Order’s data structure and maintains its accuracy. They are atg. To make this very large class easier to work with. See the Setting Up a Profile Repository chapter in the ATG Personalization Programming Guide for information on adding properties to user profiles. The original structure remains intact to preserve backwards compatibility. almost all of the business logic resided in the OrderManager class.µ Address Classes ATG Commerce Programming Guide There are two address classes that are not technically a part of ATG Commerce.Address and atg. The methods within these classes are used to make changes to an Order. Note: In previous versions. The following classes are business layer objects: 248 10 . it was broken up into new classes described below. all calls to alter an Order should be made through these classes. but in the future you should use the new object managers.ContactInfo. These objects are referenced when a user checks out a shopping cart. but they play an important role in many commerce processes. Address Properties • • • • • • • • • • • firstName middleName lastName address1 address2 city state county postalCode country ownerId ContactInfo Properties • • • phoneNumber faxNumber email Business Layer Classes The business layer classes contain the logic and business rules for the purchase process.util.util. You may need to extend these objects to track additional information about your users.core.

including methods such as createHandlingInstruction() and removeHandlingInstructionsFromShippingGroup(). The default property settings should be suitable for most sites. OrderManager CommerceItemManager ShippingGroupManager HandlingInstructionMa nager PaymentGroupManager OrderQueries SimpleOrderManager OrderTools OrderTools contains a set of properties that you can use to customize the purchase process. In general. Contains functionality for working with a CommerceItem. For more information. It is a very high-level interface for altering an Order. Contains lookup methods such as getOrdersForProfile() and getOrderIdsWithinDateRange(). Contains functionality for working with handling instructions. only one method call in SimpleOrderManager is required to make a series of changes to an Order. The OrderTools component is located in Nucleus at /atg/commerce/order/. The methods in this class are higher level than the methods in OrderTools. including createShippingGroup() and splitShippingGroup(). This class extends OrderManager. including createPaymentGroup() and intializeCreditCard(). see the OrderTools section. see the Using the SimpleOrderManager section.Working With Purchase Process Objects . The following OrderTool properties can be customized: orderTypeClassMap defaultOrderType commerceItemTypeClassMap defaultCommerceItemType shippingTypeClassMap 249 10 . Contains functionality for working with PaymentGroups. only the OrderManager or SimpleOrderManager makes calls to an OrderTools object. It is not meant to contain business logic or to be used directly. as well as properties referencing the other manager classes listed below. but can be changed.ATG Commerce Programming Guide µ Class OrderTools Description Low-level interface containing the logic for editing an Order data structure. Contains most of the functionality for working with an Order. For more information. including methods such as createOrder(). including methods such as addCommerceItemToOrder() and addItemQuantityToShippingGroup(). Contains functionality for working with ShippingGroups.

a string is passed as a parameter to the create method. The following code defines the default values.” which in turn maps to a class in the orderTypeClassMap property. when the ShoppingCart constructed an Order.0. Consequently.orderType is set to /atg/commerce/order/OrderTools. (For example.) This constructs an instance of a CommerceItem class that is mapped to that string.OrderImpl.order.commerce. orderTypeClassMap This property defines the type-to-class name mapping for Order objects. You can have more than one type of Order object. the string “default” could be passed. defaultOrderType This property defines the default Order type.0.commerce. orderTypeClassMap=\ default=atg. 250 10 .OrderImpl Note: Prior to version 6. When creating a new CommerceItem.order. (For example. The following code defines the default value. the shoppingcart order type is no longer used and remains defined only for backwards compatibility.) This constructs an instance of an Order class that is mapped to that string. it constructed one of the type specified in ShoppingCart. a string is passed as a parameter to the create method.µ defaultShippingGroupType defaultShippingGroupAddressType paymentTypeClassMap defaultPaymentGroupType defaultPaymentGroupAddressType relationshipTypeClassMap beanNameToItemDescriptorMap ATG Commerce Programming Guide You can view the OrderTools component in the ACC to see the configured values for these properties.\ shoppingcart=atg.Working With Purchase Process Objects . ShoppingCart. In the example below.defaultOrderType. the string “default” could be passed. and by default this property was set to shoppingcart. When creating a new Order. Below is a sample of how a mapping is defined in the properties file. Beginning with version 6. defaultOrderType=default commerceItemTypeClassMap This property defines the type-to-class name mapping for CommerceItem objects.orderType. the default type is defined as the string “default. You can have more than one type of CommerceItem object.

” which in turn maps to a class in the commerceItemTypeClassMap property. When creating a new ShippingGroup. You can have more than one type of ShippingGroup object. In the example below. (For example. shippingTypeClassMap=\ default=atg. the string hardgoodShippingGroup could be passed. which in turn maps to a class in the shippingTypeClassMap property. The following code defines the default value. Below is a sample of how a mapping is defined in the properties file.commerce.commerce.) This constructs an instance of a ShippingGroup class that is mapped to that string. the default type is defined as the string hardgoodShippingGroup. The following code defines the default value. the default type is defined as the string “default. CommerceItemTypeClassMap=\ default=atg. 251 10 . defaultCommerceItemType=default shippingTypeClassMap This property defines the type-to-class name mapping for ShippingGroup objects. The following code defines the default values. a string is passed as a parameter to the create method.order. In the example below. defaultShippingGroupAddressType=RepositoryContactinfo To customize your address information.order.commerce. defaultShippingGroupType=hardgoodShippingGroup defaultShippingGroupAddressType This property defines the default ShippingGroupAddressType.ShippingGroupImpl.HardgoodShippingGroup defaultShippingGroupType This property defines the default ShippingGroup type.ATG Commerce Programming Guide µ Below is a sample of how a mapping is defined in the properties file.Working With Purchase Process Objects .CommerceItemImpl defaultCommerceItemType This property defines the default CommerceItem type.\ hardgoodShippingGroup=atg. subclass RepositoryContactInfo and use your new class name for the defaultShippingGroupAddressType.order.

you can customize the environment to use a Relationship class you have subclassed. Relationships are created by methods based on the type of relationship that the method needs. By overriding the default values. The following code defines the default values.commerce. The following code defines the default values.order.\ storeCredit=atg. It is used to configure the class type that will be instantiated when a request to construct a relationship is made. You can have more than one type of Relationship object. relationshipTypeClassMap This property defines the type-to-class name mapping for Relationship objects. This mapping does not need to be modified unless the system is extended.CreditCard. Relationships are not created directly by a user.\ giftCertificate=atg. a string is passed as a parameter to the create method. 252 10 . paymentTypeClassMap=\ default=atg. defaultPaymentGroupType=creditCard defaultPaymentGroupAddressType This property defines the default PaymentGroupAddressType. Below is a sample of how a mapping is defined in the properties file.Working With Purchase Process Objects .µ paymentTypeClassMap ATG Commerce Programming Guide This property defines the type-to-class name mapping for PaymentGroup objects. subclass RepositoryContactInfo and use your new class name for the defaultPaymentGroupAddressType. When creating a new PaymentGroup.StoreCredit defaultPaymentGroupType This property defines the default PaymentGroup type.commerce. defaultPaymentGroupAddressType=RepositoryContactinfo To customize your address information.\ creditCard=atg. (For example. the default type is defined as the string creditCard . The example below demonstrates how a mapping is defined in the properties file.) This constructs an instance of a PaymentGroup class that is mapped to that string.order.commerce.order.commerce. In the example below. You can have more than one type of PaymentGroup object.GiftCertificate. The following code defines the default value. which in turn maps to a class in the paymentTypeClassMap property.PaymentGroupImpl. the string creditCard could be passed. The relationshipTypeClassMap property maps a name to a class.order.

\ atg.GiftCertificate=giftCertificate.\ atg.commerce. The beanNameToItemDescriptorMap property contains this mapping.commerce.payment.\ atg. ShippingGroupCommerceItemRelationship.order.pricing.commerce.\ paymentGroupCommerceItem=atg. All objects that can be mapped to an item descriptor are listed in the beanNameToItemDescriptorMap.pricing.HardgoodShippingGroup=hardgoodShippingGroup. PaymentGroupShippingGroupRelationship.\ atg. The example below demonstrates how a mapping is defined in the properties file.\ atg.commerce.\ paymentGroupShippingGroup=atg.commerce.order.order.pricing.\ atg.order. PaymentGroupCommerceItemRelationship. saving an Order.order.ItemPriceInfo=itemPriceInfo.commerce.DetailedItemPriceInfo=detailedItemPriceInfo.PaymentGroupShippingGroupRelationship=payShipRel.PaymentGroupOrderRelationship=payOrderRel.ShippingPriceInfo=shippingPriceInfo.order.PaymentStatus=paymentStatus.Working With Purchase Process Objects .\ atg.commerce.\ paymentGroupOrder=atg.\ atg.OrderPriceInfo=orderPriceInfo. and checking out an Order.order.ShippingGroupCommerceItemRelationship=shipItemRel.ShippingGroupImpl=shippingGroup.\ atg.commerce.CommerceItemImpl=CommerceItem.commerce.CreditCard=creditCard.OrderImpl=order.commerce. PaymentGroupOrderRelationship beanNameToItemDescriptorMap This property maps a bean name to an OrderRepository item descriptor name.pricing.\ atg.commerce. 253 10 . such as loading an Order.order. The following code defines the default values.order.commerce.commerce.order.commerce.order.order.commerce.ATG Commerce Programming Guide µ relationshipTypeClassMap =\ shippingGroupCommerceItem=atg.\ atg.pricing.commerce. ATG Commerce uses pipelines to execute tasks. beanNameToItemDescriptorMap=\ atg.commerce.PaymentGroupImpl=paymentGroup.commerce.PricingAdjustment=pricingAdjustment Pipelines A pipeline is an execution mechanism that allows for modular code execution.TaxPriceInfo=taxPriceInfo. The format is <bean name>=<repository item descriptor>.\ atg.\ atg. The PipelineManager implements the pipeline execution mechanism.\ atg.commerce.order.commerce.\ atg.commerce.\ atg.\ atg. When saving an Order.order. the processors that contain the code for saving look for an OrderRepository item descriptor with the same name as the bean class.order.PaymentGroupCommerceItemRelationship=payItemRel.pricing.

which can be found at <ATG9dir>/B2CCommerce/config/atg/commerce/commercepipeline. To execute a pipeline through JSPs.xml. The beanNameToItemDescriptorMap property of the OrderTools component maps the Order Repository item descriptors to Bean names. This is the case for the loadOrder().xml.µ ATG Commerce Programming Guide The commerce pipeline is defined in an XML file. 254 10 . the hardgoodShippingGroup item descriptor extends the shippingGroup item descriptor. see the Processor Chains and the Pipeline Manager chapter in this manual. there exists a corresponding item descriptor. this base file is combined with an additional definition file that is located at <ATG9dir>/B2CCommerce/config/atg/commerce/order/orderrepository. The new functionality is inserted into the execution chain without affecting the existing code. the processors that save and load an Order look for an item descriptor that is mapped to the corresponding commerce object class. Order Repository The Order Repository is the layer between ATG Commerce and the database server. which is located at /atg/commerce/order/. for every class that is saved. the beanNameToItemDescriptorMap property contains this mapping. In ATG Consumer Commerce. In the Nucleus hierarchy. The commerce pipeline configuration file contains the definition for the processOrder chain. see the ATG Repository Guide. A pipeline should generally be executed from an OrderManager method. In ATG Business Commerce. Each item descriptor defines a repository item type that describes all the properties that are common to the repository items of that type. see the OrderTools section of the Working With Purchase Process Objects chapter. For more information on SQL repositories. When you deploy an application that includes ATG Commerce.xml for ATG Business Commerce.xml. It is implemented using a SQL repository. see the Configuring Purchase Process Services chapter. updateOrder(). add a new element to the XML file that references the new pipeline processor. The Order Repository definition file defines the item descriptors for all commerce classes. each item descriptor subtype inherits all of the properties of its parent item descriptor. the PipelineManager is below the OrderManager. You can view the mapping by accessing the Pages and Components > Components by Path area of the ATG Control Center and opening the OrderTools component. To insert a new link. the PipelineManager is located at /atg/commerce/PipelineManager. The repository is where Orders are saved after processing and stored in between customers’ visits to your site. define a handle method in a form handler class that calls the PipelineManager.xml for ATG Consumer Commerce and at <ATG9dir>/B2BCommerce/config/atg/commerce/commercepipeline. this base file is combined with an additional definition file that is located at <ATG9dir>/B2BCommerce/config/atg/commerce/order/orderrepository. a new instance is created and the commerce pipeline configuration is loaded. In the overall architecture of ATG Commerce. and processOrder() methods. For example. Additionally. so it inherits all of the properties of the shippingGroup item descriptor. In ATG Commerce. For more information about saving and loading orders. For more information. The base Order Repository definition file is located at <ATG9dir>/DCS/config/atg/commerce/order/orderrepository.Working With Purchase Process Objects . For more information about the OrderTools component.

Shipping Groups. and Payment Groups Adding an Item to an Order via a URL Preventing Commerce Items from Being Added to Types of Shipping Groups Removing Commerce Objects from an Order Using the SimpleOrderManager Creating an Order The first step in working with Commerce objects is to create an Order. To create an Order. 255 10 . Otherwise. String pOrderType) All methods create an Order object and assign it a unique ID. use createOrder() to create the new Order. that parameter determines the type of object that is constructed. String pOrderId. an Order contains one empty ShippingGroup and one empty PaymentGroup when it is created. This section describes how to use the manager classes to create the various commerce objects.Working With Purchase Process Objects . ShippingPriceInfo pShippingPriceInfo. you must have a reference to an OrderManager or SimpleOrderManager. ShippingPriceInfo pShippingPriceInfo. OrderPriceInfo pOrderPriceInfo.ATG Commerce Programming Guide µ Creating Commerce Objects The ATG Commerce “manager” classes contain methods for creating commerce objects and adding them to and removing them from an Order. each of which takes a different set of parameters: createOrder(String pProfileId) createOrder(String pProfileId. String pOrderType) createOrder(String pProfileId. String pOrderType) createOrder(String pProfileId. TaxPriceInfo pTaxPriceInfo. There are many versions of the createOrder method. By default. A shopping cart is an implementation of the Order interface. The type of Order created depends on the method used. OrderPriceInfo pOrderPriceInfo. OrderPriceInfo pOrderPriceInfo. and their types are determined by the defaultShippingGroupType and defaultPaymentGroupType properties of the OrderTools component. Once you have the reference. ShippingPriceInfo pShippingPriceInfo) createOrder(String pProfileId. TaxPriceInfo pTaxPriceInfo. TaxPriceInfo pTaxPriceInfo. the defaultOrderType property of the OrderTools component defines the Order type. String pOrderId. It includes the following subsections: • • • • • • • Creating an Order Creating Multiple Orders Creating Commerce Items. If the method takes an orderType parameter. String pOrderType) createOrder(String pProfileId.

Any previously existing Order object is placed into the collection of saved carts. For example. This class maintains the current Order object as well as a collection of saved Order objects. and switch between carts. It switches the current Order object out to the saved collection of orders and sets the current Order to the Order identified by the handlerOrderId property.Order. you can allow them to switch between any of the Order objects using the following JSP code: <dsp:form action="ShoppingCart.OrderHolder in addition to atg. The ShoppingCart component is located in Nucleus at /atg/commerce/. // Create the Order Order order = orderManager. switch between carts. if a customer has several shopping carts saved. as explained in the rest of this section. Using multiple orders requires atg. By default. They can place items in different shopping carts. set the createDefaultShippingGroup and createDefaultPaymentGroup properties in the OrderTools component to false.createOrder(profileId). set the persistOrders property in the ShoppingCart component to false. orders are persistent.handlerOrderId"> <dsp:droplet name="ForEach"> 256 10 . delete carts.jsp" method="post"> <dsp:input bean="ShoppingCart. The following example demonstrates how to create an Order: OrderManager orderManager = (OrderManager) request. You implement multiple shopping carts using the handleCreate method of the OrderHolder class. This method creates a new Order and sets it as the currentOrder in the OrderHolder.µ // Get a reference to the OrderManager ATG Commerce Programming Guide Note: If you do not want to create an empty ShippingGroup and an empty PaymentGroup for every new Order.order.<BR> </dsp:form> The handleSwitch() method allows customers to switch between shopping carts. a session-scoped component whose handleXXX methods add. delete.Working With Purchase Process Objects .order. retrieve a list of saved carts. Refer to the following JSP example: <dsp:form action="ShoppingCart.commerce. and can check out one cart’s contents while waiting until later to check out the contents of others.create" value="Create" type="submit"/> another shopping cart. Creating Multiple Orders Customers can have an unlimited number of orders in existence at one time. The component that utilizes OrderHolder is /atg/commerce/ShoppingCart.resolveName("/atg/commerce/order/OrderManager").jsp" method="post"> <dsp:select bean="ShoppingCart. To disable persistence.commerce.

displays the shopping carts to the customer. respectively.lang. Creating Commerce Items.addShippingGroupToOrder() PaymentGroupManager.addPaymentGroupToOrder() These methods take an Order and their respective object type as parameters. use the following methods to add them to the Order: • • • CommerceItemManager. Creating these objects follows the same pattern as creating Orders. the order in which they are added to the Order determines their precedence. call create<ObjectType>() in the appropriate manager class. and the corresponding Order would be set as the current Order.id"></dsp:valueof> </dsp:oparam> </dsp:droplet> </dsp:select> <dsp:input bean="ShoppingCart. Shipping Groups.switch" value="Switch" type="submit"/> </dsp:form> The example iterates through the list of saved shopping carts.createCommerceItem().String"> <dsp:option value="<%=option12%>"/> </dsp:getvalueof> <valueofparam="SavedOrder. and gives the customer the option to select one of the saved carts.ATG Commerce Programming Guide µ <dsp:param bean="ShoppingCart. CommerceItemManager. for example. First.id" idtype="java.saved" name="array"/> <dsp:param value="SavedOrder" name="elementName"/> <dsp:oparam name="output"> <dsp:getvalueof id="option12" param="SavedOrder. For PaymentGroups. For more information on creating these commerce objects and adding them to an order. The handleDelete() and handleDeleteAll() methods remove a single Order or all orders (both current and saved).Working With Purchase Process Objects . the next step is to add CommerceItems and possibly additional ShippingGroups and PaymentGroups. The handlerOrderId property would be set to the selected Order ID. and Payment Groups After an Order has been created. refer to the following subsections: • • • • Creating a Standard Commerce Item Creating a Configurable Commerce Item Creating a Shipping Group Creating a Payment Group 257 10 .addItemToOrder() ShippingGroupManager. The call returns the type of class specified by the objectType parameter or the default type when the method used does not accept that parameter. After creating the objects.

µ Creating a Standard Commerce Item 1.resolveName("/atg/commerce/order/OrderManager"). Call CommerceItemManager.createCommerceItem() to create the base commerce item. The example below illustrates how to programmatically create a ConfigurableCommerceItem with subSKU items and then add it to an Order. It could also refer to the product reference in the catalog. Call CommerceItemManager.createCommerceItem(pCatalogRefId). Follow these steps to create a new ConfigurableCommerceItem and associate it with an Order: 1. 2. // Add the CommerceItem to the Order commereceItemManager. commerceItem). Make any changes to the CommerceItem. 2. ProductRef. pCommerceItem) to add the CommerceItem to the Order. This data could be the options for a CommerceItem such as size and color.createCommerceItem(). ATG Commerce Programming Guide Follow these steps to create a new CommerceItem and associate it with an Order: Call CommerceItemManager. Note: createCommerceItem() will work even if you pass it a nonexistent catalog reference ID. // Create the CommerceItem CommerceItem commerceItem = commerceItemManager. This allows you to use ATG Commerce as an ordering system with multiple catalogs.Working With Purchase Process Objects . As initially defined. you must institute a check. the class includes ProductID. This structure allows arbitrary data to be stored with a CommerceItem. the classes must be defined as serializable. and CatalogRef properties. An important concept is that any data that is inserted into the auxiliary data can be serialized at any time in a system that contains remote components. 258 10 . Call CommerceItemManager.addItemToOrder(pOrder. and are described in the Using and Extending the Standard Catalog chapter of this manual. PropertyValue. such as setting the quantity. Creating a Configurable Commerce Item Configurable commerce items are items with other items as optional components. Auxiliary data is a construct that exists in a CommerceItem object. If you want to prevent this behavior.addSubItemToConfigurableItem() or addAsSeparateSubItemToConfigurableItem() to add options to the base item. 3.addItemToOrder(pOrder.setQuantity(3). When defining AuxiliaryData objects. commerceItem. Refer to the following example: // Get a reference to the OrderManager OrderManager orderManager = (OrderManager) request. some of which may not have repositories.

new ItemPriceInfo()). null. // Add the ShippingGroup to the Order shippingGroup. null. 259 10 . "sku10001". new ItemPriceInfo()).addShippingGroupToOrder(pOrder. null. null. "prod20002". Call ShippingGroupManager. "prod20001". Once a second ShippingGroup is added to the Order. shippingGroup). such as setting the address. see Assigning Items to Shipping Groups. null.addItemToOrder(order. Make any changes to the ShippingGroup. getCommerceItemManager(). null. 3. getCommerceItemManager(). new ItemPriceInfo()).createShippingGroup(). 1. null. configurableItem).addSubItemToConfigurableItem(configurableItem.addSubItemToConfigurableItem(configurableItem. these items automatically become part of the default ShippingGroup.ATG Commerce Programming Guide µ ConfigurableCommerceItem configurableItem = (ConfigurableCommerceItem) getCommerceItemManager(). "sku20001".createShippingGroup(). "sku20002". // Create the ShippingGroup ShippingGroup shippingGroup = shippingGroupManager. 2. SubSkuCommerceItem subskuItem = (SubSkuCommerceItem) getCommerceItemManager(). subskuItem). pShippingGroup) to add the ShippingGroup to the Order. "prod10001".resolveName("/atg/commerce/order/OrderManager"). subskuItem). Call ShippingGroupManager. Creating a Shipping Group A ShippingGroup contains information on the shipping address and delivery method for a group of commerce items. 1. null. 1. null. Refer to the following example: // Get a reference to the OrderManager OrderManager orderManager = (OrderManager) request. Relationships must now be created to associate the items with shipping groups.addShippingGroupToOrder(pOrder. subskuItem = (SubSkuCommerceItem) getCommerceItemManager(). (For more information. all the items in the Order are removed from the default ShippingGroup and must be explicitly added to one of two shipping groups. a new Order has one default ShippingGroup.createCommerceItem("subSkuCommerceItem". As items are added to the Order.) Follow these steps to create a new ShippingGroup and add it to an Order: 1. null.Working With Purchase Process Objects . By default. getCommerceItemManager(). null.createCommerceItem("subSkuCommerceItem". null.createCommerceItem("configurableCommerceItem".

UPS. Relationships must now be created to associate the items with payment groups. Call PaymentGroupManager. you must modify some Nucleus components. If more than one shipping group is associated with the order. (For more information. all the items in the Order are removed from the default PaymentGroup and must be explicitly added to one of the two payment groups. 260 10 . a ShippingGroup is created. For example.addPaymentGroupToOrder(pOrder. pPaymentGroup) to add the payment group to the order. 2. The site must provide a UI that allows the customer to enter an address. The following assumptions were made regarding Multishipment: • • Customers want to ship various parts of their orders to different addresses. normally you pass a RepositoryContactInfo object to setShippingAddress() or setBillingAddress().µ ATG Commerce Programming Guide When setting the shipping and billing addresses. see the Assigning Costs to Payment Groups section. these items automatically become part of the default PaymentGroup. but do not want to subclass RepositoryContactInfo (see defaultShippingGroupAddressType in the Order Tools section). (See the Managing the Order Approval Process chapter for more information on approvals. 3. For example. a new Order has one default PaymentGroup.createPaymentGroup(). then all the items to be shipped will go into that shipping group. The customer chooses to have the items shipped to different locations. As items are added to the Order. The site must then provide a UI that allows the customer to associate items with that shipping group. If you want to use a ContactInfo object instead. Customers want to ship various parts of their orders using different shipping methods (FedEx. you could set the credit card number and expiration date. List the properties of your address object in the saveProperties property of /atg/commerce/order/processor/SaveShippingGroupObjects and the loadProperties property of atg/commerce/order/processor/LoadShippingGroupObjects. and so on). Creating Multiple Shipping Groups Multiple shipping groups (which implement Multishipment) on a commerce site permit a customer to ship parts of an order to different addresses using different methods of delivery. By default. Orders with requisition numbers are automatically assumed to require approval.) Follow these steps to create a new PaymentGroup and add it to an Order: 1. After the customer selects a shipper. If there is only one shipping group. suppose a customer enters the checkout process on a site that supports multiple shipping methods for a single order. Once a second PaymentGroup is added to the Order. Creating a Payment Group A PaymentGroup contain information about the payment method that will be used to purchase a group of commerce items. Make any changes to the PaymentGroup.) Payment groups also contain a requisitionNumber property for orders that require approval before a means of payment can be specified. such as UPS or US Postal. and then associate it with a shipper. Call PaymentGroupManager. then the customer must decide which items go into which group.Working With Purchase Process Objects .

Consider the following example request URL: http://yoursite. or any combination of the two.addPaymentGroupToOrder(pOrder. Because this process is part of the Request-handling pipeline (which handles all ATG requests and responses). The product UI for this component is entirely JSP-based. if necessary.resolveName("/atg/commerce/order/OrderManager"). Customers can pay for part of a purchase using one payment method and use another payment method for the rest of the purchases. The following table explains the URL elements: 261 10 . each time a page is requested.com/yourpage. For example. or amount. and additional parameters give the specifics for the action. The following assumptions were made regarding Multipayment: • • • Customers can divide payment for an order or individual items by item quantity. The base commerce classes have built-in support for multiple payment methods.createPaymentGroup(). suppose a customer begins the checkout process on a site that supports multiple payment methods for a single order. // Create the PaymentGroup PaymentGroup paymentGroup = paymentGroupManager. the request will be checked to see if it includes commerce item information. The customer chooses to partition payment by putting the first $1000 of a $1250 order on a Visa credit card. Creating Multiple Payment Groups Multiple payment groups (which implement Multipayment) on a commerce site permit a customer to split the cost of an order by amount and/or items. // Add the PaymentGroup to the Order paymentGroupManager.jsp?dcs_action=additemtocart&url_catalog_ref_ id=sku10001&url_product_id=prod10001&url_quantity=1&dcs_ci_catalogKey=en_ US&dcs_subsku=sku10001.ATG Commerce Programming Guide µ Refer to the following example: // Get a reference to the OrderManager OrderManager orderManager = (OrderManager) request.prod10002. you can allow a user to add an item to his or her order by clicking a URL. Multipayment allows customers to pay for purchases using multiple payment methods. Gift certificates are implemented as payment methods. a customer can choose to pay for an order using two or more credit cards and a gift certificate. Out of the box. For example. amount level. The customer then chooses to pay for the remaining $250 using points earned on the site during previous visits. you can limit the ways in which an order’s costs can be split.2&dcs_subsku=sku10002. percentage.prod10001. Adding an Item to an Order via a URL The CommerceCommandServlet provides a foundation for URL-based actions.1 The dcs_action flag notifies the request-handling pipeline of the action to be performed.Working With Purchase Process Objects . paymentGroup). While customers can select payment methods by item level.

prod1000 2. the individual quantity would still be 2. (Required) The quantity of the SKU to add to the cart. Example dcs_ci_catalogKey=en_US would cause the property catalogKey to be set to the value “en_US”. The ID of the ShippingGroup to which to add the item. individual quantity>. dcs_subsku=sku10001. 262 10 . ATG Commerce handles the multiplication. you must issue two separate requests to ATG Commerce to add each of the configurations as separate ConfigurableCommerceItems. If a dcs_subsku parameter is in the URL. SubSkuCommerceItem is a subclass of CommerceItemImpl. prod10001 and quantity 2 and SKU/product combination sku10002.2&dcs_subsku=sku10002. A string specifying which CommerceItem type to use. if you are adding a computer with 2 hard drives. The ID of the CommerceItem which this configuration should replace. If no other parameters are supplied. url_catalog_ref_ id url_product_id url_quantity url_shipping_gro up_id url_item_type url_commerce_ite m_id dcs_ci_* (Required) The SKU of the product to add to the cart. the individual quantity would be 2. then the base SKU/product is represented in a ConfigurableCommerceItem object and the subSKU is represented in a SubSkuCommerceItem object. For example. the servlet creates a CommerceItem and adds it to the cart. the first four parameters listed in the table above are required. then this is a reconfiguration.prod10001. The format is: dcs_subsku=<sku id.Working With Purchase Process Objects . each with 2 hard drives. An identifier for setting a CommerceItem property. If you need to add two different computer configurations. An identifier for a configurable property of a CommerceItem.1 causes the servlet to add a CommerceItem with SKU/product dcs_subsku combination sku10001. If this parameter is supplied. As indicated. The individual quantity portion of this parameter reflects the quantity of the item which will be added to a single ConfigurableCommerceItem. For example.µ Element dcs_action ATG Commerce Programming Guide Function (Required) When CommerceCommandServlet receives the dcs_action “additemtocart. (Required) The product ID of the product to add to the cart.prod10002 and quantity 1 to the ConfigurableCommerceItem. You can extend the CommerceCommandServlet and the pipeline to let the user trigger some other action by clicking a URL. product id. If you were adding 1000 computers.” it calls the AddItemToCartServlet.

Alternatively. In this property. To remove subitems from configurable commerce items.Working With Purchase Process Objects . and payment groups from an Order. shipping groups.removeAllSubItemsFromConfigurableItem() 263 10 . it might be necessary to prevent specific commerce items from being added to certain types of shipping groups.removePaymentGroupFromOrder() These methods take an Order and their respective object ID as parameters. and addItemQuantityToShippingGroup and addRemainingItemQuantityToShippingGroup() in the CommerceItemManager. or PaymentGroup. They are: • • • CommerceItemManager.removeSubItemFromConfigurableItem() CommerceItemManager. you could create a shippingGroupsNotAllowed property for the SKU item descriptor in the product repository. list the names of the ShippingGroup types to which a CommerceItem is not allowed. then the item is added to the ShippingGroup with the specified ID. These methods are addItemToShippingGroup() in the ShippingGroupManager. Preventing Commerce Items from Being Added to Types of Shipping Groups By default. ShippingGroup. Note: The available ShippingGroup types are listed in the shippingTypeClassMap property of the OrderTools component. It does not make sense for a box of golf balls to be shipped electronically. use one of these methods: • • CommerceItemManager.removeItemFromOrder() ShippingGroupManager. For example.ATG Commerce Programming Guide µ If all required parameters and shipping_group_id are supplied. The object ID is found in the id property of the CommerceItem. Add a new shippingGroupsAllowed property to the SKU item descriptor in the product repository. only certain types of items can be assigned to an ElectronicShippingGroup. Override any necessary methods to make sure the shippingGroupsAllowed property in the SKU that this CommerceItem represents matches the shippingGroupClassType property of the ShippingGroup to which the CommerceItem is being added. The shippingGroupsAllowed property should contain a list of shipping groups to which the SKU that this CommerceItem represents can be added. Removing Commerce Objects from an Order The counterparts to the add methods are the methods for removing commerce items. Follow these steps to prevent commerce items from being added to specific types of shipping groups: 1.removeShippingGroupFromOrder() PaymentGroupManager. all items are allowed to go into any type of ShippingGroup. 2. However.

The PaymentGroupOrderRelationship contains the amount to charge. Another Relationship example is a PaymentGroupOrderRelationship. You can use SimpleOrderManager in place of OrderManager to simplify your code. For example.µ Using the SimpleOrderManager ATG Commerce Programming Guide SimpleOrderManager extends OrderManager. skuId. the PaymentGroup. A PaymentGroupOrderRelationship is constructed implicitly. Unlike most business objects. String skuId = getSkuId(). Methods where the operator is a Relationship are placed in the operand’s manager class. String productId = getProductId(). In ATG Commerce. which represents a relationship between an Order and the PaymentGroup responsible for the whole or partial cost of the Order. a ShippingGroupCommerceItemRelationship represents a relationship between a CommerceItem and a ShippingGroup. ShippingGroup shippingGroup = getShippingGroup(). the ShippingGroup. By default.resolveName("/atg/commerce/order/OrderManager"). one default shipping group. For example. The PaymentGroup contains the credit card information. and the Order. quantity. // Creates a PaymentGroupOrderRelationship implicitly om. pPaymentGroup). a new Order has one default payment group. and the quantity of this item to ship to the address in the ShippingGroup. Logically. long quantity = getQuantity(). shippingGroup). // Get a reference to the OrderManager OrderManager om = (OrderManager) request.addRemainingOrderCostToPaymentGroup(pOrder. getSimpleOrderManager(). The Relationship indicates that the CommerceItem will be handled according to the information in the ShippingGroup. While you never explicitly add a Relationship to an Order. When you create these additional associations. relationships handle the details of which payment or shipping method to use for which items. as the example below shows. Below is a code sample that associates part of an order’s cost with a specific PaymentGroup. and no Relationships. a method 264 10 . the SimpleOrderManager sits above the OrderManager and provides higher-level functionality. What takes several lines of code to do in the OrderManager takes only a single line of code in the SimpleOrderManager. The Relationship contains the CommerceItem to ship. Using Relationship Objects A Relationship represents an association between two other objects.addItemToShippingGroup(order. Relationship objects do not have their own “manager” class. a SimpleOrderManager object is configured in Nucleus at /atg/commerce/order/OrderManager.Working With Purchase Process Objects . you do so implicitly by calling methods like addItemQuantityToShippingGroup() or addShippingCostAmountToPaymentGroup(). productId.

then all the CommerceItems are shipped to the location in the ShippingGroup. For example. The remaining 4 will be handled by the next relationship whose priority is less than the first relationship. If the quantity in the Relationship is greater than the quantity in the CommerceItem. Assigning Items to Shipping Groups and Assigning Costs to Payment Groups. These types determine what happens when an Order is checked out. Relationship Types Relationship objects have associated types. see the next two sections. a given CommerceItem cannot have more than one PaymentGroupRelationship of a “remaining” type. if a PaymentAmount relationship exists with quantity 6 and references an item with quantity 10. ShippingQuantityRemaining: This relationship type indicates that the remaining • quantity of the item unaccounted for by other ShippingGroupCommerceItemRelationship objects will be shipped using the information in the ShippingGroup.Working With Purchase Process Objects . Note: For all of the following relationship types. then all 10 items will be paid for using that first PaymentGroup. The quantity to ship is stored inside the Relationship. it can have a PaymentGroupRelationship and a ShippingGroupRelationship – both of a “remaining” type – because the two relationships are separate entities. This relationship can be assigned the relationship type ShippingQuantity or ShippingQuantityRemaining. as well as what types the relationship’s member variables have. This section describes the following Relationship objects and their possible relationship types: • • • • ShippingGroupCommerceItemRelationship Object PaymentGroupOrderRelationship Object PaymentGroupCommerceItemRelationship Object PaymentGroupShippingGroupRelationship Object For details on assigning items to relationships of specific types. 265 10 . and a method for assigning a CommerceItem to a ShippingGroup is in the CommerceItemManager. Methods that operate on a subclass of a given commerce object are placed in the superclass’s manager class. For example. quantities and amounts designated by a number are processed as “up to and including” the given number. if the relationship contained quantity 15. However. 6 of those items will be paid for using the PaymentGroup that the relationship references. These relationship types assign CommerceItems to ShippingGroups that specify which items in the Order will be shipped to which destinations. The following list describes the relationship types: • ShippingQuantity: This relationship type indicates that a specific quantity of the item will be shipped using the information in the ShippingGroup.ATG Commerce Programming Guide µ for adding an Order to a ShippingGroup is in the OrderManager. ShippingGroupCommerceItemRelationship Object A ShippingGroupCommerceItemRelationship represents a relationship between a CommerceItem and a ShippingGroup. Also note that it is not possible to have more than one Relationship of a specific “remaining” type (described below) in any given object. and the quantity purchased is stored inside the CommerceItem. On the other hand.

core. if one CommerceItemShippingGroupRelationship accounts for four out of six CommerceItems. then the cost of the entire Order will be paid using the referenced PaymentGroup. The difference between creating a second relationship with type ShippingQuantity and using ShippingQuantityRemaining is that. If the relationship amount is greater than the total amount of the Order. then the new items default to the ShippingGroup in that relationship. The customer wants the remaining apples (7) shipped to his office. Two ShippingGroups already exist. The following list describes the relationship types: • OrderAmount: This relationship type indicates that a specific amount of the total cost of the Order (including CommerceItems. A PaymentGroupOrderRelationship can be assigned the type OrderAmount. and tax) will be paid using the information in the PaymentGroup. or assign different types of costs (such as item cost vs. Set the Range’s lowBound and highBound to indicate which items to include. or the relationship type ShippingQuantityRemaining. Bounds are inclusive. If the second relationship is of type ShippingQuantityRemaining.Working With Purchase Process Objects . then the new items would not be assigned to a ShippingGroup. Both relationship types use an atg. For example. tax) to separate PaymentGroups. ensuring correct pricing for each CommerceItem regardless of any changes the user may make to ShippingGroups while browsing. ShippingGroups. or TaxAmountRemaining. This relationship can have either the relationship type ShippingQuantity with quantity 7. This relationship type is ShippingQuantity and the quantity to ship is 3. PaymentGroupOrderRelationship Object A PaymentGroupOrderRelationship represents a relationship between an Order and a PaymentGroup. setting the lowBound to 1 and the highBound to 4 means the first four CommerceItems are shipped using this relationship. a customer places an order for CommerceItem Apple with quantity 10. SG1 (home) and SG2 (office). if the quantity of CI1 increases. 266 10 . Either split the entire cost by using PaymentGroupOrderRelationships.µ ATG Commerce Programming Guide Note: Any ShippingQuantityRemaining relationships have the lowest priority. TaxAmount. The customer wants 3 apples shipped to his home. using ShippingQuantity. These relationship types assign the order and tax amounts to different PaymentGroups. Range information is calculated when the end user checks out.util. Setting the lowBound to 3 and the highBound to 6 means the last four are shipping using this relationship. A CommerceItem can have only one Relationship of type ShippingQuantityRemaining. so a ShippingGroupCommerceItemRelationship is created between CI1 (apple) and SG1 (home). OrderAmountRemaining. For example.Range object to determine which particular CommerceItems to include for a given quantity. A ShippingGroupCommerceItemRelationship is created between CI1 (apple) and SG2 (office). There are two ways to split the cost of an Order across PaymentGroups. The amount must be greater than zero.

Working With Purchase Process Objects . then all the tax will be paid for using the referenced PaymentGroup. The relationship type is set to OrderAmountRemaining. The relationship can have the relationship type PaymentAmount or PaymentAmountRemaining. This relationship type is used to split payment for a single CommerceItem between multiple payment groups. Note: An Order can have only one Relationship of type TaxAmountRemaining. A PaymentGroupOrderRelationship is created between the PaymentGroup that represents the credit card and the Order. A customer places an order with a total tax of $100.ATG Commerce Programming Guide µ • OrderAmountRemaining: This relationship type indicates that the remaining cost of the Order unaccounted for by other PaymentGroupOrderRelationship objects will be paid using the information in the PaymentGroup. Two relationships are created to split the payment: • One PaymentGroupOrderRelationship is created between the Visa’s PaymentGroup and the Order. and the amount is set to $400. The customer wants to pay for the order using two credit cards (Visa and MasterCard). Example #1 The following example describes how to use the OrderAmount and OrderAmountRemaining types. The relationship type is set to TaxAmountRemaining. The following list describes the relationship types: 267 10 . When the Order is charged. A different PaymentGroup represents each credit card. PaymentGroupCommerceItemRelationship Object A PaymentGroupCommerceItemRelationship represents a relationship between a CommerceItem and a PaymentGroup. A customer places an Order with a total of $600. The customer wants to pay for the tax with a separate credit card than the rest of the order payment. Note: An Order can have only one Relationship of type OrderAmountRemaining. • TaxAmount: This relationship type indicates that a specific amount of the tax charged for the Order will be paid using the information in the PaymentGroup. $400 will be charged on the Visa and $200 will be charged on the MasterCard. The amount must be greater than zero. Example # 2 The following example describes how to use the TaxAmountRemaining type. • One PaymentGroupOrderRelationship is created between the MasterCard’s PaymentGroup and the Order. The relationship type is set to OrderAmount. which covers whatever the tax amount turns out to be. If the relationship amount is greater than the total amount of the Order. • TaxAmountRemaining: This relationship type indicates that the tax cost unaccounted for by other PaymentGroupOrderRelationship objects will be paid using the information in the referenced PaymentGroup.

This relationship can be assigned the relationship types ShippingAmount or ShippingAmountRemaining. For example. A different PaymentGroup represents each credit card. a customer places an order for a CommerceItem (Car) with the total cost $10. then the entire cost of the item will be paid for using the referenced PaymentGroup. This type of Relationship is used to assign shipping costs in a ShippingGroup to PaymentGroups. • ShippingAmountRemaining: This relationship type indicates that any remaining shipping cost amount unaccounted for by other PaymentGroupShippingGroupRelationship objects will be paid using the information in the PaymentGroup.Working With Purchase Process Objects . The third PaymentGroupCommerceItemRelationship connects the CommerceItem (car) and the third PaymentGroup (American Express). and the amount is set to $4000. then the entire cost of that item will be paid for using the information in the PaymentGroup. If the amount is greater than the total amount of the item stored in the CommerceItem. Note: A CommerceItem can have only one Relationship of type PaymentAmountRemaining. The following list describes the relationship types: • ShippingAmount: This relationship type indicates that a specific amount of the shipping cost will be paid using the information in the PaymentGroup. If there is only one relationship between a given CommerceItem and a PaymentGroup of type PaymentAmountRemaining. If there is only one relationship between a given 268 10 . PaymentAmountRemaining: This relationship type indicates that any remaining payment amount unaccounted for by other PaymentGroupCommerceItemRelationship objects will be paid using the information in the PaymentGroup. PaymentGroupCommerceItemRelationships must be created between the CommerceItem (Car) and the three PaymentGroup objects: • The first PaymentGroupCommerceItemRelationship connects the CommerceItem (car) and the first PaymentGroup (Visa). MasterCard.µ • • ATG Commerce Programming Guide PaymentAmount: This relationship type indicates that a specific amount of the item’s cost will be paid for using the information in the PaymentGroup. • • PaymentGroupShippingGroupRelationship Object A PaymentGroupShippingGroupRelationship represents a relationship between a ShippingGroup and a PaymentGroup.000. The relationship type is set to PaymentAmountRemaining. The customer wants to split the payment of this item between three credit cards (Visa. and American Express). The amount must be greater than zero. and the amount is set to $4000. If the amount is greater than the total amount of the item stored in the ShippingGroup. The second PaymentGroupCommerceItemRelationship connects the CommerceItem (car) and the second PaymentGroup (MasterCard). The amount must be greater than zero. then the cost of the entire item will be paid using the referenced PaymentGroup. To split the item between three payment groups. The relationship type is set to PaymentAmount. The relationship type is set to PaymentAmount.

Note: A ShippingGroup can have only one Relationship of type PaymentAmountRemaining. The credit card information is stored in the only PaymentGroup. The shipping costs are $10. Relationship Type ShippingQuantity Valid Methods get/setQuantity(). If relationships are the same types. A relationship’s type determines its priority.Working With Purchase Process Objects . For example. get/setRange() ShippingQuantityRemaining OrderAmount OrderAmountRemaining PaymentAmount PaymentAmountRemaining ShippingAmount ShippingAmountRemaining TaxAmount TaxAmountRemaining get/setRange() get/setAmount() N/A get/setAmount() N/A get/setAmount() N/A get/setAmount() N/A Relationship Priority The priority of a Relationship is important during order processing. get/setAmount(). Commerce Item Relationships The CommerceItemRelationship interface. the returned value is undefined. The customer wants to pay for the shipping costs with a credit card. get/setRange()).ATG Commerce Programming Guide µ ShippingGroup and a PaymentGroup of type PaymentAmountRemaining. The table below summarizes which methods are valid with which relationship types. which is implemented by ShippingGroupCommerceItemRelationship and PaymentGroupCommerceItemRelationship objects as described previously. contains a set of numeric methods (get/setQuantity(). A PaymentGroupShippingGroupRelationship of type ShippingAmount is created. If an invalid method is called. and the amount is set to $10. Certain method calls are valid depending on the relationship type. the priority is determined by the order in which the relationships were created. 269 10 . then the entire shipping cost will be paid using the information in the PaymentGroup. an order is shipped to one location stored in a ShippingGroup.

Before the Order is checked out. This requirement is checked during the checkout process by the validateForCheckout pipeline.µ 1. in specific. However. the system moves through the relationships of CommerceItems. that item is automatically a part of the default ShippingGroup because it is assumed that when there is only one ShippingGroup. once a second ShippingGroup is added to the Order.Working With Purchase Process Objects . any items that were in the default ShippingGroup are no longer a part of any ShippingGroup. this property is set to hardgoodShippingGroup in ATG Consumer Commerce and b2bHardgoodShippingGroup in ATG Business Commerce. Each processor in the validateForCheckout pipeline validates a different part of the Order as complete. Shipping Priority ShippingQuantity ShippingQuantityRemaining ATG Commerce Programming Guide When an Order is being processed or fulfilled. validates the shipping groups in the Order. The validateShippingGroupsForCheckout processor. Shipping Cost Payment Priority: ShippingAmount ShippingAmountRemaining 4. all items are a part of that group. Order Cost Payment Priority OrderAmount OrderAmountRemaining Assigning Items to Shipping Groups When an Order is first created. By default. which is executed by the processOrder pipeline. which serves as the default ShippingGroup for the Order. Tax Cost Payment Priority: TaxAmount TaxAmountRemaining 5. The type of default ShippingGroup that is created is determined by the defaultShippingGroupType property of the OrderTools component. Commerce Item Payment Priority PaymentAmount PaymentAmountRemaining 3. ShippingGroups. all of the order’s commerce items must be a part a ShippingGroup. and PaymentGroups in the following order: 2. the existing CommerceItem and any new commerce items must be explicitly assigned to one of the two shipping groups. it has an empty ShippingGroup. The shipping groups are considered complete if the following criteria are met: 270 10 . When a CommerceItem is added to the Order.

271 10 . as follows: If a CommerceItem has a ShippingGroupCommerceItemRelationship of type ShippingQuantityRemaining. see the Relationship Priority subsection of the Using Relationship Objects section in the Working With Purchase Process Objects chapter. 2. which serves as the default PaymentGroup for the Order. which is determined by the relationship’s type. then the shipping of all commerce items in the Order implicitly is accounted for by that ShippingGroup. see the Relationship Types section in this chapter. but no relationship of type ShippingQuantityRemaining. The range property in the ShippingGroupCommerceItemRelationship identifies which particular items out of the total quantity of a CommerceItem are associated with a given ShippingGroup. The type of default PaymentGroup that is created is determined by the defaultPaymentGroupType property of the OrderTools component. then the item’s shipping is accounted for regardless of whether it has other shipping relationships. For more on relationship types and priority. or if there is more than one ShippingGroup in the Order. If there is only one ShippingGroup in the Order and relationships exist between that ShippingGroup and the commerce items in the Order. then the total quantity of the CommerceItem covered by the relationships must be equal to or greater than the quantity in the CommerceItem.Working With Purchase Process Objects . All of the commerce items in the Order are assigned to a ShippingGroup. Assigning Costs to Payment Groups When an Order is first created. city. it has an empty PaymentGroup. state. For more information on the processOrder and validateForCheckout pipelines. Note: The priority of a Relationship in an Order. see the Checking Out an Order section of the Configuring Purchase Process Services chapter. this property is set to CreditCard. This is because a “remaining” relationship type covers any quantity of the CommerceItem that is not accounted for by other shipping relationships. This requirement must be met according to the following rules: If there is only one ShippingGroup in the Order and no relationships exist between that ShippingGroup and the commerce items in the Order. None of the required fields (name. plays a role in when the Relationship is processed as the Order proceeds through the checkout process. If a CommerceItem has one or more ShippingGroupCommerceItemRelationship objects of type ShippingQuantity. then every CommerceItem in the Order must have its shipping explicitly accounted for with one or more ShippingGroupCommerceItemRelationship objects. By default. and postal code) are empty in any ShippingGroup. For more information on ShippingGroupCommerceItemRelationship objects. address.ATG Commerce Programming Guide µ 1.

and all shipping and tax costs must be explicitly assigned to one of the two payment groups. then the assignment of Order costs is automatic. 272 10 . However. All of the costs associated with the Order. The payment groups in the Order are considered complete if the following criteria are met: 1. This requirement is checked during the checkout process by the validateForCheckout pipeline. any new commerce items. see the Checking Out an Order section of the Configuring Purchase Process Services chapter. which is executed by the processOrder pipeline. respectively) to the Order. all CommerceItem costs – along with all shipping and tax costs -. Each processor in the validateForCheckout pipeline validates a different part of the Order as complete. you must explicitly assign the Order costs to the payment groups. state. address.Working With Purchase Process Objects . which include the commerce item costs. plays a role in when the Relationship is processed as the Order proceeds through the checkout process. You can do so using one of following methods: • Assign the total cost of the Order to one or more payment groups. are accounted for by one or more payment groups.are a part of that group. and tax. Assign the component costs of the Order -. that item is automatically a part of the default PaymentGroup because it is assumed that when there is only one PaymentGroup. Assigning an Order’s Total Cost to Payment Groups To assign the total cost of the Order to one or more payment groups. 2. If the Order has only one payment group. any items that were in the default PaymentGroup are no longer a part of any PaymentGroup.the commerce item costs. use the addOrderAmountToPaymentGroup() and addRemainingOrderAmountToPaymentGroup() methods in the OrderManager.to one or more payment groups. Before the Order is checked out. For information on the PaymentGroupCommerceItemRelationship and PaymentGroupShippingGroupRelationship objects that are described in the following subsections. city. which is determined by the relationship’s type. and postal code) are empty in any PaymentGroup. and it is the most straightforward way to account for an order’s payment because you are dealing with the Order costs as a whole. all of the order’s costs must be a part of a PaymentGroup. if the Order has more than one payment group. and tax -. the existing CommerceItem. once a second PaymentGroup is added to the Order. shipping costs. see the Relationship Types section in this chapter. shipping costs. These methods add PaymentGroupOrderRelationship objects (of type OrderAmount or OrderAmountRemaining. However. see the Relationship Priority subsection of the Using Relationship Objects section in the Working With Purchase Process Objects chapter. None of the required fields (name. Note: The priority of a Relationship in an Order. • For more information on the processOrder and validateForCheckout pipelines. See Assigning an Order’s Component Costs to Payment Groups. This approach is more frequently used. See Assigning an Order’s Total Cost to Payment Groups. For more on relationship types and priority. You should use this method if you need more control over where to assign the component costs of an Order.µ ATG Commerce Programming Guide When a CommerceItem is added to the Order.

) • Assigning an Order’s Component Costs to Payment Groups An order’s component costs include its commerce item costs. Example 2 This example assigns an order’s total cost to more than one PaymentGroup.90. 2. then the sum of the amounts in the relationships must be equal to or greater than the total amount of the Order to account for the order’s total cost.Working With Purchase Process Objects . This is because a “remaining” relationship covers everything not accounted for by other payment relationships. then during checkout the order’s total cost is accounted for according to the following rules: • If the Order contains a PaymentGroupOrderRelationship of type OrderAmountRemaining.ATG Commerce Programming Guide µ Example 1 This example assigns an order’s total cost to a single PaymentGroup.90 to the second PaymentGroup. You can assign these various costs to payment groups using the following methods: 273 10 . then the order’s total cost is accounted for regardless of whether or not the Order has other payment relationships. ShippingGroup costs. (The total amount of an Order is the sum of its CommerceItem costs. The order’s total cost is $20.90. You want to assign $10. Accounting for an Order’s Total Cost If the total cost of an Order is assigned to one or more payment groups. Follow these steps to assign the amounts to the different payment groups: 1. shipping costs. and there are two payment groups in the Order. You can account for the total cost of the Order by calling: • addRemainingOrderAmountToPaymentGroup() and passing in the required parameters. If an Order contains one or more PaymentGroupOrderRelationship objects of type OrderAmount. Call addRemainingOrderAmountToPaymentGroup(). Call addOrderAmountToPaymentGroup() and pass in the first PaymentGroup and 10.90 for the amount parameter. then you must call removeOrderAmountFromPaymentGroup() and then call addOrderAmountToPaymentGroup() again and pass in the new amount.or -• addOrderAmountToPaymentGroup() and passing in the value 20.90 for the amount parameter.00 for the amount parameter.90.00 to the first PaymentGroup and $10. and tax. -. or call addOrderAmountToPaymentGroup() and pass in the second PaymentGroup and 10. The order’s total cost is $20. and tax. The disadvantage to calling addOrderAmountToPaymentGroup() instead of addRemainingOrderAmountToPaymentGroup() is that if the order’s total amount increases above $20.

If a CommerceItem has one or more PaymentGroupCommerceItemRelationship objects of type PaymentAmount. Call addItemAmountToPaymentGroup() for the second item and pass 9. shipping costs. Both items are in the shipping group.80.80 for the amount parameter to the second payment group. then during checkout the order’s CommerceItem costs are accounted for according to the following rules: • If there is only one PaymentGroup in the Order and no relationships exist between that PaymentGroup and the commerce items in the Order. The order’s costs are now accounted for because the commerce item costs.99 for the amount parameter to the second payment group.00 for the amount parameter to the first payment group.addRemainingTaxAmountToPaymentGroup() For example. as follows: • If a CommerceItem has a PaymentGroupCommerceItemRelationship of type PaymentAmountRemaining.00. 2. and the shipping cost is $5. and tax have all been assigned to a payment group.addRemainingItemAmountToPaymentGroup() ShippingGroupManager. 4.99. If there is only one PaymentGroup in the Order and relationships exist between that PaymentGroup and the commerce items in the Order. 274 10 . then the cost of all commerce items in the Order implicitly is accounted for by that PaymentGroup. 3. or if there is more than one PaymentGroup in the Order. then every CommerceItem in the Order must have its costs explicitly accounted for with one or more PaymentGroupCommerceItemRelationship objects. The cost of the first item is $5.addItemAmountToPaymentGroup() CommerceItemManager.addShippingCostAmountToPaymentGroup() ShippingGroupManager. suppose an Order has two commerce items. but no PaymentGroupCommerceItemRelationship of type PaymentAmountRemaining. Call addShippingCostAmountToPaymentGroup() for the shipping group and pass 5. Accounting for Commerce Item Costs If the CommerceItem costs of an Order are assigned to one or more payment groups.addTaxAmountToPaymentGroup() OrderManager. two payment groups. and the cost of the second item is $9.99.99 for the amount parameter to the first payment group. The tax for the order is $0.Working With Purchase Process Objects .µ • • • • • • ATG Commerce Programming Guide CommerceItemManager. and one shipping group. Call addTaxAmountToPaymentGroup() for the order’s tax and pass 0. You might account for the order’s costs by doing the following: 1.addRemainingShippingCostToPaymentGroup() OrderManager. Call addItemAmountToPaymentGroup() for the first item and pass 5. then that relationship accounts for the cost of the CommerceItem regardless of whether the CommerceItem has other payment relationships. This is because a “remaining” relationship covers everything not accounted for by other payment relationships.

then the sum of the amounts in the relationships must be equal to or greater than the total tax amount of the Order to account for tax payment. then the shipping costs for the Order implicitly are accounted for by that PaymentGroup. 275 10 . or if there is more than one PaymentGroup in the Order. as follows: • If a ShippingGroup has a PaymentGroupShippingGroupRelationship of type ShippingAmountRemaining. Setting Handling Instructions Handling instructions are specific instructions that can be associated with the commerce items in a shipping group. then the order’s tax cost is accounted for regardless of whether or not the Order has other payment relationships. then during checkout the order’s shipping costs are accounted for according to the following rules: • If there is only one PaymentGroup in the Order and no relationships exist between that PaymentGroup and the shipping groups in the Order. • If the Order contains one or more PaymentGroupOrderRelationship objects of type TaxAmount. If there is only one PaymentGroup in the Order and relationships exist between that PaymentGroup and the shipping groups in the Order.Working With Purchase Process Objects . Accounting for Shipping Costs If the shipping costs of an Order are assigned to one or more payment groups. then every ShippingGroup in the Order must have its costs explicitly accounted for by one or more PaymentGroupShippingGroupRelationship objects. a customer could set handling instructions for gift wrapping.ATG Commerce Programming Guide µ then the total cost covered by all of the relationships must be equal to or greater than the total cost of the CommerceItem. This is because a “remaining” relationship covers everything not accounted for by other payment relationships. then during checkout the order’s tax cost is accounted for according to the following rules: • If the Order contains a PaymentGroupOrderRelationship of type TaxAmountRemaining. If a ShippingGroup has one or more PaymentGroupShippingGroupRelationship objects of type ShippingAmount. Accounting for Tax If the tax of an Order is assigned to one or more payment groups. For example. This is because a “remaining” relationship covers everything not accounted for by other payment relationships. but no PaymentGroupShippingGroupRelationship of type ShippingAmountRemaining. then that relationship accounts for the cost of the ShippingGroup regardless of whether the ShippingGroup has other payment relationships. then the total cost covered by all of the relationships must be equal to or greater than the total cost of the ShippingGroup.

detailed examples of how to extend the purchase process to support new commerce objects. respectively.µ HandlingInstruction Objects ATG Commerce Programming Guide HandlingInstruction objects are constructed using one of the createHandlingInstruction() methods in the HandlingInstructionManager. For additional. see the ATG API Reference. public void setWrappingPaperId(String pWrappingPaperId).commerce. see the SQL Repository Data Models chapter in the ATG Repository Guide. Each HandlingInstruction would be of a different class type: GiftwrapHandlingInstruction and GiftlistHandlingInstruction. there can be only one GiftwrapHandlingInstruction with a quantity of 1 in the ShippingGroup because there is only one item in the ShippingGroup. For information on how to create new item descriptors in a repository. The example also uses a repository with a wrapping paper item descriptor. A quantity of 1. see the Extending the Purchase Process section in this guide.HandlingInstructionImpl class. However. A customer can set more than one handling instruction for a given CommerceItem in a ShippingGroup. Each HandlingInstruction would contain: • • • • The ID of the ShippingGroup that contains the CommerceItem. 276 10 . there can be a GiftlistHandlingInstruction in the ShippingGroup that references the same item because the two HandlingInstruction objects are different types.order. For example: public String getWrappingPaperId(). The ID of the CommerceItem to which the handling instruction applies. Any other necessary fields of GiftwrapHandlingInstruction and GiftlistHandlingInstruction. if an Order contains a single CommerceItem that was added to a user’s shopping cart from another user’s gift list and needs to be gift wrapped. call the addHandlingInstructionToShippingGroup() method to add the handling instructions to the ShippingGroup that contains the commerce item(s) whose IDs are specified in the HandlingInstruction. two HandlingInstructions must be created – one for the gift wrapping and another for the gift list. Adding Handling Instructions to a Shipping Group Handling instructions can be added to either shipping groups or individual commerce items. After the object is created and populated with the required data. The sum of HandlingInstruction quantities cannot exceed the quantity in the ShippingGroup for a particular HandlingInstruction class. Step 1: Create a GiftwrapHandlingInstruction class that extends the atg. For more information on HandlingInstruction. In the above example. Add a property to identify the wrapping paper. see the Configuring Merchandising Services chapter. This section provides an example of how to create handling instructions for gift wrapping one item in a shipping group. For details on GiftListHandlingInstructions.Working With Purchase Process Objects . For example.

properties: handlingTypeClassMap+=giftwrapHandlingInstruction= mypackage.xml.xml in the configpath. For example.xml file is located in /atg/commerce/order/orderrepository. . </table> Second.ATG Commerce Programming Guide µ Step 2: Add support for this class to the OrderTools component.GiftwrapHandlingInstruction= giftwrapHandlingInstruction Step 3: Add support for the new item descriptor to orderrepository. . The orderrepository.Working With Purchase Process Objects . in the localconfig directory add the following lines to /atg/commerce/order/OrderTools. add the new type to the handlingInstruction item descriptor: <table name="dcspp_hand_inst" type="primary" id-column-name="handling_inst_id"> <property name="type" data-type="enumerated" default="handlingInstruction" expert="true" display-name="Type"> <attribute name="useCodeForValue" value="false"/> <option value="handlingInstruction" code="0"/> <option value="giftlistHandlingInstruction" code="1"/> </property> .GiftwrapHandlingInstruction beanNameToItemDescriptorMap+=mypackage. add the new item descriptor: <item-descriptor name="giftwrapHandlingInstruction" super-type="handlingInstruction" sub-type-value="giftwrapHandlingInstruction" cache-mode="locked" display-name="Gift wrap Handling Instruction"> <attribute name="writeLocksOnly" value="true"/> <table name="dcspp_wrap_inst" id-column-name="handling_inst_id"> <property name="wrappingPaperId" column-name="wrap_id" data-type="string" display-name="Wrapping Paper Id"/> </table> </item-descriptor> Step 4: Create a method that adds the handling instruction to the order in a class that extends the HandlingInstructionManager: 277 10 . First.

pWrappedItem.commerce. The properties files of these state objects configure the following properties. the subclasses of atg. PaymentGroupStates: indicates the states of a PaymentGroup. pGiftShippingGroup.getId().createHandlingInstruction( "giftwrapHandlingInstruction".CommerceItemStates class represents the possible states of a CommerceItem.PaymentGroupStates class represents the possible states of a PaymentGroup. and ATG Commerce code uses the state name to set the state of a given object. you could add a processor to the validateForCheckout pipeline to validate the wrapping paper type.addHandlingInstruction(giftwrap). For example: // set the state of shippingGroup to the integer value of the // PENDING_SHIPMENT state. } Step 5: Add any additional processors.commerce.PENDING_SHIPMENT)). pGiftShippingGroup. the atg.states.commerce. and so on. ShipItemRelationshipStates: indicates the states of a ShippingGroupCommerceItemRelationship. CommerceItem pWrappedItem.getQuantity()). The state names are defined in static String variables in each state class.setWrappingPaperId(wrappingId). CommerceItemStates: indicates the states of a CommerceItem. the atg. giftwrap. For example. ATG Commerce provides the following configured instances of the state classes.String pWrappingPaperId) { GiftwrapHandlingInstruction giftwrap = (GiftwrapHandlingInstruction) handlingInstructionManager. For example. which are located in Nucleus at /atg/commerce/states/: • • • • • OrderStates: indicates the states of an Order. which provide mappings of the order object’s state names to corresponding String values (for easy reading) and integer values (for easy comparisons): 278 10 .Working With Purchase Process Objects .ObjectStates represent the possible states for the order objects.states. ATG Commerce States In ATG Commerce.µ ATG Commerce Programming Guide public wrapCommerceItemInShippingGroup(ShippingGroup pGiftShippingGroup. shippingGroup. sgStates.setState(sgStates.PENDING_SHIPMENT is the // name of the state ShippingGroupStates sgStates = getShippingGroupStates().getId(). pWrappedItem.states.getStateValue(sgStates. ShippingGroupStates: indicates the states of ShippingGroup.

properties). as described below. This is the String value that users see and that is stored in the repository. Given a state’s Integer value or display name. Note: Used for internationalization.Working With Purchase Process Objects . 279 10 . for example. The following table describes these methods: Method name getStateValue Description Given a state name. Note that a state’s name and display name are two different values. and so on) contains several methods for retrieving a requested state’s Integer value. OrderStates. display name. this method returns the display name that is defined in the resource file that is appropriate for the current locale. stateStringMap: maps each state’s Integer value to a display name. OrderStates. as described below. CommereItemStates. Each state class (OrderStates. this method returns its Integer value. Note: Used for internationalization.properties or CommerceItemStates.properties or CommerceItemStates. this method returns the state’s description that is defined in the resource file that is appropriate for the current locale. for example. or description from the state mappings. Given a state’s display name.properties). stateDescriptionMap: maps each state’s Integer value to a String description of the state. getStateFromString getStateString getStateDescription getStateAsUserResource getStateDescriptionAsUserResource Given a state’s Integer value or display name (as configured in the properties file of the relevant states component.ATG Commerce Programming Guide µ • • • stateValueMap: maps each state name to an Integer value. this method returns its Integer value. Given a state’s Integer value or display name (as configured in the properties file of the relevant states component. this method returns its description. Given a state’s Integer value. this method returns its display name.

INITIAL=INITIAL ITEM.PENDING_REMOVE=PENDING_REMOVE • For the descriptions of states: ORDERDESC.getStateAsString to retrieve the display name for the state of the Order object from OrderStates.INITIAL=The shipping group has been initialized SHIPPINGDESC.properties file maps each state’s configured display name to a translated display name and description using the following key-value format: • For the display names of states: ORDER.SUBMITTED=The order has been submitted to Fulfillment SHIPPINGDESC.PENDING_REMOVE=The item is pending remove request Note that the keys are the display names of the states as configured in the properties files of the states components (OrderStates.INITIAL=The item has been initialized ITEMDESC. Similarly.getStateDetail to retrieve the description for the state of the CommerceItem from CommerceItemStates.properties. you can simply call the getState method of that order object. and you. 280 10 . call OrderImpl.SUBMITTED=SUBMITTED SHIPPING. Additionally. therefore. then you should specify those values in ResourceBundle. ATG Commerce provides a base ResourceBundle. for the state of the order object. call CommerceItemImpl. call CommerceItemImpl.properties.INITIAL=INITIAL SHIPPING. need to provide one or more translations of the display names and descriptions for the states of the ATG Commerce order objects. By default.properties.Working With Purchase Process Objects . these methods retrieve a value specified in the properties file of the relevant states component: • getStateAsString For example. getStateDetail For example. Like the getState method. respectively.getState to retrieve the corresponding Integer value for the state of the Order from OrderStates. Similarly. Similarly.INCOMPLETE=INCOMPLETE ORDER. • If your commerce site is internationalized. if your commerce site isn’t internationalized. to retrieve the Integer value for the state of an order object. ShippingStates.getStateDetail to retrieve the description for the state of the Order object from OrderStates. Also note that.INCOMPLETE=The order is incomplete ORDERDESC.getStateAsString to retrieve the display name for the state of the CommerceItem from CommerceItemStates.properties file named StateResources. For example. Consequently. call CommerceItemImpl. call OrderImpl. The StateResources.properties files that are placed in the CLASSPATH.properties. call OrderImpl. which is used when a locale-specific resource file isn’t found during a request.properties.properties.properties.getState to retrieve the corresponding Integer value for the state of the CommerceItem from CommerceItemStates. use the following order object methods to retrieve the display name or description.properties.FAILED=The shipping group has failed ITEMDESC.µ ATG Commerce Programming Guide The methods in the preceding table are called by several methods in the implementation classes of the order objects.properties.PROCESSING=PROCESSING ITEM. and so on).

commerce. You can refer to the subsections that follow for descriptions of these states: • • • • CommerceItem States Order States PaymentGroup States ShippingGroup States 281 10 .getStateDescriptionAsUserResource to retrieve a locale-specific description for the state of the Order object from the appropriate StateResources_XX. which includes resources for some additional Order object states.Working With Purchase Process Objects .StateResources.ATG Commerce Programming Guide µ because different order objects may use the same display name for a given state. it then looks for a StateResources_fr. If that file doesn’t exist. and variant suffixes. place the resource file in the CLASSPATH. To add an additional resource file.resourceFileName. and so on).properties file.properties is located in the CLASSPATH at atg. CommerceItemStates. these methods call through to the methods in the states classes (OrderStates. the appropriate prefix is appended to the key.ObjectStates represent the possible states for the order objects. makes use of StateResources.getStateAsUserResource to retrieve a locale-specific display name for the state of the Order object from the appropriate StateResources_XX. Given the current locale and the basename specified in the resourceFileName property of the states component (OrderStates. each key is prepended with a prefix to avoid conflict.StateResources. country. StateResources.resourceFileName only is set to atg.resourceFileName. CommerceItemStates. However. it retrieves the default resource file. OrderStates. getStateDescriptionAsUserResource For example.properties and rename the file according to Java naming guidelines for ResourceBundle inheritance. If the file doesn’t exist. use the following order object methods to retrieve a locale-specific display name or description.commerce. namely the getStateAsUserResource and getStateDescriptionAsUserResource methods.states. call OrderImpl. For example.) Finally. copy StateResource.resourceFileName. call OrderImpl.properties. therefore. By default. in ATG Commerce the subclasses of atg. As previously mentioned . StateResources.states. and each states component refers to this file in its resourceFileName property (OrderStates. and the requested value is retrieved. and so on).properties. Once the appropriate resource file is obtained.b2bcommerce. respectively. if the locale is fr_FR.states. and so on).properties file. CommerceItemStates. Then translate the file according to the translation guidelines provided in the Internationalizing a Dynamo Web Site chapter in the ATG Programming Guide.properties file.properties resource files. using any appropriate language.properties. these latter methods use ResourceBundle inheritance rules to retrieve the most appropriate resource file for the current locale. the code first looks for a StateResources_fr_FR.properties file. If your commerce site is internationalized and.resourceFileName. for the state of the order object: • getStateAsUserResource For example. (You can refer to that chapter for more information on working with ResourceBundles. • Like the other order object methods. note that in ATG Business Commerce.

The item will be removed pending verification that all item relationships referring to it can be removed. FAILED FAILED_APPROVAL INCOMPLETE 282 10 . it cannot be backordered. The item is available in the inventory. The item isn’t available in the inventory. The order is in the purchase process. The item isn’t available in the inventory. it has been backordered. and the order has been approved. and it is being prepared for shipment to the customer. and it has not been backordered.Working With Purchase Process Objects . The order failed. it has been preordered. The item could not be found in the inventory. ITEM_NOT_FOUND OUT_OF_STOCK PENDING_REMOVE PRE_ORDERED REMOVED SUBITEM_PENDING _DELIVERY Order States The following table describes the possible states of an Order: State Name APPROVED Description (Used in ATG Business Commerce only) The approval process for the order is complete. that is. and the order has been rejected. The item has failed. (Used in ATG Business Commerce only) The approval process for the order is complete. it is not yet associated with any shipping group. The item has been removed from the order. The item isn’t available in the inventory. The item is in an initial state.µ • ATG Commerce Programming Guide ShippingGroupCommerceItemRelationship States CommerceItem States The following table describes the possible states of a CommerceItem: State Name BACK_ORDERED DISCONTINUED FAILED INITIAL Description The item isn’t available in the inventory.

It is placed in the list of states for the convenience of those who might want to implement this state. The payment group has been authorized and can be debited. such as the failure of a payment group in the order. Processing of the order requires merchant attention for some reason. such as an incorrect customer address. The order is placed in this state until all shipping groups in the order are set to a PENDING_REMOVE state. 283 10 .ATG Commerce Programming Guide µ The order has been fulfilled. The order has completed the purchase process and has been submitted to Fulfillment. (Used in ATG Business Commerce only) The order requires approval (or an additional approval) by an authorized approver. Processing of the order requires the customer’s attention for some reason. It is placed in the list of states for the convenience of those who might want to implement this state. Credit of the payment group has failed. The order has been removed successfully. This is an unused state. All shipping groups in the order are in a NO_PENDING_ACTION or REMOVED state. This is an unused state. The order is being processed by Fulfillment. The payment group hasn’t been acted on yet. and processing of the order is complete. The order is a template order used by a scheduled order. A request was made to remove the order.Working With Purchase Process Objects . and order payment has been settled. NO_PENDING_ACTION PENDING_APPROVAL PENDING_CUSTOMER_ACTION PENDING_CUSTOMER_RETURN PENDING_MERCHANT_ACTION PENDING_REMOVE PROCESSING QUOTED REMOVED SUBMITTED TEMPLATE PaymentGroup States The following table describes the possible states of a PaymentGroup: State Name AUTHORIZE_FAILED AUTHORIZED CREDIT_FAILED INITIAL Description Authorization of the payment group has failed.

µ REMOVED SETTLE_FAILED SETTLED ATG Commerce Programming Guide The payment group has been removed. This is used by ATG Commerce to determine which shipping groups are ready to be shipped. Debit of the payment group has failed. it has been backordered. The item isn’t available in the inventory. A request for the removal of the entire order was made. The shipping group has started the fulfillment process. The item relationship failed. An error occurred while trying to process the shipping group. the error requires the merchant’s attention. The shipping group awaits shipment. The shipment of all the items in the shipping group is complete. it cannot be backordered. DISCONTINUED FAILED 284 10 . and the removal of this shipping group is possible. This state occurs when the shipping group containing this relationship has shipped. ShippingGroup States The following table describes the possible states of a ShippingGroup: State Name INITIAL PROCESSING PENDING_REMOVE Description The shipping group is in a pre-fulfillment state. The shipping group has failed to process. The shipping group has been removed.Working With Purchase Process Objects . REMOVED FAILED PENDING_SHIPMENT NO_PENDING_ACTION PENDING_MERCHANT_ACTION ShippingGroupCommerceItemRelationship States The following table describes the possible states of a ShippingGroupCommerceItemRelationship: State Name BACK_ORDERED DELIVERED Description The item isn’t available in the inventory. The item has been delivered. The payment group has been debited successfully.

It is placed in the list of states for the convenience of those who might want to implement this state. The item relationship has been removed. The item isn’t available in the inventory. The item has been allocated in the inventory system and is ready to be delivered. For additional information. it has been preordered. no inherited properties are listed. see the ATG API Reference. and the items have not yet shipped. The following diagram represents the order interface inheritance hierarchy. The item is available in the inventory. for a subinterface. and it is being prepared for shipment to the customer. ITEM_NOT_FOUND OUT_OF_STOCK PENDING_DELIVERY PENDING_REMOVE PENDING_RETURN PENDING_SUBITEM _DELIVERY PRE_ORDERED REMOVED RETURNED Purchase Process Class Diagrams This section contains the following diagrams: • • • Order Interfaces Diagrams Order Classes Diagram Order Containment Diagram Note: Classes provided in only ATG Business Commerce are shaded in light blue. The item isn’t available in the inventory. and it has not been backordered. Refer to the tables that follow for information on the properties of each interface.Working With Purchase Process Objects . A request to remove the shipping group was made. This is an unused state. The item could not be found in the inventory. This is an unused state. Order Interfaces Diagrams The diagrams in this section represent the order interface inheritance hierarchy and the containment interface inheritance hierarchy in ATG Commerce. Note that.ATG Commerce Programming Guide µ INITIAL The order fulfillment framework has not acted on the item relationship. 285 10 . It is placed in the list of states for the convenience of those who might want to implement this state. see the superinterface for these properties.

see the ATG API Reference. 286 10 .Working With Purchase Process Objects .µ id:String Order PaymentGroup ATG Commerce Programming Guide CommerceIdentifier Relationship CostCenter HandlingInstruction Relationship CommerceItem ShippingGroup OrderRelationship B2BCommerceItem B2BShippingGroup CommerceItemRelationship PaymentGroupRelationship ShippingGroupRelationship B2BOrderRelationship CostCenterRelationship B2BShippingGroupRelationship B2BOrder B2BCommerceItemRelationship The following diagram represents the containment interface inheritance hierarchy. For additional information.

B2BCommerceItemRelationship Property b2BCommerceItem Data Type B2BCommerceItem B2BCommerceItemRelationshipContainer 287 10 .ATG Commerce Programming Guide µ ShippingGroupRelationshipContainer CommerceItemContainer ShippingGroupContainer PaymentGroupContainer RelationshipContainer PaymentGroupRelationshipContainer CommerceItemRelationshipContainer OrderRelationshipContainer HandlingInstruction Container Order CommerceItem ShippingGroup PaymentGroup B2BShippingGroup CostCenterContainer CostCenterRelationshipContainer B2BOrderRelationshipContainer B2BCommerceItemRelationshipContainer B2BOrder B2BCommerceItem B2BShippingGroupRelationshipContainer B2BShippingGroup CostCenter B2BCommerceItem All properties are inherited.Working With Purchase Process Objects .

B2BShippingGroupRelationship Property amount Data Type double 288 10 .Working With Purchase Process Objects .µ Property commerceItemRelationshipCount commerceItemRelationships ATG Commerce Programming Guide Data Type int List B2BOrder Property approvalSystemMessages approverIds approverMessages authorizedApproverIds Data Type List List List List B2BOrderRelationship Property amount order Data Type double B2BOrder B2BOrderRelationshipContainer Property orderRelationship orderRelationshipCount Data Type B2BOrderRelationship int B2BShippingGroup All properties are inherited.

ATG Commerce Programming Guide µ B2BShippingGroup shippingGroup B2BShippingGroupRelationshipContainer Property shippingGroupRelationshipCount shippingGroupRelationships Data Type int List CommerceIdentifier Property id Data Type String CommerceItem Property auxiliaryData catalogId catalogKey catalogRefId commerceItemClassType priceInfo quantity returnedQuantity state stateDetail Data Type AuxiliaryData String String String String ItemPriceInfo long long int String CommerceItemContainer 289 10 .Working With Purchase Process Objects .

Working With Purchase Process Objects .µ Property commerceItemCount commerceItems totalCommerceItemCount ATG Commerce Programming Guide Data Type int List long CommerceItemRelationship Property amount commerceItem quantity returnedQuantity state stateDetail Data Type double CommerceItem long long int String CommerceItemRelationshipContainer Property commerceItemRelationshipCount commerceItemRelationships Data Type int List CostCenter Property amount costCenterClassType description identifier Data Type double String String String 290 10 .

Working With Purchase Process Objects .ATG Commerce Programming Guide µ Data Type int List CostCenterContainer Property costCenterCount costCenters CostCenterRelationship Property amount costCenter Data Type double CostCenter CostCenterRelationshipContainer Property costCenterRelationshipCount costCenterRelationships Data Type int List HandlingInstruction Property commerceItemId handlingInstructionClassType handlingMethod quantity shippingGroupId Data Type String String String long String HandlingInstructionContainer 291 10 .

Working With Purchase Process Objects .µ Property handlingInstructionCount handlingInstructions ATG Commerce Programming Guide Data Type int List Order Property agentId changed completedDate completedTime createdByOrderId creationDate creationTime description explicitlySaved lastModifiedDate lastModifiedTime orderClassType originOfOrder priceInfo profileId relatedOrders salesChannel specialInstructions state stateDetail submittedDate submittedTime Data Type String boolean Date long String Date long String boolean Date long String String OrderPriceInfo String List String Map int String Date long 292 10 .

ATG Commerce Programming Guide µ TaxPriceInfo taxPriceInfo transient boolean OrderRelationship Property amount order Data Type double Order OrderRelationshipContainer Property orderRelationship orderRelationshipCount Data Type OrderRelationship int PaymentGroup Property amount amountAuthorized amountCredited amountDebited authorizationStatus creditStatus currencyCode debitStatus paymentGroupClassType paymentMethod requisitionNumber specialInstructions Data Type double double double double List List String List String String String Map 293 10 .Working With Purchase Process Objects .

Working With Purchase Process Objects .µ state stateDetail submittedDate ATG Commerce Programming Guide int String Date PaymentGroupContainer Property paymentGroupCount paymentGroups Data Type int List PaymentGroupRelationship Property amount paymentGroup Data Type double PaymentGroup PaymentGroupRelationshipContainer Property paymentGroupRelationshipCount paymentGroupRelationships Data Type int List Relationship Property relationshipClassType relationshipType Data Type String int RelationshipContainer 294 10 .

Working With Purchase Process Objects .ATG Commerce Programming Guide µ Data Type int List Property relationshipCount relationships ShippingGroup Property actualShipDate description priceInfo shipOnDate shippingGroupClassType shippingMethod specialInstructions state stateDetail submittedDate Data Type Date String ShippingPriceInfo Date String String Map int String Date ShippingGroupContainer Property shippingGroupCount shippingGroups Data Type int List ShippingGroupRelationship Property amount shippingGroup Data Type double ShippingGroup 295 10 .

Note that for a subclass.Working With Purchase Process Objects . see the superclass for these properties. see the ATG API Reference.µ ShippingGroupRelationshipContainer Property shippingGroupRelationshipCount shippingGroupRelationships ATG Commerce Programming Guide Data Type int List Order Classes Diagram The following diagram represents the order class inheritance hierarchy in ATG Commerce. Refer to the tables that follow for information on the properties of each class. 296 10 . For additional information. no inherited properties are listed.

Working With Purchase Process Objects .ATG Commerce Programming Guide µ CommerceIdentifierImpl OrderImpl id:String PaymentGroupImpl B2BOrderImpl CreditCard CreditCardInfo GiftCertificate GiftCertificateInfo CostCenterImpl CommerceItemImpl B2BCommerceItemImpl PaymentGroupOrderRelationship CostCenterOrderRelationship PaymentGroupCommerceItemRelationship CostCenterCommerceItemRelationship CostCenterShippingGroupRelationship PaymentGroupShippingGroupRelationship ShippingGroupCommerceItemRelationship HandlingInstructionImpl ShippingGroupImpl B2BShippingGroupImpl ElectronicShippingGroup B2BElectronicShippingGroup HardgoodShippingGroup B2BHardgoodShippingGroup B2BCommerceItemImpl 297 10 .

µ Property costCenterRelationship costCenterRelationshipCount costCenterRelationships ATG Commerce Programming Guide Data Type CostCenterRelationship int List B2BElectronicShippingGroup Property costCenterRelationship costCenterRelationshipCount costCenterRelationships Data Type CostCenterRelationship int List B2BHardgoodShippingGroup Property costCenterRelationship costCenterRelationshipCount costCenterRelationships Data Type CostCenterRelationship int List B2BOrderImpl Property approvalSystemMessages approverIds approverMessages authorizedApproverIds costCenter costCenterCount costCenterRelationship Data Type List List List List CostCenter int CostCenterRelationship 298 10 .Working With Purchase Process Objects .

Working With Purchase Process Objects .ATG Commerce Programming Guide µ int List List costCenterRelationshipCount costCenterRelationships costCenters B2BShippingGroupImpl Property costCenterRelationship costCenterRelationshipCount costCenterRelationships Data Type CostCenterRelationship int List CommerceItemImpl Property auxiliaryData catalogKey catalogRefId changed changedProperties commerceItemClassType paymentGroupRelationshipCount paymentGroupRelationships priceInfo priceInfoRepositoryItem quantity repositoryItem returnedQuantity saveAllProperties shippingGroupRelationship shippingGroupRelationshipCount Data Type AuxiliaryData String String boolean Set String int List ItemPriceInfo MutableRepositoryItem long MutableRepositoryItem long boolean String int 299 10 .

Working With Purchase Process Objects .µ shippingGroupRelationships state stateAsString stateDetail ATG Commerce Programming Guide List int String String CostCenterCommerceItemRelationship Property amount b2BCommerceItem changed changedProperties commerceItem costCenter propertyValue quantity relationshipClassType relationshipType relationshipTypeAsString repositoryItem returnedQuantity saveAllProperties state stateDetail Data Type double B2BCommerceItem boolean Set CommerceItem CostCenter Object long String int String MutableRepositoryItem long boolean int String CostCenterImpl Property amount changed Data Type double boolean 300 10 .

ATG Commerce Programming Guide µ Set B2BCommerceItemRelationship int List String String String B2BOrderRelationship int Object MutableRepositoryItem boolean B2BShippingGroupRelationship int List changedProperties commerceItemRelationship commerceItemRelationshipCount commerceItemRelationships costCenterClassType description identifier orderRelationship orderRelationshipCount propertyValue repositoryItem saveAllProperties shippingGroupRelationship shippingGroupRelationshipCount shippingGroupRelationships CostCenterOrderRelationship Property amount changed changedProperties costCenter order propertyValue relationshipClassType relationshipType relationshipTypeAsString repositoryItem Data Type double boolean Set CostCenter B2BOrder Object String int String MutableRepositoryItem 301 10 .Working With Purchase Process Objects .

Working With Purchase Process Objects .µ saveAllProperties ATG Commerce Programming Guide boolean CostCenterShippingGroupRelationship Property amount changed changedProperties costCenter propertyValue relationshipClassType relationshipType relationshipTypeAsString repositoryItem saveAllProperties shippingGroup Data Type double boolean Set CostCenter Object String int String MutableRepositoryItem boolean B2BShippingGroup CreditCard and CreditCardInfo Property billingAddress creditCardNumber creditCardType expirationDayOfMonth expirationMonth expirationYear order paymentId Data Type Address String String String String String Order String 302 10 .

Working With Purchase Process Objects .ATG Commerce Programming Guide µ Data Type String ElectronicShippingGroup Property emailAddress GiftCertificate and GiftCertificateInfo Property giftCertificateNumber profileId Data Type String String HandlingInstructionImpl Property changed changedProperties commerceItemId handlingInstructionClassType quantity repositoryItem saveAllProperties shippingGroupId Data Type boolean Set String String long MutableRepositoryItem boolean String HardgoodShippingGroup Property shippingAddress trackingNumber Data Type Address String 303 10 .

Working With Purchase Process Objects .µ OrderImpl Property changed changedProperties commerceItemCount commerceItems commerceItemsByCatalogRefId completedDate completedTime creationDate creationTime description lastModifiedDate lastModifiedTime orderClassType paymentGroupCount paymentGroupRelationshipCount paymentGroupRelationships paymentGroups priceInfo priceInfoRepositoryItem profileId relationshipCount relationships repositoryItem saveAllProperties shippingGroupCount shippingGroups specialInstructions ATG Commerce Programming Guide Data Type boolean Set int List List Date long Date long String Date long String int int List List OrderPriceInfo MutableRepositoryItem String int List MutableRepositoryItem boolean int List Map 304 10 .

ATG Commerce Programming Guide µ int String String Date long TaxPriceInfo MutableRepositoryItem long boolean state stateAsString stateDetail submittedDate submittedTime taxPriceInfo taxPriceInfoRepositoryItem totalCommerceItemCount transient PaymentGroupCommerceItemRelationship Property amount changed changedProperties commerceItem paymentGroup quantity relationshipClassType relationshipType relationshipTypeAsString repositoryItem returnedQuantity saveAllProperties state stateDetail Data Type double boolean Set CommerceItem PaymentGroup long String int String MutableRepositoryItem long boolean int String PaymentGroupImpl 305 10 .Working With Purchase Process Objects .

µ Property amount amountCredited amountDebited authorizationStatus changed changedProperties commerceItemRelationshipCount commerceItemRelationships creditStatus currencyCode debitStatus orderRelationship orderRelationshipCount paymentGroupClassType paymentMethod repositoryItem saveAllProperties shippingGroupRelationshipCount shippingGroupRelationships specialInstructions state stateAsString stateDetail submittedDate ATG Commerce Programming Guide Data Type double double double List boolean Set int List List String List OrderRelationship int String String MutableRepositoryItem boolean int List Map int String String java.Date PaymentGroupOrderRelationship 306 10 .util.Working With Purchase Process Objects .

Working With Purchase Process Objects .ATG Commerce Programming Guide µ Data Type double boolean Set Order PaymentGroup String int String MutableRepositoryItem boolean Property amount changed changedProperties order paymentGroup relationshipClassType relationshipType relationshipTypeAsString repositoryItem saveAllProperties PaymentGroupShippingGroupRelationship Property amount changed changedProperties paymentGroup relationshipClassType relationshipType relationshipTypeAsString repositoryItem saveAllProperties shippingGroup Data Type double boolean Set PaymentGroup String int String MutableRepositoryItem boolean ShippingGroup ShippingGroupCommerceItemRelationship Property amount Data Type double 307 10 .

µ changed changedProperties commerceItem percentage quantity relationshipClassType relationshipType relationshipTypeAsString repositoryItem returnedQuantity saveAllProperties shippingGroup state stateAsString stateDetail ATG Commerce Programming Guide boolean Set CommerceItem double long String int String MutableRepositoryItem long boolean ShippingGroup int String String ShippingGroupImpl Property actualShipDate changed changedProperties commerceItemRelationshipCount commerceItemRelationships description handlingInstructionCount handlingInstructions paymentGroupRelationshipCount paymentGroupRelationships Data Type Date boolean Set int List String int List int List 308 10 .Working With Purchase Process Objects .

Note that. 309 10 . see the ATG API Reference. Because some classes are used as member variables by more than one class. Refer to the tables that follow for information on the properties of each class. For additional information.ATG Commerce Programming Guide µ ShippingPriceInfo MutableRepositoryItem MutableRepositoryItem boolean Date String String Map int String String Date priceInfo priceInfoRepositoryItem repositoryItem saveAllProperties shipOnDate shippingGroupClassType shippingMethod specialInstructions state stateAsString stateDetail submittedDate Order Containment Diagram The following diagram represents the object containment model in ATG Commerce.Working With Purchase Process Objects . Arrows indicate that the class being pointed to contains the pointing class as a member variable. they appear on the diagram more than once. for a subclass. see the superclass for these properties. no inherited properties are listed.

PaymentGroupRelationshipContainerImpl HandlingInstructionContainerImpl CommerceItemRelationshipContainerImpl CommerceItemRelationshipContainerImpl OrderImpl B2BOrderImpl For details on B2BOrderImpl. see the Order Classes diagram in the previous section.µ CommerceIdentifierImpl OrderImpl For details on OrderImpl. see the Order Classes diagram in the previous section. CommerceItemRelationshipContainerImpl ShippingGroupRelationshipContainerImpl CostCenterRelationshipContainer CommerceItemContainerImpl 310 10 . PaymentGroupRelationshipContainerImpl OrderRelationshipContainerImpl CommerceIdentifierImpl ShippingGroupImpl For details on ShippingGroupImpl. PaymentGroupRelationshipContainerImpl CostCenterContainerImpl CommerceIdentifierImpl CostCenterImpl For details on CostCenterImpl. see the Order Classes digram in the previous section.Working With Purchase Process Objects . CommerceItemContainerImpl ATG Commerce Programming Guide CommerceIdentifierImpl CommerceItemImpl For details on CommerceItemImpl. CostCenterRelationshipContainerImpl OrderRelationshipContainerImpl CommerceItemImpl B2BcommerceItemImpl For details on B2BcommerceItemImpl. PaymentGroupRelationshipContainerImpl PaymentGroupContainerImpl ShippingGroupRelationshipContainerImpl ShippingGroupContainerImpl RelationshipContainerImpl CommerceIdentifierImpl PaymentGroupImpl For details on PaymentGroupImpl. see the Order Classes diagram in the previous section. see the Order Classes diagram in the previous section. see the Order classes diagram in the previous section. see the Order Classes diagram in the previous section.

ATG Commerce Programming Guide µ Data Type int List long Property commerceItemCount commerceItems totalCommerceItemCount CommerceItemRelationshipContainerImpl Property commerceItemRelationshipCount commerceItemRelationships Data Type int List CostCenterContainerImpl Property costCenterCount costCenters Data Type int List CostCenterRelationshipContainerImpl Property costCenterRelationshipCount costCenterRelationships Data Type int List HandlingInstructionContainerImpl Property handlingInstruction handlingInstructionCount handlingInstructions Data Type HandlingInstruction int List 311 10 .Working With Purchase Process Objects .

µ OrderRelationshipContainerImpl Property orderRelationship orderRelationshipCount ATG Commerce Programming Guide Data Type OrderRelationship int PaymentGroupContainerImpl Property paymentGroupCount paymentGroups Data Type int List PaymentGroupRelationshipContainerImpl Property paymentGroupRelationshipCount paymentGroupRelationships Data Type int List RelationshipContainerImpl Property relationshipCount relationships Data Type int List ShippingGroupContainerImpl Property shippingGroupCount shippingGroups Data Type int List 312 10 .Working With Purchase Process Objects .

Working With Purchase Process Objects .ATG Commerce Programming Guide µ Data Type int List ShippingGroupRelationshipContainerImpl Property shippingGroupRelationshipCount shippingGroupRelationships 313 10 .

Working With Purchase Process Objects .µ ATG Commerce Programming Guide 314 10 .

Scheduling Recurring Orders Describes how to create recurring Orders that automatically submit themselves on a schedule. 315 11 . and shipping locations. You can use ATG Commerce to customize and implement a purchase process that fills all the requirements of your site. Processing Payment of Orders Describes how payment of Orders is processed. Includes information on adding items to an Order. Also describes how to extend the system to support new payment operations and payment methods. payment methods. and enable customers to purchase products using a single payment method and to ship those products to a single location. Repricing Orders Describes how to reprice and update an Order using the RepriceOrderDroplet servlet bean. In contrast. This chapter includes information on the following purchase process services: Loading Orders Describes the process involved in loading an Order from the Order Repository. Modifying Orders Describes how to modify an Order using the catalogRefId of a CommerceItem or the ID of a ShippingGroupCommerceItemRelationship. submitting the Order for checkout. a more complex purchase process might include multiple shopping carts. whether simple or complex. removing items from an Order.Configuring Purchase Process Services . Canceling Orders Describes the process involved in deleting an Order from the user’s shopping cart. A simple purchase process might provide customers with a single shopping cart. Saving Orders Describes the process involved in saving an Order to the Order Repository.ATG Commerce Programming Guide µ 11 Configuring Purchase Process Services ATG Commerce enables you to build sites that support simple or complex purchasing processes. Includes information on how the purchase process manages refreshing Orders. and actually checking out the Order. Checking Out Orders Describes the process involved in preparing a simple or complex Order for checkout. and modifying item quantities in an Order.

µ ATG Commerce Programming Guide Setting Restrictions on Orders Describes how to set restrictions on placing Orders. For detailed information on the various classes and interfaces used in the ATG Commerce purchase process. none of the contained objects. Working with ATG Commerce Form Handlers Describes how the ATG Commerce form handlers manage transactions. are loaded. Handling Returned Items Describes how the purchase process handles returned items. Troubleshooting Order Problems Provides important information if you have modified the OrderManager and are now experiencing problems with orders. which creates and populates the Order object. See Refreshing Orders below for details. 316 11 . this processor creates an Order object and loads its properties from the Order Repository.Configuring Purchase Process Services . Loading Orders The actual loading of an Order object occurs by calling the loadOrder() method in the OrderManager. PipelineLink name loadOrderObject Description Given an Order ID supplied by the PipelineManager.commerce.processor. when an Order property is accessed (for example. Note that while the Order object is loaded. They are listed in order of execution. such as the CommerceItems or ShippingGroups.ProcLoadOrderObject class implements this functionality. see the Working With Purchase Process Objects chapter. the rest of the objects in the Order are loaded. The atg.order. Also provides information to assist you when extending them. The loadOrder() method calls into the PipelineManager to execute the loadOrder pipeline. Tracking the Shopping Process Describes how to track stages an Order goes through in the purchase process. by calling a method like getCommerceItems() or getShippingGroups() in the Order). Later. The following table describes the individual processors in the loadOrder pipeline.

317 11 .order. See Refreshing Orders below for details. The following table describes the individual processors in the refreshOrder pipeline. For more information about the OrderManager.commerce. Note that only the OrderPriceInfo and TaxPriceInfo objects are loaded at this point.) Later. which creates and loads the rest of the contained objects in the Order.Configuring Purchase Process Services .ATG Commerce Programming Guide µ loadPriceInfoObjects Creates OrderPriceInfo and TaxPriceInfo objects for the given Order and loads their properties from the Order Repository. the purchase process controls the refreshing of Orders. see the Using and Extending Pricing Services chapter.order. see the Commerce Processor Chains section. needs to be reloaded from the Order Repository. They are listed in order of execution. which creates and loads the Order object. the PipelineManager. the loadOrder() method in the OrderManager calls into the PipelineManager to execute the loadOrder pipeline.processor.processor. when an Order property is accessed (for example. as well as its OrderPriceInfo and TaxPriceInfo objects. therefore. the rest of the AmountInfo objects in the Order are loaded. by calling getPriceInfo() or getCommerceItems() in the Order). For more information about pipelines.ProcLoadPriceInfoObjects class implements this functionality.commerce. PipelineLink name loadOrderObjectForRefresh Description Given an Order object supplied by the PipelineManager. and the transactional modes and transitions of the processors in the loadOrder pipeline. by calling getCommerceItems() or getPriceInfo()). Refreshing Orders In ATG Commerce.ProcLoadOrderObj ect class implements this functionality. when an Order property is accessed (for example. such as the ItemPriceInfo objects in the CommerceItems and the ShippingPriceInfo objects in the ShippingGroups. The atg. The refreshOrder pipeline is called only when the Order is first accessed and subsequently when an Order is invalidated and. see the Working With Purchase Process Objects chapter. this processor reloads its properties from the Order Repository. (See Loading Orders above for details. For more information about PriceInfo objects. When an Order is loaded from the Order Repository. Later. the refreshOrder pipeline is invoked. The atg.

processor. The atg.processor.commerce.Configuring Purchase Process Services .ProcLoadPaymentG roupObjects class implements this functionality. loadPriceInfoObjects Reloads the OrderPriceInfo and TaxPriceInfo objects in the given Order.commerce.order.processor.order. The atg. The atg.processor. loadRelationshipObjects Creates Relationship objects for the Order and loads the properties for those Relationship objects from the Order Repository. Creates ShippingGroup objects for the Order and loads the properties for those ShippingGroup objects from the Order Repository. The atg. and loads their properties from the Order Repository.commerce.ProcLoadCommerce ItemObjects class implements this functionality.commerce. loadHandlingInstructionObjects Creates HandlingInstruction objects for the ShippingGroups in the Order and loads the properties for those HandlingInstruction objects from the Order Repository.ProcLoadRelation shipObjects class implements this functionality.order.order. The atg.µ loadCommerceItemObjects loadShippingGroupObjects ATG Commerce Programming Guide Creates CommerceItem objects for the Order and loads the properties for those CommerceItem objects from the Order Repository. loadPaymentStatusObjects Creates PaymentStatus objects for all the payment groups in the Order and loads the properties for those PaymentStatus objects from the Order Repository.ProcLoadPriceInf oObjects class implements this functionality.ProcLoadHandling InstructionObjects class implements this functionality. The atg.commerce.ProcLoadShipping GroupObjects class implements this functionality.processor.commerce.order. For more information about AmountInfo objects. Also creates the rest of the AmountInfo objects for the Order.order.processor. 318 11 . see the Using and Extending Pricing Services chapter. loadPaymentGroupObjects Creates PaymentGroup objects for the Order and loads the properties for those PaymentGroup objects from the Order Repository. such as the ItemPriceInfo objects in the CommerceItems and the ShippingPriceInfo objects in the ShippingGroups. The atg.commerce.processor.order.ProcLoadPaymentS tatusObjects class implements this functionality.

commerce.commerce.order. If the state of the Order is one that is defined in RemoveExpiredCommerceItems. removeExpiredCommerceItems Used in conjunction with SetCatalogRefs and SetProductRefs. see Managing Orders that Contain Deleted Products and SKUs below. Note that. The atg. The atg. 319 11 .substituteDeletedSkuId.removeItemsWithDel etedProducts is set to true. if SetCatalogRefs.openOrderStates.commerce. this processor replaces all deleted SKUs in the Order with the “dummy” SKU defined by SetCatalogRefs. For more information.processor.ProcRemoveExpire dCommerceItems class implements this functionality. For more information. A “dummy” product is removed only if RemoveExpiredCommerceItems. see Managing Orders that Contain Deleted Products and SKUs below.substituteRemovedProduct is true. This processor looks up the catalog reference in the Catalog Repository using the productRefId in the AuxiliaryData object. A “dummy” SKU is automatically removed.order.processor.substituteDeletedProductId.Configuring Purchase Process Services .ProcSetProductRe fs class implements this functionality. Note that.substituteRemovedSku is true.processor. see Managing Orders that Contain Deleted Products and SKUs below. this processor removes from the Order any CommerceItem that contains a “dummy” SKU or product that was substituted by SetCatalogRefs or SetProductRefs.ATG Commerce Programming Guide µ Sets the catalogRef property in the AuxiliaryData object of each CommerceItem in the Order. setCatalogRefs setProductRefs Sets the productRef property in the AuxiliaryData object of each CommerceItem in the Order. the default is true.order. if SetProductRefs. this processor replaces all deleted products in the Order with the “dummy” product defined by SetProductRefs. This processor looks up the catalog reference in the Catalog Repository using the catalogRefId in the CommerceItem. For more information. The atg.ProcSetCatalogRe fs class implements this functionality.

Refreshing Orders. see the Commerce Processor Chains section. 3. In an Order. See RemoveExpiredCommerceItems in the table above for more information. 4. this “dummy” product will be substituted for any product that has been deleted from the catalog. If your catalog administrators delete products and/or SKUs in the ongoing management of the product catalog. set its removeItemsWithDeletedProducts property to true.) 4. 320 11 . Note: If you’re running the Customer Service Module.µ ATG Commerce Programming Guide For more information about pipelines.substituteRemovedProduct property to true. all dummy SKUs in the Order are removed automatically by a later processor in the refreshOrder pipeline. In an Order. do the following: 1.substituteRemovedSku property to true. make sure to add a “dummy” product to all existing catalogs. this is particularly important because the Customer Service Module cannot display orders that contain deleted products or SKUs. If the Order is in an open state. 3. To configure the refreshOrder pipeline to manage deleted SKUs. Set the SetCatalogRefs. this “dummy” SKU will be substituted for any SKU that has been deleted from the catalog. Set the SetCatalogRefs. RemoveExpiredCommerceItems. the PipelineManager. the processor replaces any deleted SKU found in the Order with the SKU defined in the substituteDeletedSkuId property. Set the SetCatalogRefs. Managing Orders that Contain Deleted Products and SKUs As described in the previous section. To configure the refreshOrder pipeline to manage deleted products. If you’re using custom catalogs.Configuring Purchase Process Services .substituteDeletedProductId property to the ID of the dummy product you created in step 1. Create a new product in the product catalog. (See RemoveExpiredCommerceItems in the table above for more information. make sure to add a “dummy” SKU to all existing catalogs. 5. and the transactional modes and transitions of the processors in the refreshOrder pipeline. Note: If you’re using custom catalogs. 2. 2.substituteDeletedSkuId property to the ID of the dummy SKU you created in step 1. Create a new SKU in the product catalog. If this property is true. the last three processors in the refreshOrder pipeline can be used to operate on the commerce items in an order that refer to products and/or SKUs that have been deleted from the catalog. Set the SetProductRefs. If this property is true. do the following: 1. If you want all dummy products in an Order (in an open state) to be removed later on in the refreshOrder pipeline by the RemoveExpiredCommerceItems processor. the processor replaces any deleted product found in the Order with the product defined in the substituteDeletedProductId property. you should configure these processors to handle affected orders appropriately.

If you need to remove products and SKUs from your database (for example.CartModifierFormHandler. Removing all historical orders that contain products or SKUs that have been removed. modify the quantity of items in the Order. Modifying Orders You can modify an Order by adding items to it. and changing the quantities of the items in the Order. such as the form handlers that create and manage 321 11 .order. you should implement a strategy that addresses its impact on order histories. the handleAddXXX and handleRemoveXXX methods of CartModifierFormHandler automatically reprice the Order whenever the user makes changes to it. CartModifierFormHandler is provided to support these modification processes. you should note that users can also make changes to their orders through other purchase process form handlers that do not reprice orders. order histories cannot be rendered accurately. because of a high turnover rate). removing items from it. Possible strategies include: • • • Storing the relevant description information in the CommerceItem. Keeping all historical orders that contain products or SKUs that have been removed.updateOrder() to save the Order in its present state to the Order Repository. Many of the methods (described below) in CartModifierFormHandler call OrderManager.Configuring Purchase Process Services . These orders will display description information for the “dummy” SKUs and products instead of for the actual items that were purchased. This section includes information about the following: • • Understanding the CartModifierFormHandler Modifying the Current Order Understanding the CartModifierFormHandler The CartModifierFormHandler is used to add items to and remove items from an Order. Site pages that render order histories typically draw order information (descriptions.commerce. and prepare the Order for the checkout process. CartModifierFormHandler is an instance of class atg. Note that this will cause a significant duplication of information across multiple items. it is located in Nucleus at /atg/commerce/order/purchase/CartModifierFormHandler. The following sections describes the important methods in CartModifierFormHandler. If those items are deleted.updateOrder() and the updateOrder pipeline that it executes.ATG Commerce Programming Guide µ It’s important to note that deleting products and SKUs is not recommended because of its impact on customers’ order histories.purchase. see the Updating an Order with the Order Manager subsection of Saving Orders in this chapter. As can be seen from the method descriptions that follow. media. and so on) from product and SKU repository items. However. For information on OrderManager.

See the modifyOrderByRelationshipId() and runProcessSetOrder() methods for more information. In these situations. it also verifies that the Order is ready for checkout. which executes the pipeline set in CartModifierFormHandler. getCatalogKey Retrieves a string that identifies the catalog to use when obtaining a catalogRef and productRef for the creation of a CommerceItem. you should use the RepriceOrderDroplet servlet bean to reprice the Order before displaying its price to the user. Finally.Configuring Purchase Process Services . It then calls runProcessSetOrder(). it calls OrderManager. It calls modifyOrderByRelationshipId() to validate the user’s changes and modify the Order. the key is the user’s locale and the value is the corresponding repository to use (for example. which actually adds the items to the Order. The handle method calls modifyOrder() to validate the user’s changes and modify the Order. and where the form handler used to process those changes does not reprice the Order.updateOrder(). see Repricing Orders section of the ATG Commerce Guide to Setting Up a Store. For more information on RepriceOrderDroplet. The string is determined by the user’s locale.setOrderChainId.updateOrder(). where the user can change the current Order in ways that affect its price. Unlike handleSetOrder() and handleSetOrderByRelationshipId().µ getQuantity ATG Commerce Programming Guide shipping groups. handleSetOrderByRelationshipId Performs the actual work necessary to save an Order. en_US=ProductCatalog. Finally.updateOrder(). See the modifyOrder() and runProcessSetOrder() methods for more information.setOrderChainId. It then calls runProcessSetOrder(). Retrieves the quantity for the given item. It calls modifyOrder() to validate the user’s changes and modify the Order. which is obtained from the Request object. handleMoveToPurchaseInfo Performs the actual work necessary to save an Order. it calls OrderManager. /atg/commerce/catalog/CatalogTools maintains the key-to-catalog mapping. fr_FR=FrenchCatalog). which executes the pipeline set in 322 11 . handleSetOrder Performs the actual work necessary to save an Order. handleAddItemToOrder Adds items to an order by calling addItemToOrder(). getShippingGroupCommerceItemRelationships Retrieves the list of ShippingGroupCommerceItemRelationships within the order. Consequently. which executes the pipeline set in CartModifierFormHandler. It then calls OrderManager. See the addItemToOrder() method for more information. It then calls runProcessMoveToPurchaseInfo().

mergeItemInputForAdd Invoked by addItemToOrder() to unify the way input values are made available to doAddItemToOrder() and to validate input values.getItems().getCatalogRefIds(). which executes the pipeline set in CartModifierFormHandler. and giftlistItemId.moveToPurchaseInfoChainId.moveToPurchaseInfoChainId.getCommerceItemType() to every items array element whose commerceItemType subproperty was null. If the returned value is null.getItems() call retrieves a non-null value. handleMoveToPurchaseInfoByRelId Performs the actual work necessary to save an Order. it calls OrderManager. value. Then the method copies the values returned by the following CartModifierFormHandler.mergeValueDictionaries() to combine the Dictionary returned by CartModifierFormHandler. The method copies the values from getCatalogRefIds() into the items array elements. The method calls mergeItemInputForAdd(). it also verifies that the Order is ready for checkout. Unlike handleSetOrder() and handleSetOrderByRelationshipId(). it calls OrderManager.getXXX methods into the items array elements: quantity. The method also calls CartModifierFormHandler. If the initial CartModifierFormHandler. productId or productIds. commerceItemType. The method retrieves the list of items to add by calling CartModifierFormHandler.Configuring Purchase Process Services . See the modifyOrder() and runProcessMoveToPurchaseInfo() methods for more information.ATG Commerce Programming Guide µ CartModifierFormHandler. doAddItemToOrder Invoked by addItemToOrder().getValueDictionary() with each items array element’s value Dictionary.getItems(). See the mergeItemInputForAdd() and doAddItemToOrder() methods for more information. Then. If all input values are valid. the method copies the value returned by CartModifierFormHandler. the method constructs an items array whose size matches the size of the return value from CartModifierFormHandler. See the modifyOrderByRelationshipId() and runProcessMoveToPurchaseInfo() methods for more information. Finally. The handle method calls modifyOrderByRelationshipId() to validate the user’s changes and modify the Order. The method first calls CartModifierFormHandler. giftlistId. It then calls runProcessMoveToPurchaseInfo(). Finally. the method then calls doAddItemToOrder().getCatalogKey() to determine which catalog to use. the method uses the PurchaseProcessHelper class to do the following: 323 11 . for each item to add to the Order. addItemToOrder Invoked by handleAddItemToOrder().updateOrder(). and calls CartModifierFormHandler.updateOrder().

set the addItemToDefaultShippingGroup property of the /atg/commerce/order/purchase/PurchaseProcessHelper component to false. This property is set to true by default. see Relationship Types in the Using Relationship Objects section of the Working With Purchase Process Objects chapter.repriceOrderChainId. which calls CommerceItemManager. For information on the SHIPPINGQUANTITY type of ShippingGroupCommerceItemRelationship. which is an empty method that can be overridden as needed by sites that use configurable commerce items.addGiftToOrder() to perform additional gift list processing.addItemToOrderChainId. After the above steps have been taken for all the new items. Calls processGiftAddition(). To use this behavior. and the default is always the correct type).addItemToShippingGroup(). Use the first shipping group of the passed-in type (if that information is available) or the first shipping group on the order. processGiftAddition() calls GiftListManager. PurchaseProcessHelper can determine the correct group from the item type (based on the SKU’s fulfiller property value) and gift information. regardless of the item type. ATG Commerce Programming Guide Creates a CommerceItem using the commerceItemType.addItemQuantityToShippingGroup() which in turn takes the given quantity of the CommerceItem and the given ShippingGroup and creates a ShippingGroupCommerceItemRelationship of type SHIPPINGQUANTITY. shippingGroupType. • • Calls createConfigurableSubitems(). set the addItemToDefaultShippingGroup property of the /atg/commerce/order/purchase/PurchaseProcessHelper component to true. 324 11 . which executes the pipeline set in CartModifierFormHandler. The passed-in type is used along with the item’s gift information (if any) to determine the correct shipping group to which the item should be added. the item’s input giftlistId or giftlistItemId property is nonnull). for each new item addItemToOrder() calls runProcessAddItemToOrder(). addItemToOrder() calls runProcessRepriceOrder(). catalogRefId. the method fires a scenario event of type ItemAddedToOrder for each new item. If this is the desired behavior (perhaps you only sell goods with one shipping group type. which reprices the Order by executing the pipeline set in CartModifierFormHandler. The type can be determined in one of three ways.getItems()[ ]. If the item is a gift. which checks if the item that was added to the order is a gift (that is.getShippingGroupForItem() method to get a shipping group of the appropriate type. productId and quantity found in the current array element from getItems().Configuring Purchase Process Services . Finally. Adds the created CommerceItem to the order. • Calls PurchaseProcessHelper. Copies custom values from the current item’s value Dictionary to the new Calls the PurchaseProcessHelper.µ • • • • CommerceItem. Then. Passed in to PurchaseProcessHelper from the CartModifierFormHandler.

If it is not. the method retrieves the current quantity of the ShippingGroupCommerceItemRelationship by calling getQuantity() and passing in the ShippingGroupCommerceItemRelationship ID. Then. • For more information on the SHIPPINGQUANTITY type of ShippingGroupCommerceItemRelationship. For each CommerceItem. then the quantity of the current item is set to zero. Next. Then. see Relationship Types in the Using Relationship Objects section of the Working With Purchase Process Objects chapter. then it removes the CommerceItem and any associated Relationship objects from the Order. the method checks if the ID of the ShippingGroupCommerceItemRelationship is in the removalRelationshipIds list. 325 11 . It iterates over each CommerceItem in the Order. The modifyOrder() method modifies the Order based on the changes made in the request. modifyOrderByRelationshipId Invoked by handleSetOrderByRelationshipId() and handleMoveToPurchaseInfoByRelId(). The modifyOrderByRelationshipId() method updates the Order based on the changes made in the request and the existing ShippingGroupCommerceItemRelationships in the Order. then the quantity of the current ShippingGroupCommerceItemRelationship is set to zero.ATG Commerce Programming Guide µ See the runProcessRepriceOrder() and runProcessAddItemToOrder() methods for more information. Next. then an exception is thrown. Then. the method sets the quantity in the CommerceItem and the corresponding ShippingGroupCommerceItemRelationship. it retrieves the current quantity by calling getQuantity() and passing in the catalogRefId (SKU ID) of the item. If it is. If the quantity is less than or equal to zero. If the quantity is less than or equal to zero.Configuring Purchase Process Services . then the quantity of the ShippingGroupCommerceItemRelationship and the quantity of the associated CommerceItem are adjusted appropriately. it first checks to make sure the Relationship is of type SHIPPINGQUANTITY. the quantity of the current item is assessed and one of two actions occurs: • • If the quantity is greater than zero. modifyOrder Invoked by handleSetOrder() and handleMoveToPurchaseInfo(). then the ShippingGroupCommerceItemRelationship is removed from the Order and the quantity of the associated CommerceItem is adjusted appropriately. It iterates over each ShippingGroupCommerceItemRelationship in the Order. the quantity of the current ShippingGroupCommerceItemRelationship is assessed and one of two actions occurs: • If the quantity is greater than zero. the method checks if the catalogRefId of the current item is in the removalCatalogRefIds list. If it is. For each ShippingCommerceItemRelationship.

The method then calls runProcessRepriceOrder(). Finally. Next. the method fires a scenario event of type ItemRemovedFromOrder.) If the quantity in the ShippingGroupCommerceItemRelationship is less than the quantity in the CommerceItem.repriceOrderChainId. and then it removes the HandlingInstructions associated with the ShippingGroup. deleteItemsByRelationshipId This method deletes CommerceItems from the Order by ShippingGroupCommerceItemRelationship ID. 326 11 . which reprices the Order by executing the pipeline set in CartModifierFormHandler. this property is set to addItemToOrder.Configuring Purchase Process Services . one of two conditions can exist: • If the quantity in the ShippingGroupCommerceItemRelationship is greater than or equal to the quantity in the CommerceItem. deleteItems Deletes from the Order all CommerceItems whose IDs are in the removalCommerceIds property. then the quantity in the CommerceItem is reduced and the given ShippingGroupCommerceItemRelationship removed. The method also removes all associated ShippingGroupCommerceItemRelationships and calls runProcessRepriceOrder(). the method fires a scenario event of type ItemRemovedFromOrder. It iterates through the IDs in the removalShippingGroupCommerceItemRelIds property. it first ensures that the Relationship type is of type SHIPPINGQUANTITY (logging an error if it is not). • runProcessAddItemToOrder Invoked by the handleAddItemToOrder() method. which reprices the Order by executing the pipeline set in CartModifierFormHandler. For each ID.updateOrder(). This method runs the pipeline set in CartModifierFormHandler.updateOrder(). See the deleteItems() method for more information. (See the runProcessRepriceOrder() method in this table for more information. By default.repriceOrderChainId. Finally.µ handleRemoveItemFromOrder ATG Commerce Programming Guide Removes items from the Order by CommerceItem ID.addItemToOrderChainId. This handle method calls deleteItemsByRelationshipId() to delete the items from the Order and then calls OrderManager. This handle method calls deleteItems() to delete the items from the Order and then calls OrderManager. then the CommerceItem and all associated Relationships are removed from the Order. See the deleteItemsByRelationshipId() method for more information. but the CommerceItem has Relationships to other ShippingGroups. handleRemoveItemFromOrderByRelationshipId Removes items from the Order by ShippingGroupCommerceItemRelationship ID. See the runProcessRepriceOrder() method for more information.

the addItemToOrder pipeline is commented out of commercepipeline. executes the validateForCheckout pipeline. For more information on both pipelines. This method runs the pipeline set in CartModifierFormHandler.repriceOrderChainId.setOrderChainId. By default.ATG Commerce Programming Guide µ Note: By default. It is recommended that you modify an Order by ShippingGroupCommerceItemRelationship ID. should you need to include additional functionality. such as scenario events. you must supply either a CatalogRefId of a CommerceItem or a ShippingGroupCommerceItemRelationship ID. this method executes an ORDER_TOTAL pricing operation. this property is set to moveToPurchaseInfo. the commerce pipeline configuration file. Note: By default. which verifies that the Order is ready for checkout. The moveToPurchaseInfo pipeline. this property is set to repriceOrder. The pipeline to run is set in CartModifierFormHandler. the setOrder pipeline is commented out of commercepipeline. should you need to include additional functionality. This method runs the pipeline set in CartModifierFormHandler. It is provided for extension purposes.) runProcessMoveToPurchaseInfo Invoked by handleMoveToPurchaseInfo() and handleMoveToPurchaseInfoByRelId(). By default. in turn. especially if you intend to support complex productSKU relationships. such as scenario events. see the Commerce Processor Chains section. By default. to remove the items being shipped to the work address. a customer could order 5 of a given item and choose to ship a quantity of 3 to a home address and the remaining 2 to a work address. The following subsections describes both order modification methods: • • Modifying an Order by catalogRefId Modifying an Order by ShippingGroupCommerceItemRelationship ID 327 11 .moveToPurchaseInfoChainId. see the Repricing Shopping Carts section of the ATG Commerce Guide to Setting Up a Store. (For more information about pricing operations. In this example. runProcessRepriceOrder Runs the pipeline to execute whenever the order needs to be repriced.xml. the commerce pipeline configuration file. By default. runProcessSetOrder Invoked by handleSetOrder() and handleSetOrderByRelationshipId(). such as multiple CommerceItems with the same catalogRefId (SKU ID) or multiple shipping groups. For example.xml.Configuring Purchase Process Services . It is provided for extension purposes. you would modify (and ultimately remove) the ShippingGroupCommerceItemRelationship instead of modifying the CommerceItem. Modifying the Current Order To modify an Order. this property is set to setOrder.

then it is recommended that you modify an Order using the IDs of the ShippingGroupCommerceItemRelationship objects in the Order. multiple CommerceItems with the same catalogRefId) or multiple shipping groups. Populate the form handler’s removalCatalogRefIds array with the catalogRefIds of the CommerceItems to be removed.µ Modifying an Order by catalogRefId ATG Commerce Programming Guide Modifying orders by catalogRefId works for very simple sites.quantity"/>' type="text" name='<dsp:valueof param="CommerceItem. This is illustrated in the following JSP code: <dsp:input value='<dsp:valueof param="CommerceItem.handleSetOrder() method for each CommerceItem whose quantity you want to change and pass in the catalogRefId and quantity for the CommerceItem.catalogRefId" type="checkbox"/> Modifying an Order by ShippingGroupCommerceItemRelationship ID If your site supports complex product-SKU relationships (for example. then the CommerceItem is removed from the Order. it is not recommended for sites with complex features.catalogRefId"/>'> Note that if no quantity is found for a CommerceItem. Doing so makes the changes at the CommerceItem-to-ShippingGroup level. call the CartModifierFormHandler. For example. you can populate the array using following JSP code: <dsp:input bean="CartModifierFormHandler. Because it does not provide the granularity necessary to delete just a part of a CommerceItem.Configuring Purchase Process Services . You can use the following CartModifierFormHandler methods to modify an Order by ShippingGroupCommerceItemRelationship ID: • • • handleSetOrderByRelationshipId() handleRemoveItemFromOrderByRelationshipId() handleMoveToPurchaseInfoByRelId() 328 11 . You can use the following CartModifierFormHandler methods to modify an Order by catalogRefId: • • • handleSetOrder() handleRemoveItemFromOrder() handleMoveToPurchaseInfo() Refer to Understanding the CartModifierFormHandler for more information on these handle methods. such as multiple CommerceItems with the same catalogRefId or multiple shipping groups. To change the quantities of items in an Order using the catalogRefIds of CommerceItems. To remove items from an Order using the catalogRefIds of CommerceItems. edit the JSPs that invoke the CartModifierFormHandler handle methods that delete items from the Order.removalCatalogRefIds" paramvalue="CommerceItem.

by making shipping changes via the form handlers that create and manage shipping groups).purchase. which manages and expedites the pre-checkout processing of orders. execution of a repricing pipeline requires the Order. such as the delivery of a promotion via a scenario. If your site has any pages where you need to reprice an Order.updateOrder(). ExpressCheckoutFormHandler.quantity"/>' type="text" name='<dsp:valueof param="SgCiRelationship. which reprices the Order by calling the repriceOrder pipeline and then updates the Order by calling OrderManager. Typically. which is used to modify orders by adding and removing items and changing item quantities.PipelineChainInvocation.commerce.Id"/>'> To delete an item from the Order. you’ll need to reprice orders via some other mechanism if customers can make order changes that affect order price through other form handlers that do not reprice orders (for example. pass the new quantity into the ShippingpingGroupCommerceItemRelationship. as shown in the following JSP example: <dsp:input bean="CartModifierFormHandler.service. two form handlers in the ATG Commerce purchase process have handle methods that you can use to reprice an Order: • • CartModifierFormHandler. ATG Commerce provides an instance of RepriceOrder. To change the quantity of an item in the Order. use the RepriceOrderDroplet servlet bean. but you cannot do so through a form action and corresponding handle method.Id" type="checkbox"/> Repricing Orders As described in Modifying Orders and Checking Out Orders in this chapter. The RepriceOrderDroplet servlet bean is an instance of atg. which extends atg. or if the orders are modified through some other means in ways that affect order price. as shown in the following JSP example: <dsp:input value='<dsp:valueof param="SgCiRelationship. the Profile. the 329 11 .Configuring Purchase Process Services .servlet. By default. the servlet bean is configured to invoke the repriceAndUpdateOrder pipeline.removalRelationshipIds" paramvalue="SgCiRelationship.pipeline.ATG Commerce Programming Guide µ Refer to Understanding the CartModifierFormHandler for more information on these handle methods.RepriceOrder. However.order. The RepriceOrder class provides the required objects for executing a repricing pipeline as convenient properties. pass the ID of the associated ShippingGroupCommerceItemRelationship into the form handler’s removalRelationshipIds property. which is located in Nucleus at /atg/commerce/order/purchase/RepriceOrderDroplet.

OP_REPRICE_ORDER_SUBTOTAL_TAX PricingConstants. which means that a page developer doesn’t need to supply them as input parameters every time the RepriceOrderDroplet servlet bean is invoked.commerce.PricingConstants interface.OP_REPRICE_ORDER_SUBTOTAL_SHIPPING PricingConstants.OP_REPRICE_TAX PricingConstants. the only required parameter that must be supplied is the pricing operation to execute.pricing.OP_REPRICE_ORDER_SUBTOTAL PricingConstants.Configuring Purchase Process Services .order. and the user’s PricingModelHolder.current profile=/atg/userprofiling/Profile orderManager=/atg/commerce/order/OrderManager userPricingModels=/atg/commerce/pricing/UserPricingModels This default configuration enables a page developer to include the RepriceOrderDroplet servlet bean on any shopping cart page that requires the repricing and updating of Orders with the following JSP code: <dsp:droplet name="RepriceOrderDroplet"> <dsp:param value="ORDER_SUBTOTAL" name="pricingOp"/> </dsp:droplet> 330 11 . they are the following: Pricing Operation ORDER_TOTAL ORDER_SUBTOTAL ORDER_SUBTOTAL_SHIPPING ORDER_SUBTOTAL_TAX ITEMS SHIPPING ORDER TAX NO_REPRICE Pricing Constant PricingConstants.µ ATG Commerce Programming Guide OrderManager.properties and indicates its default configuration: $class=atg.OP_REPRICE_SHIPPING PricingConstants.OP_NO_REPRICE The following code sample is taken from RepriceOrderDroplet. Acceptable pricing operations are defined in the atg.OP_REPRICE_ORDER_TOTAL PricingConstants. Consequently.purchase.RepriceOrder $scope=request defaultPipelineManager=/atg/commerce/PipelineManager defaultChainId=repriceAndUpdateOrder order^=/atg/commerce/ShoppingCart.OP_REPRICE_ITEMS PricingConstants.commerce. RepriceOrder is conveniently configured to reference these objects.OP_REPRICE_ORDER PricingConstants.

empty Order that is set as the user’s current order. and the transactional modes and transitions of the processors in the repriceOrder pipeline. The following table describes the important methods in SaveOrderFormHandler. then calls the saveOrder() method to save the order. Method handleSaveOrder Description This handle method first calls the empty preSaveOrder() method. For information on the OrderManager.ATG Commerce Programming Guide µ For information on all of the input. ATG Commerce includes an instance of SaveOrderFormHandler.updateOrder() method. The following table describes the individual processors in the updateOrder pipeline. Finally.SaveOrderFormHandler) saves the user’s current Order and adds the Order to the ShoppingCart’s list of saved orders. Additionally. and finally calls the empty postSaveOrder() method. For more information about pipelines. it constructs a new.updateOrder().order. and constructs a new.Configuring Purchase Process Services . the method sets the description using the date and time as represented by the user’s locale. see the RepriceOrder reference entry in Appendix: ATG Commerce Servlet Beans of the ATG Commerce Guide to Setting Up a Store. For more information on OrderManager. the method saves the Order to the repository by calling the OrderManager. If no description is provided. They are listed in order of execution. the method adds the Order to the list of saved orders in the ShoppingCart. see Updating an Order with the OrderManager below. empty Order and sets it as the user’s current Order. saveOrder Updating an Order with the OrderManager The actual saving of an Order object occurs by calling the updateOrder() method in the OrderManager. The updateOrder() method calls into the PipelineManager to execute the updateOrder pipeline. the PipelineManager. 331 11 .purchase. output. Each processor in the pipeline saves a different type of commerce object.saved property. and open parameters of RepriceOrderDroplet. Next. see the Commerce Processor Chains section. This method first sets the current Order’s description based on the provided String description.commerce. Saving Orders The SaveOrderFormHandler (class atg. which is located in Nucleus at /atg/commerce/order/purchase/SaveOrderFormHandler. see Updating an Order with the Order Manager in this chapter.updateOrder() method and the updateOrder pipeline.

commerce. The class that implements this functionality is atg.µ PipelineLink name updateOrderObject ATG Commerce Programming Guide Description Saves an Order object’s properties to the repository. updateHandlingInstructionObjects Saves the HandlingInstruction properties for the handling instructions in the Order. updateShippingGroupObjects Saves the ShippingGroup properties for the shipping groups in the Order. The class that implements this functionality is atg.processor.processor. The class that implements this functionality is atg.order.processor. The class that implements this functionality is atg.ProcSaveCommer ceItemObjects. updatePaymentGroupObjects Saves the PaymentGroup properties for the payment groups in the Order.ProcSavePaymen tGroupObjects.ProcSaveRelati onshipObjects.order.commerce.commerce.commerce. updateRelationshipObjects Saves the Relationship properties for the Relationships in the Order.processor.ProcSaveShippi ngGroupObjects.processor. These are the authorizationStatus. updatePaymentStatusObjects Saves the PaymentStatus properties for the PaymentStatus objects in all the payment groups in the Order. The Order is supplied in the optional user parameter of the PipelineManager. 332 11 .ProcSavePaymen tStatusObjects.processor.order. The class that implements this functionality is atg.commerce. The class that implements this functionality is atg. debitStatus.commerce.ProcSaveHandli ngInstructionObjects.order.order. and creditStatus properties in the PaymentGroup class.processor.order. The class that implements this functionality is atg.ProcSaveOrderO bject.Configuring Purchase Process Services .order.commerce. updateCommerceItemObjects Saves the CommerceItem properties for the items in the Order.

then the preserveOrder() method simply sends a ModifyOrder GenericRemove notification message to Fulfillment for any action deemed appropriate. updatePriceInfoObjects setLastModifiedTime Sets the lastModifiedTime property in the Order object if any changes were made to the Order.order. The properties saved are in Order (priceInfo and taxPriceInfo).purchase.deleteStates property.deleteStates property.order.ProcSetLastMod ifiedTime. then the deleteOrder() method deletes the current Order from the user’s ShoppingCart.CancelOrderFormHandler) cancels the user’s current Order. Method handleCancelOrder Description This handle method calls either the deleteOrder() method or the preserveOrder() method (depending on whether the Order can be deleted).order. If the state of the current Order is one of the configured states in the CancelOrderFormHandler.ATG Commerce Programming Guide µ Saves the PriceInfo properties for the PriceInfo in the Order. and the transactional modes and transitions of the processors in the updateOrder pipeline. ShippingGroup (priceInfo). If no changes were made.processor. The class that implements this functionality is atg. which is located in Nucleus at /atg/commerce/order/purchase/CancelOrderFormHandler.commerce.commerce. see the Commerce Processor Chains section. the PipelineManager. The following table describes the important methods in CancelOrderFormHandler. then the lastModifiedTime is not changed. For more information about pipelines.processor. which deletes the Order from the ShoppingCart. The class that implements this functionality is atg.ProcSavePaymen tGroupObjects. If the state of the current Order isn’t one of the configured states in the CancelOrderFormHandler.commerce. and CommerceItems (priceInfo). ATG Commerce includes an instance of CancelOrderFormHandler. Canceling Orders The CancelOrderFormHandler (class atg.Configuring Purchase Process Services . deleteOrder preserveOrder 333 11 .

µ Checking Out Orders • ATG Commerce Programming Guide The order checkout process can vary depending on the requirements and complexities of your site. Checking Out an Order Describes the processing of an Order after the customer has supplied all necessary information for the Order and has submitted it for checkout.Configuring Purchase Process Services . ATG Commerce provides an instance of ExpressCheckoutFormHandler.updateOrder() and the updateOrder pipeline that it executes. This section describes the checkout process for both simple and complex sites and includes the following sections: Preparing a Simple Order for Checkout Describes the use of ExpressCheckoutFormHandler. However. ExpressCheckoutFormHandler supports the use of a single Profile-derived HardgoodShippingGroup and a single Profile-derived CreditCard. then calls OrderManager. then you must use the form handlers described in Preparing a Complex Order for Checkout. or any number or type of payment group. Intended for sites that support only a single HardgoodShippingGroup and CreditCard.commerce. or any number or type of payment group. For more information on OrderManager. Intended for sites that support any number or type of shipping group. if your site supports any number or type of shipping group. Note that the form handlers described in that section also work with simple Orders that have a single HardgoodShippingGroup and a single CreditCard. you can manage and expedite the pre-checkout process for Orders using the ExpressCheckoutFormHandler (class atg. and finally calls commitOrder() to submit the Order for checkout. 334 11 . which is located in Nucleus at /atg/commerce/order/purchase/ExpressCheckoutFormHandler. which manages and expedites the pre-checkout processing of orders.ExpressCheckoutFormHandler). • • Preparing a Simple Order for Checkout If your site supports the use of only a single HardgoodShippingGroup and a single CreditCard for a given Order. The following table describes its important methods: Method handleExpressCheckout Description This handle method first invokes the runRepricingProcess() method to reprice the Order. Preparing a Complex Order for Checkout Describes the various form handlers that manage the pre-checkout processing of orders.order.purchase.updateOrder() to save the Order in its present state to the Order Repository. see the Updating an Order with the Order Manager subsection of Saving Orders in this chapter.

last). See Checking Out an Order for detailed information on the order checkout process. then the user can supply the CreditCard information in a form through the ExpressCheckoutFormHandler.last). Finally. as with all shopping cart-related form handlers. If True. The following boolean properties of the ExpressCheckoutFormHandler govern its behavior: Property Name paymentGroupNeeded Description If True.shippingGroup property. If False. Note: Recall that. If False.handleExpressCheckout() method submits the Order for checkout.Configuring Purchase Process Services . commitOrder This method first ensures that the user isn’t trying to double-submit the Order by checking if the ID of the current Order is equal to the ID of the user’s last Order (in ShoppingCart.current). If True. then the ExpressCheckoutFormHandler. then a CreditCard payment group is automatically taken from the Profile. By shippingGroupNeeded commitOrder default. By default. 335 11 .repriceOrderChainId. as necessary. see Preparing a Complex Order for Checkout. The method then calls the OrderManager. empty Order and sets it as the user’s current Order (in ShoppingCart. To implement a system that requires a more complex checkout process.ATG Commerce Programming Guide µ runRepricingProcess Reprices the Order by running the pipeline specified in ExpressCheckoutFormHandler. You can set this property to False if you want to display a confirmation page before committing the Order.paymentGroup property. empty preXXX and postXXX methods are provided so you can extend ExpressCheckoutFormHandler. see the Commerce Processor Chains section. For more information on the repriceOrder pipeline. this property is set to False.). which executes the processOrder pipeline (See Checking Out an Order later in this chapter. then a HardgoodShippingGroup is automatically taken from the Profile. If the IDs are not equal. then the current Order can be submitted for checkout. then the user can supply the HardgoodShippingGroup information in a form through the ExpressCheckoutFormHandler.processOrder() method. this property is set to repriceOrder. the method sets the submitted Order as the user’s last Order (in ShoppingCart. and it constructs a new.

The form handler’s hardgoodShippingGroupName property determines the name of the new shipping group.µ ATG Commerce Programming Guide Preparing a Complex Order for Checkout ATG Commerce provides several form handlers to support a checkout process that uses any number or type of shipping group and payment group.purchase. this property is set to hardgoodShippingGroup.Configuring Purchase Process Services . CreateHardgoodShippingGroupFormHandler is configured to use /atg/commerce/util/AddressValidator to validate the shipping address before creating the shipping group. which makes it easier for you to extend them when necessary. see Preparing a Simple Order for Checkout. If your site has this type of complex checkout process.commerce.CreateHardgoodShippingGroupFormHandler. To create the HardgoodShippingGroup. then you should use the form handlers described in this section instead of ExpressCheckoutFormHandler. These form handler classes create the ShippingGroups and optionally add them to the ShippingGroupMapContainer. The form handler’s hardgoodShippingGroupType property determines the type of shipping group to create. Separate form handlers exist to support the following tasks: • • • • • Creating shipping groups Associating shipping groups with an Order and its items Creating payment groups Associating payment groups with an Order and its items Submitting an Order for checkout Creating Shipping Groups ATG Commerce provides two implementations of the CreateShippingGroupFormHandler interface to support the form-driven creation of hard good and electronic shipping groups. the handleNewHardgoodShippingGroup() method invokes the createHardgoodShippingGroup() method. which actually creates the shipping group.) The form handlers described in this section manage different subprocesses in the pre-checkout process. (For more information on ExpressCheckoutFormHandler. ATG Commerce provides an instance of atg. which makes it possible for users to edit its properties directly via JSP forms. by default. it is located in Nucleus at /atg/commerce/order/purchase/CreateHardgoodShippingGroupFormHandler . The two default implementations of CreateShippingGroupFormHandler are: • CreateHardgoodShippingGroupFormHandler This form handler class creates a HardgoodShippingGroup and exposes it via a getHardgoodShippingGroup() method. Once the shipping groups are added to the ShippingGroupMapContainer. the user can then select from among them for use in the current Order. as referenced in the ShippingGroupMapContainer. The default configuration is: validateFirstName=true 336 11 .order.

Configuring Purchase Process Services . The form handler’s electronicShippingGroupType property determines the type of shipping group to create. via the UpdateHardgoodShippingGroupFormHandler class. the form handler’s addToContainer property determines whether the new shipping group is added to the ShippingGroupMapContainer and made the default shipping group. Once the HardgoodShippingGroup is added to the ShippingGroupMapContainer. Finally. which makes it possible for users to edit its properties directly via JSP forms.purchase. ATG Commerce provides an instance of atg. you can use the UpdateHardgoodShippingGroupFormHandler to handle shipping address changes. Finally. this property is set to electronicShippingGroup.CreateElectronicShippingGroupFormHandle r. by default. updateOrder—Updates the HardgoodShippingGroup in the order. The form handler’s electronicShippingGroupName property determines the name of the new shipping group. To create the ElectronicShippingGroup.order. UpdateHardgoodShippingGroupFormHandler can update this information in any or all of three places. based on these properties: updateContainer—Updates the HardgoodShippingGroup in the ShippingGroupMapContainer. the handleNewElectronicShippingGroup() method invokes the createElectronicShippingGroup() method. by default. After creating the HardgoodShippingGroup. this property is set to True. the user can use it when checking out the Order. • CreateElectronicShippingGroupFormHandler This form handler class creates an ElectronicShippingGroup and exposes it via a getElectronicShippingGroup() method. as referenced in the ShippingGroupMapContainer. which actually creates the shipping group and sets the shipping group’s emailAddress property.ATG Commerce Programming Guide µ validateLastName=true validateAddress1=true validateCity=true validateCounty=false validateState=true validatePostalCode=true validateCountry=true validateEmail=false validatePhoneNumber=false validateFaxNumber=false This validation can be performed every time the shipping group is updated.commerce. updateProfile—Updates the shipping address in the profile. it is located in Nucleus at /atg/commerce/order/purchase/CreateElectronicShippingGroupFormHandl er. the 337 11 .

shippingGroupTypes (which is supplied via an input parameter). Its initializeShippingGroups() method should gather the user’s ShippingGroups by type and add them to the ShippingGroupMapContainer referenced by the ShippingGroupFormHandler. The initializeShippingGroups() method of the ShippingGroupInitializer is then used to initialize the ShippingGroup and add it to the ShippingGroupMapContainer. Second.µ ATG Commerce Programming Guide form handler’s addToContainer property determines whether the new shipping group is added to the ShippingGroupMapContainer and made the default shipping group.commerce. based on these properties: updateContainer—Updates the ElectronicShippingGroup in the ShippingGroupMapContainer. the ElectronicShippingGroupInitializer queries the Profile’s email property and applies the result to a new ElectronicShippingGroup. Once the ElectronicShippingGroup is added to the ShippingGroupMapContainer. you can use the UpdateShippingGroupFormHandler to handle updates to the shipping group. and the latter creates ElectronicShippingGroups based on the existence of an e-mail address in the user’s Profile. Note that ATG Commerce provides two implementations of the ShippingGroupInitializer interface. which initializes one or more ShippingGroups for the current user and adds them to the ShippingGroupMapContainer. its corresponding ShippingGroupInitializer is obtained from the ServiceMap in ShippingGroupDroplet. namely HardgoodShippingGroupInitializer and ElectronicShippingGroupInitializer. which is subsequently added to the ShippingGroupMapContainer. The input parameters passed into ShippingGroupDroplet determine what types of ShippingGroups are created (hard good. updateOrder—Updates the ElectronicShippingGroup in the order. To use this framework with a new ShippingGroup type that you create.shippingGroupInitializers (keyed by ShippingGroup type). Finally. For a detailed list of these input parameters. the user can use it when checking out the Order. register a Nucleus component for the new ShippingGroupInitializer implementation and add it to the ServiceMap in ShippingGroupDroplet. or both) and whether the ShippingGroupMapContainer is cleared before they are created. To initialize the ShippingGroup objects. After creating the ElectronichippingGroup. electronic. 338 11 .Configuring Purchase Process Services . first. the service method of ShippingGroupDroplet calls initializeUsersShippingMethods().purchase.shippingGroupInitializers. as well as output parameters. You can also create Profile-derived ShippingGroups and add them to the ShippingGroupMapContainer by using the ShippingGroupDroplet servlet bean (class atg. which is keyed by ShippingGroup type. this property is set to True.shippingGroupTypes parameter on those site pages where the new ShippingGroup type is utilized. and a code example. include the new ShippingGroup type in the ShippingGroupDroplet. see the Adding Shipping Information to Shopping Carts section of the Implementing Order Retrieval chapter of the ATG Commerce Guide to Setting Up a Store. write a new ShippingGroupInitializer implementation.order. UpdateShippingGroupFormHandler can update shipping group information in the container and/or the order. For example.ShippingGroupDroplet). For each entry in ShippingGroupDroplet. open parameters. The former creates HardgoodShippingGroups based on their existence in the user’s Profile. by default.

you should then reprice the given Order using the RepriceOrderDroplet servlet bean before displaying its price to the customer.order. ATG Commerce provides a request-scoped instance of atg. set the validateShippingGroups property to false. The resulting collections of ShippingGroups and CommerceItemShippingInfos are exposed via the output • 339 11 . and relationshipType. By default. Consequently. This container stores the user’s CommerceItemShippingInfo objects for the CommerceItems in the Order. which represents the association between a CommerceItem and its shipping information and includes properties such as quantity.order.Configuring Purchase Process Services . which defines a Map of user-assigned ShippingGroup names to ShippingGroups.order. The ShippingGroupDroplet servlet bean is used to initialize ShippingGroup objects and CommerceItemShippingInfo objects for use by the ShippingGroupFormHandler.commerce. which contains a reference to both the ShippingGroupMapContainer and CommerceItemShippingInfoContainer.commerce.ShippingGroupDroplet.commerce.CommerceItemShippingInfoContainer. see the validateShippingInfo Pipeline Chain section.purchase. • Additionally. The ShippingGroupFormHandler works in conjunction with the ShippingGroupDroplet to manipulate the relationships between CommerceItems and ShippingGroups in the order. the ShippingGroupFormHandler can be used to create and manage the associations between the ShippingGroups and the items in the Order. To learn more about the pipeline chain.purchase. the ShippingGroupFormHandler uses the following helper classes: • atg.purchase.HandlingInstructionInfo.commerce. which is located in Nucleus at /atg/commerce/order/purchase/ShippingGroupFormHandler.purchase. These objects store the information needed to create ShippingGroupCommerceItemRelationships for the Order.CommerceItemShippingInfo. this form handler invokes the validateShippingInfo pipeline chain to validate ShippingGroup information.ATG Commerce Programming Guide µ Associating Shipping Groups with an Order and Its Items When the user has supplied the shipping information for an Order.order. To skip validation. which defines a Map of CommerceItems to CommerceItemShippingInfo Lists.commerce. Handling Instructions and their relationships to CommerceItems and ShippingGroups are also manipulated based on the relationship between each CommerceItem and the ShippingGroups.order.ShippingGroupFormHandler.ShippingGroupMapContainer.purchase. see Repricing Orders section of the ATG Commerce Guide to Setting Up a Store. • atg. atg. For more information on RepriceOrderDroplet. This container stores the user’s potential ShippingGroups for the Order. The ShippingGroupFormHandler is composed of the following containers: • atg. It should be noted that ShippingGroupFormHandler does not reprice the given Order.commerce.order. HandlingInstructionInfo is stored in a handingInstructionInfos list property of the CommerceItemShippingInfo object. if you enable customers to make order changes that affect order price through this form handler. splitQuantity.purchase. atg. which is used to associate handling instruction information with each CommerceItemShippingInfo object.

µ • ATG Commerce Programming Guide parameters of the servlet bean. see below.purchase. which determines how gift items are handled when split across shipping groups. then the method calls splitCommerceIdentifierShippingInfoByQuantity(). If the splitQuantity is greater than zero and not greater than the quantity. which contains helper methods for creating. it retrieves the quantity and the splitQuantity.CommerceItemShippingInfoTools. and updates the Order. handleApplyShippingGroups This handle method adds the ShippingGroups to the Order. the ShippingGroupFormHandler adds the necessary ShippingGroups to the Order. Creating Shipping Groups. as well as advanced applications that apply a default ShippingGroup to any remaining items not explicitly covered by other ShippingGroups. adjusts the properties of both the new and existing objects. handleSpecifyDefault ShippingGroup This handle method is used to let the user specify a default ShippingGroup to use for shipping. modifying. The method then iterates through the list. With these helper classes and containers. For more information on initializing CommerceItemShippingInfo objects. see the previous section. CommerceItemShippingGroupTools includes the includeGifts flag. which sets the defaultShippingGroupName in the ShippingGroupMapContainer. removing and applying the CommerceItemShippingInfo and ShippingGroup objects in the CommerceItemShippingInfoContainer and ShippingGroupMapContainer containers respectively. For more information on using the ShippingGroupDroplet to initialize ShippingGroup objects. The method calls specifyDefaultShippingGroup(). which retrieves the list of CommerceItemShippingInfo objects from the CommerceItemShippingInfoContainer. It 340 11 . The handle method calls splitShippingInfos(). establishes their relationships to the CommerceItems. The following table describes the handle methods used in these processes: Method handleSplitShippingInfos Description of Functionality This handle method splits the quantities of CommerceItems across several CommerceItemShippingInfo objects.Configuring Purchase Process Services .order. splitCommerceIdentifierShippingInfoByQuantity() creates a new CommerceIdentifierShippingInfo object. performs validation. and adds the new object to the CommerceItemShippingInfoContainer. atg. For each CommerceItemShippingInfo. Setting the default ShippingGroup can facilitate simpler applications that permit only one ShippingGroup per Order.commerce. In turn.

the handle method calls runProcessValidateShippingGroups() to validate the ShippingGroups in the Order. if the form handler’s applyDefaultShippingGroup property is True. For information on the validateShippingInfo pipeline. see the Commerce Processor Chains section. This executes the shipping validation pipeline specified in ShippingGroupFormHandler. see the Updating an Order with the 341 11 . The handle method calls applyShippingGroups().addItemQuantityToShippingGrou p() or CommerceItemManager. For more information on OrderManager.ATG Commerce Programming Guide µ is used when the customer has supplied the necessary shipping information for the Order and is ready to proceed with the next checkout phase.addRemainingItemQuantityToShi pping().updateOrder() to save the Order in its present state to the Order Repository.updateOrder() and the updateOrder pipeline that it executes. Finally. If one exists. by default. Then the method retrieves the Relationship type of the current CommerceItemShippingInfo object and calls either CommerceItemManager. then the applyShippingGroups() method checks for a default shipping group in the ShippingGroupMapContainer. the associated ShippingGroup is retrieved and added to the Order (if it isn’t already in the Order). This adds the appropriate quantity of the CommerceItem to the ShippingGroup. then the remaining quantity of all CommerceItems in the Order is added to the default shipping group. the handle method calls OrderManager.validateShippingGroupsCh ainId.removeAllShippingGroupsFromO rder() to remove any existing ShippingGroups from the Order. The applyCommerceItemShippingInfo() method iterates through the list of CommerceItemShippingInfo objects in the CommerceItemShippingInfoContainer. depending on the relationshipType (SHIPPINGQUANTITY OR SHIPPINGQUANTITYREMAINING). this property is set to validateShippingInfo.Configuring Purchase Process Services . This ensures a clean Order. The applyShippingGroups() method then calls applyCommerceItemShippingInfo(). which applies all CommerceItemShippingInfo objects to the Order. which first calls ShippingGroupManager. For each CommerceItemShippingInfo object. Next. Then.

merge. Gift items in an order are identified by a special handling instruction (GiftHandlingInstruction). HandlingInstructionInfo objects are automatically generated for any handling instructions currently in the Order. open parameters. • • GiftHandlingInstructions are not included in the HandlingInstructionInfos associated with the CommerceItemShippingInfos ShippingGroups that contain only gifts are not added to the ShippingGroupMapContainer The result is that none of the gift-related objects in the Order are added to the CommerceItemShippingInfoContainer and ShippingGroupMapContainer when initializing based on the Order. For a detailed list of these input parameters. As previously mentioned. The paragraph above describes the default behavior of the ShippingGroupDroplet. When the ShippingGroupDroplet initializes a container based on the current contents of an Order. the service method calls initializeCommerceItemShippingInfos() which. a CommerceItemShippingInfo will be created for a quantity of 2. it has the following effects: • CommerceItemShippingInfo objects don’t include the quantity of the items designated as gifts. so they can be used by the ShippingGroupFormHandler. and after applying. 342 11 . These HandlingInstructionInfo objects are then associated with the appropriate CommerceItemShippingInfo objects based on the CommerceItem referenced in the handling instruction. and 1 is a gift. and a code example. by default. To initialize the CommerceItemShippingInfo objects. The droplet. Each new CommerceItemShippingInfo references the default ShippingGroup in the ShippingGroupMapContainer. An additional parameter controls whether the CommerceItemShippingInfoContainer is cleared before the objects are created. and apply handling information along with the CommerceItemShippingInfo objects with which it is associated. they remain unchanged in the Order. see the Adding Shipping Information to Shopping Carts section of the Implementing Order Retrieval chapter of the ATG Commerce Guide to Setting Up a Store.µ ATG Commerce Programming Guide Order Manager subsection of Saving Orders in this chapter. creates and initializes a CommerceItemShippingInfo for each CommerceItem in the Order and adds them to the CommerceItemShippingInfoContainer. the ShippingGroupDroplet servlet bean is used to initialize CommerceItemShippingInfo objects and add them to the CommerceItemShippingInfoContainer. The HandlingInstructionInfo class makes it possible to split. For example.Configuring Purchase Process Services . however. has several input parameters that control whether and how CommerceItemShippingInfo objects are created. and therefore the ShippingGroupDroplet and ShippingGroupFormHandler automatically handle splitting and merging of gift items in the order. if an item is quantity 3. as well as ShippingGroupDroplet output parameters. If the CommerceItemShippingInfoTools includeGifts property is set to false (the default).

the form handler’s copyToProfile property determines whether the payment group is copied to the Profile. updateOrder—Update the credit card in the order. Once the payment groups are added to the PaymentGroupMapContainer.purchase. this property is set to True. this property is set to true. this property is set to creditCard. which makes it possible for users to edit its properties directly via JSP forms. To create the CreditCard payment group. The form handler’s creditCardType property determines the type of CreditCard payment group to create.order.purchase. After creating the credit card information. as referenced in the PaymentGroupMapContainer. To validate credit cards. which makes it possible for users to edit its properties directly via JSP forms.) CreateCreditCardFormHandler can optionally validate credit card information using the credit card’s verification number.CreateCreditCardFormHandler. • CreateInvoiceRequestFormHandler (ATG Business Commerce only) This form handler creates an InvoiceRequest payment group and exposes it via a getInvoiceRequest() method. The form handler’s creditCardName property determines the name of the new payment group. which actually creates the payment group. The default implementations of the CreatePaymentGroupFormHandler are: • CreateCreditCardFormHandler This form handler creates a CreditCard payment group and exposes it via a getCreditCard() method.Configuring Purchase Process Services . by default. updateProfile—Update the credit card in the profile. the user can use it when checking out the Order. the user can then select from among them for use in the current Order. you can use the UpdateCreditCardFormHandler to deal with any changes the user makes to their credit card information.CreateInvoiceRequestFormHandler. it is 343 11 . Finally.b2bcommerce.commerce. These form handler classes create the payment groups and optionally add them to the PaymentGroupMapContainer. (Once the payment group is added to the PaymentGroupMapContainer. it is located in Nucleus at /atg/commerce/order/purchase/CreateCreditCardFormHandler.ATG Commerce Programming Guide µ Creating Payment Groups ATG Commerce provides two implementations of the CreatePaymentGroupFormHandler interface to support the form-driven creation of credit card and invoice payment groups. ATG Business Commerce provides an instance of atg. by default. set the validateCreditCard property to true. ATG Commerce provides an instance of atg. by default. The form handler’s addToContainer property determines whether the new payment group is added to the PaymentGroupMapContainer and made the default payment group. based on these properties: updateContainer—Update the credit card in the PaymentGroupMapContainer. the handleNewCreditCard() method invokes the createCreditCard() method. UpdateCreditCardFormHandler can update this information in any or all of three places.order.

For a detailed list of these input parameters. write a new PaymentGroupInitializer implementation. The handle method then calls createInvoiceRequest(). and a code example. (Once the payment group is added to the PaymentGroupMapContainer.paymentGroupInitializers (keyed by PaymentGroup type). store credit. To create the InvoiceRequest payment group.paymentGroupTypes (which is supplied via an input parameter). the user can use it when checking out the Order.Configuring Purchase Process Services . this property is set to defaultBillingAddress. The form handler’s invoiceRequestType property determines the type of InvoiceRequest payment group to create. see the Adding Payment Information to Shopping Carts section of the Implementing Shopping Carts chapter of the ATG Commerce Guide to Setting Up a Store. open parameters. which actually creates the payment group. The initializePaymentGroups() method of the PaymentGroupInitializer is then used to initialize the PaymentGroup and add it to the PaymentGroupMapContainer.PaymentGroupDroplet).purchase.order. Finally. this property is set to invoiceRequest. which initializes one or more PaymentGroups for the current user and adds them to the PaymentGroupMapContainer. gift certificate) and whether the PaymentGroupMapContainer is cleared before they are created. the handleNewInvoiceRequest() method first invokes the checkRequiredProperties() method. You can also create Profile-derived PaymentGroups and add them to the PaymentGroupMapContainer by using the PaymentGroupDroplet servlet bean (class atg.µ located in Nucleus at ATG Commerce Programming Guide /atg/commerce/order/purchase/CreateInvoiceRequestFormHandler. Note that ATG Commerce provides four implementations of the PaymentGroupInitializer interface. To initialize the PaymentGroup objects. by default. its corresponding PaymentGroupInitializer is obtained from the ServiceMap in PaymentGroupDroplet. They are: • • • • CreditCardInitializer GiftCertificateInitializer StoreCreditInitializer InvoiceRequestInitializer (ATG Business Commerce only) To use this framework with a new PaymentGroup type that you create. The input parameters passed into PaymentGroupDroplet determine what types of PaymentGroups are created (credit card. by default. this property is set to True.commerce. as well as its output parameters. by default.) The form handler’s billingAddressPropertyName determines the billing address Profile property to copy into the InvoiceRequest. The form handler’s addToContainer property determines whether the new payment group is added to the PaymentGroupMapContainer and made the default payment group. Its initializePaymentGroups() method should gather the user’s PaymentGroups by type and add them to the PaymentGroupMapContainer referenced by the 344 11 . For each entry in PaymentGroupDroplet. the service method of PaymentGroupDroplet calls initializeUserPaymentMethods(). By default. the form handler’s invoiceRequestProperties property determines what additional Profile properties to dynamically add to the InvoiceRequest. this method checks that a poNumber for the invoice has been specified and throws an exception if one has not been provided. first.

Any Order that has been successfully processed by the PaymentGroupFormHandler is ready for the next phase of the purchase process. If you’d prefer for items to be priced according to a pricelist rather than the default behavior provided by the pricing engine. This container stores the user’s CommerceIdentifierPaymentInfo objects for the Order. which typically is Order checkout. ShippingGroups. atg.purchase.commerce. and then adds them to the PaymentGroupMapContainer. which is typically order confirmation. tax.order.PaymentGroupDroplet. The resulting collections of PaymentGroups and CommerceIdentifierPaymentInfo objects are exposed via the output parameters of the servlet bean. ATG Commerce provides a request-scoped instance of atg. • Additionally. which represents the association between a CommerceIdentifier and its payment information and includes properties that allow the cost of a given quantity or even a single item to be spread across multiple payment groups. which is located in Nucleus at /atg/commerce/order/purchase/PaymentGroupFormHandler. instantiates objects for them.commerce.PaymentGroupMapContainer. which is keyed by PaymentGroup type. When it is finished.order.order.purchase.CommerceIdentifierPaymentInfoContainer.purchase.order. Second. adds the CommerceItems.purchase. the Order is ready to proceed to the next step in the purchase process. register a Nucleus component for the new PaymentGroupInitializer implementation and add it to the ServiceMap in PaymentGroupDroplet.CommerceIdentifierPaymentInfo.paymentGroupInitializers. and finally saves the Order in its present state to the Order Repository. (For more information on using PaymentGroupDroplet to • 345 11 . the PaymentGroupFormHandler can used to create and manage the associations between the PaymentGroups and the various parts of the Order.PaymentGroupFormHandler.purchase.commerce. Associating Payment Groups with an Order and Its Items When the user has supplied the payment information for an Order. which defines a Map of user-assigned PaymentGroup names to PaymentGroups. include the new PaymentGroup type in the PaymentGroupDroplet. The PaymentGroupFormHandler adds the PaymentGroups to the Order. (See Submitting an Order for Checkout. cost amount and cost remaining information to the PaymentGroups.paymentGroupTypes parameter on those site pages where the new PaymentGroup type is utilized. validates the PaymentGroup information. For example. set the priceListId property to the appropriate pricelist.order. This container stores the user’ potential PaymentGroups for the Order.commerce. the PaymentGroupFormHandler uses the following helper classes: • atg. These objects store the information need to create payment Relationships for the Order. which implements both the PaymentGroupMapContainer and CommerceIdentifierPaymentInfoContainer interfaces. The PaymentGroupDroplet servlet bean is used to initialize PaymentGroup objects and CommerceIdentifierPaymentInfo objects for use by the PaymentGroupFormHandler.) The PaymentGroupFormHandler is composed of the following containers: • atg. atg. Finally.Configuring Purchase Process Services .ATG Commerce Programming Guide µ PaymentGroupFormHandler.commerce. the StoreCreditInitializer queries the Claimable Repository for the user’s StoreCredit PaymentGroups. which defines a Map of CommerceIdentifiers to CommerceIdentifierPaymentInfo Lists.

For more information on initializing CommerceIdentifierPaymentInfo objects. The method calls specifyDefaultPaymentGroup(). which sets the defaultPaymentGroupName in the PaymentGroupMapContainer. see below in this section. and adjusts the amount of both the original and the new CommerceIdentifierPaymentInfo objects to add up to the original CommerceIdentifier total amount. The handle method calls splitPaymentInfos(). It is used when the user has supplied the necessary payment information for the Order and is ready to proceed with the next checkout phase. handleApplyPaymentGroups This handle method adds the PaymentGroups to the Order. and updates the Order. validates them.µ handle methods used in these processes: ATG Commerce Programming Guide initialize PaymentGroup objects. The following table describes the Method handleSplitPaymentInfos Description of Functionality This handle method is used when the user wants to split a particular CommerceIdentifierPaymentInfo by amount across multiple PaymentGroups. see Creating Payment Groups. In a form. splitCommerceIdentifierPaymentInfo() calls splitCommerceIdentifierPaymentInfoByAmount() to split the CommerceIdentifierPaymentInfo object. 346 11 . In turn. The method creates a new CommerceIdentifierPaymentInfo object. the user might request to split $50 of an original CommerceIdentifier amount of $100 to a separate payment method. as well as advanced applications that apply a default PaymentGroup to any remaining Order amount not explicitly covered by other PaymentGroups. adjusts the properties of both the existing and new objects. Setting the default PaymentGroup can facilitate simpler applications that permit only one PaymentGroup per Order. which retrieves the list of CommeceIdentifierPaymentInfo objects from the CommerceIdentifierPaymentInfoContainer. and adds the new object to the CommerceIdentifierPaymentInfoContainer. handleSpecifyDefault PaymentGroup This handle method is used to let the user specify a default PaymentGroup to use for payment. the PaymentGroupFormHandler adds the necessary PaymentGroups to the Order. The splitPaymentInfos() method then iterates through the list and calls splitCommerceIdentifierPaymentInfo() on each object. This creates a separate CommerceIdentifierPaymentInfo object.) With these helper classes and containers.Configuring Purchase Process Services .

the handle method calls OrderManager. This ensures a clean Order. If one exists. if the form handler’s applyDefaultPaymentGroup property is True. this property is to moveToConfirmation. then the remaining order amount is added to the default payment group.validatePaymentInformationC hainId.removeAllPaymentGroupsFromOrder () to remove any existing PaymentGroups from the Order.ATG Commerce Programming Guide µ The handle method calls applyPaymentGroups(). Next.updateOrder() and the updateOrder pipeline that it executes. applyPaymentGroups() calls PaymentGroupManager. Next. see the Assigning Costs to PaymentGroups section of the Working With Purchase Process Objects chapter. Next. For more information. This executes the payment validation pipeline specified in PaymentGroupFormHandler. For more information on OrderManager. For more information. the handle method calls runProcessValidatePaymentGroups() to validate the PaymentGroups in the Order. Then.Configuring Purchase Process Services . which applies the CommerceIdentierPaymentInfo objects to the Order. The moveToConfirmation pipeline both prices and validates a given Order. Then the method retrieves the Relationship type of the current CommerceIdentifierPaymentInfo object and calls the appropriate method in the appropriate “Manager” to add the amount to the PaymentGroup. The applyCommerceIdentifierPaymentInfo() method iterates through the list of CommerceIdentifierPaymentInfo objects in the CommerceIdentifierPaymentInfoContainer. then the applyPaymentGroups() method checks for a default payment group in the PaymentGroupMapContainer. Finally.recalculatePaymentGroupAmount() to recalculate the payment groups. which first calls PaymentGroupManager. 347 11 . For each CommerceIdentifierPaymentInfo object. the applyPaymentGroups() method calls applyCommerceIdentifierPaymentInfo(). see the Commerce Processor Chains section.updateOrder() to save the Order in its present state to the Order Repository. the associated PaymentGroup is retrieved and added to the Order (if it isn’t already in the Order). by default. see the Updating an Order with the Order Manager subsection of Saving Orders in this chapter.

then the current Order can be submitted. In ATG Business Commerce. the PaymentGroupDroplet servlet bean is used to initialize CommerceIdentifierPaymentInfo objects and add them to the CommerceIdentifierPaymentInfoContainer. so they can be used by the PaymentGroupFormHandler. open parameters.commerce. and a code example.xml. The input parameters passed into PaymentGroupDroplet determine whether the CommerceIdentifierPaymentInfo objects are created and whether the CommerceIdentifierPaymentInfoContainer is cleared before they are created. as well as its output parameters. the service method of PaymentGroupDroplet calls initializePaymentInfos(). The form handler’s handleCommitOrder() method ensures that the user is not trying to double-submit the order by checking if the ID of the current Order is equal to the ID of the user’s last Order (in ShoppingCart. then handleCommitOrder() sets the submitted Order as the user’s last Order in ShoppingCart. The expiration date for all cards can be any date in the future. Checking Out an Order Order processing occurs when a customer has supplied all the necessary information for the Order and has submitted it for checkout. To allow the processing of incomplete Orders. The PipelineManager Nucleus component for ATG Commerce is located at /atg/commerce/PipelineManager. For a detailed list of these input parameters. which executes the processOrder pipeline. you must modify the pipeline accordingly.last). Note that. These objects are then added to the CommerceIdentifierPaymentInfoContainer. 348 11 .Configuring Purchase Process Services . ShippingGroups.purchase. the related XML configuration file is defined in /<ATG9dir>/B2BCommerce/config/atg/commerce/commercepipeline.CommitOrderFormHandler) submits the user’s current Order for checkout.last. If the IDs are not equal. see the Adding Payment Information to Shopping Carts section of the Implementing Order Retrieval chapter of the ATG Commerce Guide to Setting Up a Store. and it constructs a new.µ ATG Commerce Programming Guide As previously mentioned.xml. by default. Note: You can use the credit card information listed below to process payments during testing of the order checkout process.current. In ATG Consumer Commerce.processOrder(). as well as the Order’s CommerceItems. To initialize the CommerceIdentifierPaymentInfo objects. which creates and initializes CommerceIdentifierPaymentInfo objects for the Order. The processOrder pipeline first validates the Order and then processes it. empty Order and sets it as the user’s current Order in ShoppingCart. The processing of an Order begins with a call to OrderManager.processOrder() method. ATG Commerce includes an instance of CommitOrderFormHandler.) If no errors occur during the validation or checkout of the Order. which is located in Nucleus at /atg/commerce/order/purchase/CommitOrderFormHandler. ATG Commerce does not process an incomplete Order. which calls into the PipelineManager to execute the processOrder pipeline. the related XML configuration file is defined in /<ATG9dir>/B2CCommerce/config/atg/commerce/commercepipeline. Submitting an Order for Checkout The CommitOrderFormHandler (class atg. (See Checking Out an Order below. The handle method then calls the OrderManager.order. and tax.

The atg. See the Managing the Order Approval Process chapter for more information.ATG Commerce Programming Guide µ • • • • Visa: 4111111111111111 MasterCard: 5555555555554444 American Express: 378282246310005 Discover: 6011111111111117 The following table describes the processors in the processOrder pipeline.order.Configuring Purchase Process Services .order.) The atg. If the Order did not require approval. The atg. executeApproveOrderChain (ATG Business Commerce only) Executes the approveOrder pipeline.commerce.ProcDispatchOn OrderState class implements this functionality. this property is set to validateForCheckout. which begins the approval process.commerce. Its properties file defines the execution chain to run in the chainToRun property.processor. the processOrder pipeline continues with executeValidatePostApprovalChain. execution of the processOrder pipeline stops. By default. PipelineLink name executeValidateForCheckoutChain Description Executes the validateForCheckout pipeline (Refer to the next table in this section. the pipeline continues with executeValidateNoApprovalChain.processor. They are listed in order of execution. See the Managing the Order Approval Process chapter for more information. If the Order required approval and has been approved.commerce.ProcExecuteCha in class implements this functionality. If the Order requires approval and has not been approved yet. execution of the processOrder pipeline stops. 349 11 . If any errors occur during the execution of this processor.ProcExecuteCha in class implements this functionality.processor. stopChainIfOrderRequiresApproval (ATG Business Commerce only) Checks the state of the Order.order.

An empty PaymentGroup is one without any CommerceItemRelationships. checkForExpiredPromotions Checks that expired promotions are not used in Order that is being checked out. removeEmptyShippingGroups Removes any empty (unused) shipping groups from the Order.processor. The atg.Configuring Purchase Process Services . removeEmptyPaymentGroups Removes any empty (unused) payment groups from the Order.processor. Specifically.ProcRemoveEmpt yShippingGroups class implements this functionality.order. This processor executes the validatePostApproval pipeline.order. executeValidateNoApprovalChain (ATG Business Commerce only) For Orders that didn’t require approval. Specifically. the pipeline revalidates payment information (all payment groups and cost centers) and checks that all Order and shipping costs are accounted for. See the Managing the Order Approval Process chapter for more information. An empty ShippingGroup is one without any CommerceItemRelationships. and OrderRelationships. by default the pipeline validates InvoiceRequests.processor.ProcExecuteCha in class implements this functionality. The atg.commerce.commerce.processor. The atg.commerce.µ executeValidatePostApprovalChain ATG Commerce Programming Guide (ATG Business Commerce only) For Orders that have been approved. This processor executes the validateNoApproval pipeline.processor. which revalidates information the approver may have changed. which are intentionally skipped by the validateForCheckout pipeline until it is determined that the Order requires approval.order.commerce. ShippingGroupRelationships.order. which validates information intentionally skipped by the executeValidateForCheckout pipeline processor.ProcExecuteCha in class implements this functionality.order. See the Managing the Order Approval Process chapter for more information.ProcRemoveEmpt yPaymentGroups class implements this functionality.commerce.ProcCheckForEx piredPromotions class implements this functionality. 350 11 . The atg. The atg.

processor. such as when the items in the Order don’t exist in inventory. setPaymentGroupAmount Determines and sets the amount to charge in each PaymentGroup based on the Relationships in the Order. the processor actually creates relationships between all the CommerceItems and the ShippingGroup.Configuring Purchase Process Services . 351 11 . The atg. The atg. The atg.ProcCreateImpl icitRelationships class implements this createImplicitRelationships functionality.ProcSetCost CenterAmount class implements this functionality.order.order.ProcAuthorizeP ayment class implements this functionality. see Preventing Payment Authorization for Unfulfilled Orders later in this section.commerce.order.commerce.processor.ProcSetPayment GroupAmount class implements this functionality. The atg. The atg. or StoreCredit) in the Order.ProcMoveUsedPr omotions class implements this functionality. it is also removed from the activePromotions list and added to the customer’s inactivePromotions list. It also creates a relationship between the PaymentGroup and the Order. authorizePayment Authorizes all PaymentGroups (CreditCard.order. setCostCenterAmount (ATG Business Commerce only) Determines and sets the amount to assign to each cost center in the Order.commerce.commerce. In this situation.processor. or GiftCertificate. If the promotion is a single-use promotion.order. See the Implementing Cost Centers chapter of the ATG Commerce Guide to Setting Up a Store for more information.ATG Commerce Programming Guide µ Validates the special case of an Order having one ShippingGroup and/or one PaymentGroup and no Relationships.processor.processor. moveUsedPromotions Moves all promotions that a customer used in the Order to the usedPromotions list in the customer’s profile. Note: For information on how to prevent the authorization of a user’s credit card under certain circumstances.b2bcommerce.

µ updateGiftRepository sendGiftPurchasedMessage ATG Commerce Programming Guide Updates the Gift List Repository to reflect the purchase of any gifts in the order.commerce. 352 11 .commerce. PipelineLink name ValidateOrderForCheckout Description Verifies that the Order contains at least one CommerceItem. sendFulfillmentMessage Sends a message that includes the Order to the fulfillment system.order.commerce. They are listed in order of execution.) The atg.order.commerce.ProcVerifyOrd erAddresses class implements this functionality. addOrderToRepository This processor first calls OrderManager.processor.processor. The atg.order.commerce.order. The atg.ProcSendPromot ionUsedMessage class implements this functionality.order. VerifyOrderAddresses Verifies the addresses for shipping groups and payment groups.processor.processor. The message can then be used to execute scenarios. The atg. The first processor in the processOrder pipeline. The message can then be used to execute scenarios.ProcUpdateGift Repository class implements this functionality Sends a message to the messaging system that describes the gifts that were purchased. The atg.processor.processor.ProcSendFulfil lmentMessage class implements this functionality.Configuring Purchase Process Services .ProcValidateO rderForCheckout class implements this functionality.processor. ShippingGroup. and PaymentGroup.updateOrder() to save the Order to the Order Repository. named executeValidateForCheckoutChain.commerce.commerce. (See Updating an Order with the Order Manager. The atg.ProcSendGiftPu rchasedMessage class implements this functionality.order.order. This message indicates to the fulfillment system that it can fulfill the Order. sendPromotionUsedMessage Sends a message to the messaging system that describes the promotions that were used in the Order. in turn executes the validateForCheckout pipeline.ProcAddOrderTo Repository class implements this functionality. The following table describes the processors in the validateForCheckout pipeline. The atg.

ProcValidateP aymentGroupsForCheckout class implements this functionality. It also verifies that all required fields have been supplied to all PaymentGroups in the Order. which means the processor verifies all PaymentGroupOrderRelationships.order.order.processor.ProcCreditCar dModCheck class implements this functionality.commerce.processor.processor. (See the previous table.Configuring Purchase Process Services . validateOrderCostsForCheckout Verifies the Order can account for its cost. The atg.ProcValidateO rderCostsForCheckout class implements this functionality.order. validateHandlingInstructionsForChe ckout Verifies that all HandlingInstructions are assigned to a valid ShippingGroup and CommerceItem combination.commerce.ATG Commerce Programming Guide µ Verifies that all CommerceItems in the Order are assigned to a ShippingGroup.ProcValidateH andlingInstructionsForCheckout class implements this functionality. validateShippingCostsForCheckout Verifies that all ShippingGroups can account for their costs.commerce. creditCardModCheck Verifies that the credit card number and expiration date are valid. The credit card is not authorized by a processing system at this point. The processor also verifies that all required fields have been supplied to all ShippingGroups in the Order. which means that the processor verifies all PaymentGroupCommerceItemRelationships. the processor applies a simple algorithm to the credit card number to determine if it is valid. validatePaymentGroupsForCheckout Verifies that all CommerceItems in the Order can account for their costs. The atg.commerce.order.) Rather.order.commerce. The atg. which describes the processors in the processOrder pipeline. It then checks the date to determine if the card has expired.ProcValidateS hippingGroupsForCheckout class that implements validateShippingGroupsForCheckout this functionality is. The atg.ProcValidateS hippingCostsForCheckout class implements this functionality.processor.processor.commerce. 353 11 . The atg. The atg. which means that the processor verifies all PaymentGroupShippingGroupRelationships.order.processor.

see the Commerce Processor Chains section. For more information about pipelines. Preventing Payment Authorization for Unfulfilled Orders The processOrder pipeline performs several checkout functions. One processor in the pipeline should check that the items being purchased do exist in inventory. In ATG Consumer Commerce. see the Processor Chains and the Pipeline Manager chapter. If they do. shipping. then the Order should continue through the pipeline for checkout (and authorization of the user’s credit card).order. the user could be alerted of the lack of inventory and allowed to modify the order before checkout. This section provides information on how the payment of orders is processed in ATG Commerce and describes how to extend the system to add functionality or to support a new payment method. As previously mentioned. you need to modify the pipeline to include a branch. for example. the PipelineManager Nucleus component for ATG Commerce is located at /atg/commerce/PipelineManager. Also validates that all the items. you may want to prevent the authorization of a credit card. You can modify the processOrder pipeline to prevent credit card authorization under certain conditions.xml. and the transactional modes and transitions of the processors in the processOrder and validateForCheckout pipelines. then the Order should branch to an alternate pipeline that does not authorize the user’s credit card. debit. To do so. and it tracks the results of those payment operations using PaymentStatus objects. In ATG Business Commerce. If the items do not exist in inventory. the related XML configuration file is defined in /<ATG9dir>/B2CCommerce/config/atg/commerce/commercepipeline. including authorizing a user’s credit card for the amount of the order.ProcValidateC urrencyCodes class implements this functionality.commerce.µ validateCurrencyCodes ATG Commerce Programming Guide Validates that all the currency codes in the PriceInfo objects are the same. It includes the following sections: 354 11 . the related XML configuration file is defined in /<ATG9dir>/B2BCommerce/config/atg/commerce/commercepipeline. The atg. Instead.processor. For information on how to set up a branching pipeline. when the order contains items that do not exist in inventory. and order have been priced. In this example. Processing Payment of Orders The PaymentManager manages the authorization. The important concept is that the processOrder pipeline branches so that the user’s credit card is not authorized. the PipelineManager. tax. the pipeline might redirect the user to a page that indicates which items could not be allocated from inventory and allows the user to change the Order. and credit of PaymentGroups in an Order.xml.Configuring Purchase Process Services . Under certain circumstances.

ATG Commerce Programming Guide µ • • • • Overview of the Payment Process Extending the Payment Operations of a Payment Method Extending the Payment Process to Support a New Payment Method Extending Order Validation to Support New Payment Methods Overview of the Payment Process When the PaymentManager’s authorize/credit/debit method is called. the giftCertificateProcessorChain pipeline handles authorization. which is as follows: • • Order PaymentManager 355 11 . The first processor aggregates the necessary information for performing the requested payment action (for example.CreditCard class. This second authorize/credit/debit method performs the actual payment operation for the current PaymentGroup by looking up the pipeline appropriate for the current PaymentGroup class type and then calling that pipeline.order. By default.order.GiftCertificate=giftCertificateProcessorChain. Note that while a single pipeline exists to perform authorize. debit. for example.CreditCard=creditCardProcessorChain. By default.commerce. This Dictionary object contains the information required to perform the transaction. It passes in the PaymentManagerPipelineArgs Dictionary object as an argument to the runProcess() method of the pipeline.Configuring Purchase Process Services .GiftCertificate class.StoreCredit=storeCreditProcessorChain Thus.commerce.commerce. which uses the class name of the given PaymentGroup as the key to look up the appropriate pipeline to run in PaymentManager. CREDIT) and creates an XXXInfo object (for example. you can split these actions into separate pipelines if your processing needs for a given payment action are unusual.paymentGroupToChainNameMap. The second processor performs the actual operation – authorizing. and credit work for the atg. and credit actions for a single PaymentGroup type.commerce. the creditCardProcessorChain pipeline). or crediting the appropriate payment method.paymentGroupToChainNameMap is composed of two processors. getCreditChainName(PaymentGroup). debiting. each of the pipelines in PaymentManager. This property stores a map of PaymentGroup class types to the names of the pipelines that perform the payment actions for the payment methods. the creditCardProcessorChain pipeline handles authorization. it takes the Order and a single PaymentGroup or List of PaymentGroups as parameters.commerce. CreditCardInfo) for use in that action. To obtain the appropriate pipeline to run. this property is configured as follows: paymentGroupToChainNameMap=\ atg. this method calls getChainName(PaymentGroup). debit. debit.order. Once the appropriate pipeline to run has been obtained (for example.order. and credit work for the atg. the authorize/credit/debit method calls into the PaymentPipelineManager to execute the pipeline. It then calls its authorize/credit/debit method that takes an additional amount parameter.order. the authorize/credit/debit method calls getXXXChainName(PaymentGroup).\ atg. passing in the amount in the current PaymentGroup. In turn. and so on.\ atg.

and it is instantiated from class atg.CREDIT. and credits a CreditCard PaymentGroup by calling through to a CreditCardProcessor object to perform the actual operations. transactionSuccess.payment. CreditCardInfo) for use in that action.ProcProcessCreditCard. you may have an unusual credit operation that you want to perform on credit cards. As described in the previous section. credit.Configuring Purchase Process Services . or debit transaction performed by the pipeline. Extending the Payment Operations of a Payment Method Sometimes you may find that you need to extend the way a given payment operation works. When the PaymentManager’s authorize/credit/debit method is called. the PaymentManager. The specific object used to perform the actual operations is retrieved from PaymentManager.commerce. the GiftCertificate payment method. the method performs the payment operation and then adds a PaymentStatus object to the given PaymentGroup. CREDIT) and creates an XXXInfo object (for example. Note: The PaymentManager is also used by the Fulfillment system. This section provides information on how to extend the way payment operations work for a given payment method. and transactionTimestamp. or PaymentManagerAction. see the Configuring the Order Fulfillment Framework chapter.µ • • • • • PaymentGroup ATG Commerce Programming Guide Payment amount Action (PaymentManagerAction. using the CreditCard payment method as an example.payment.CreditCardProcessor interface.payment.aggregates the necessary information for performing the requested payment action (for example.creditCardProcessor. errorMessage. then create 356 11 . The second processor – ProcessCreditCard --performs the actual operation – authorizing. PaymentManagerAction.processor. The ProcessCreditCard processor authorizes. transactionId. which extends atg. this property points to an object instantiated from a class that implements the atg. Like all of the default payment pipelines.commerce. CreditCardInfo and GiftCertificateInfo)) PaymentStatus The PaymentStatus object represents the results of the authorize. creditCardProcessorChain is composed of two processors.ProcProcessPaymentGroup. The PaymentStatus object is discussed in more detail at the end of this section. debits. it contains properties such as amount.creditCard. debiting. The process to extend the payment operations of the StoreCredit payment method. To change the way credit cards are operated on. write a new class that implements the CreditCardProcessor interface and provides the additional functionality your site requires. For information about the Fulfillment system.processor. and the InvoiceRequest payment method (ATB Business Commerce only) works in the same fashion. or crediting the appropriate payment method.AUTHORIZE.properties file at /atg/commerce/payment/PaymentManager is configured to map CreditCard objects to the creditCardProcessorChain pipeline.DEBIT) Generic Info object (for example. The ProcessCreditCard processor is located in Nucleus at /atg/commerce/payment/processor/ProcessCreditCard. For example. The first processor – CreateCreditCardInfo -.

See Integrating the New Payment Processors into the PaymentManager. 2. 357 11 . GiftCertificate. Associate the new item type to the new class by adding an entry to the beanNameToItemDescriptorMap property of the OrderTools component. and credits. StoreCredit. debits. See Creating a New PaymentGroup. and they can later redeem those points on other purchases. In this example. and finally change the PaymentManager. Extending the Payment Process to Support a New Payment Method If your site requires it. you can extend the payment process to support a new payment method. by default the CreditCard. and configure the PaymentManager to invoke it when appropriate. Create the new StorePoints PaymentGroup.ATG Commerce Programming Guide µ and configure an instance of the new class in Nucleus. and InvoiceRequest (ATG Business Commerce only) systems are provided. Define the pipeline that processes the StorePoints PaymentGroup for authorization. The StorePoints system is implemented using the following basic steps. customers earn store points when they purchase items. using an example called the StorePoints payment method. The following diagram shows the relationships between the objects involved in processing a payment transaction. This section provides information on how to create and support a new payment method. 5. Extend the Order validation process to validate the StorePoints PaymentGroup during checkout. See Integrating a New Commerce Object: Using a New Item Descriptor. Implement the payment processors involved in operating on the StorePoints PaymentGroup. The StorePoints system is just one example of the many new payment methods you can implement. In ATG Commerce. 3. See Extending Order Validation to Support New Payment Methods in the next section. 1.Configuring Purchase Process Services .creditCardProcessor property to point to the new component. Create a new repository item type for the StorePointsPaymentGroup. Detailed instructions are provided in the referenced subsections that follow. See Implementing Processors for the New PaymentGroup. Add the new class to the paymentTypeClassMap. 4.

µ CreditCardInfo CreditCardStatus GiftCertificateInfo ATG Commerce Programming Guide CreditCardProcessor Custom Code External Credit Card Processing System GiftCertificateProcessor GiftCertificateStatus Custom Code Gift Certificate Processing System StoreCreditInfo PaymentGroup PaymentManager StoreCreditStatus StoreCreditProcessor Custom Code StoreCredit Processing System InvoiceRequestInfo InvoiceRequestProcessor InvoiceRequestStatus Custom Code InvoiceRequest Processing System StoreCreditInfo StoreCreditProcessor StoreCreditStatus Custom Code StoreCredit Processing System Creating a New PaymentGroup The first step in creating and supporting a new StorePoints payment method is to create a new PaymentGroup named StorePoints. import atg.some.Configuring Purchase Process Services .package.*. The new PaymentGroup allows you to distinguish StorePoints from other payment groups and to store data relating to the store points system. public class StorePoints extends PaymentGroupImpl { public StorePoints() { } public String getUserId() { return (String) getPropertyValue("userId").order.commerce. 358 11 . package store. The following code sample is an example of the StorePoints PaymentGroup.

processor.*. debit.payment. the default payment pipelines are composed of two processors. and credit methods of the StorePointsProcessor interface all return a StorePointsStatus object.creditCardProcessor.commerce.payment. write the StorePointsProcessor interface that defines the authorize().a pipeline processor to create the XXXInfo object for the StorePoints PaymentGroup.intValue(). This object is discussed in more detail later in this section.commerce. import atg. CREDIT) and creates an XXXInfo object (for example.processor.ATG Commerce Programming Guide µ } public void setUserId(String pUserId) { setPropertyValue("userId". package store. or crediting the appropriate payment method. } public int getNumberOfPoints() { return ((Integer) getPropertyValue("numberOfPoints")). The ProcessCreditCard processor calls through to a CreditCardProcessor object to perform the actual operations. debiting.ProcCreateCreditCardInfo) and the ProcessCreditCard processor (class atg. and credit() methods for the StorePoints PaymentGroup. debit(). you need to implement similar processors -.payment. the creditCardProcessorChain pipeline is composed of the CreateCreditCardInfo processor (class atg. The first processor aggregates the necessary information for performing the requested payment action (for example.Configuring Purchase Process Services . Note that the authorize. CreditCardInfo) for use in that action. new Integer(pNumberOfPoints)). as shown in the following code example. The second processor actually performs the operation – authorizing. First.some. pUserId). public interface StorePointsProcessor { /** 359 11 . For example. which points to an object instantiated from a class that implements the atg. } public void setNumberOfPoints(int pNumberOfPoints) { setPropertyValue("numberOfPoints".ProcProcessCreditCard). The specific object used to perform the actual operations is retrieved from PaymentManager. For the StorePoints PaymentGroup.payment.CreditCardProcessor interface. and credit the StorePoints PaymentGroup. and a processor that implements a StorePointsProcessor interface and actually performs the payment operations.creditcard. which represents the transaction on the StorePoints PaymentGroup. a second pipeline processor to authorize.package. debit. } } Implementing Processors for the New PaymentGroup As previously mentioned.

/** * Debit the amount in StorePoints after authorization * * @param pStorePointsInfo the StorePointsInfo reference which contains * all the debit data * @param pStatus the StorePointsStatus object which contains * information about the transaction.µ ATG Commerce Programming Guide * Authorize the amount in StorePoints * * @param pStorePointsInfo the StorePointsInfo reference which contains * all the authorization data * @return a StorePointsStatus object detailing the results of the * authorization */ public StorePointsStatus authorize(StorePointsInfo pStorePointsInfo). This should be the object * which was returned from authorize(). This should be the object * which was returned from debit(). write an implementation of the StorePointsProcessor interface named StorePointsProcessorImpl. * @return a StorePointsStatus object detailing the results of the * credit */ public StorePointsStatus credit(StorePointsInfo pStorePointsInfo. /** * Credit the amount in StorePoints outside the context of an Order * * @param pStorePointsInfo the StorePointsInfo reference which contains * all the credit data * @return a StorePointsStatus object detailing the results of the * credit */ public StorePointsStatus credit(StorePointsInfo pStorePointsInfo). StorePointsProcessorImpl must work with the resources needed to 360 11 . * @return a StorePointsStatus object detailing the results of the debit */ public StorePointsStatus debit(StorePointsInfo pStorePointsInfo. StorePointsStatus pStatus). /** * Credit the amount in StorePoints after debiting * * @param pStorePointsInfo the StorePointsInfo reference which contains * all the credit data * @param pStatus the StorePointsStatus object which contains * information about the transaction.Configuring Purchase Process Services . } Second. StorePointsStatus pStatus).

} return authorize(spi). Note in the code sample that the authorize. * 361 11 . For example. For a different custom payment method. which represents the results of transaction performed by the pipeline. the implementation must work with whatever 3rd-party resources are needed to carry out the transactions. } catch (ClassCastException cce) { if (isLoggingError()) logError("Expecting class of type StorePointsInfo but got: " + pParams. debit. transactionSuccess. and credit methods of StorePointsProcessorImpl all return a PaymentStatus object. It is discussed in more detail later in this section. then its methods must operate against that table. You can assume that StorePointsProcessorImpl extends GenericService and.ATG Commerce Programming Guide µ carry out the transactions. Recall that a PaymentStatus object contains properties such as amount. therefore.Configuring Purchase Process Services . and transactionTimestamp. reading and writing values to reflect the operation. if the customer’s points data are stored in a database table.getPaymentInfo(). errorMessage.getName()). an example of an implementation of the StorePointsProcessor interface. transactionId. can use standard ATG Commerce logging calls. try { spi = (StorePointsInfo)pParams. * * @param pParams PaymentManagerPipelineArgs object which contains the * StorePointsInfo object.getClass(). throw cce. } /** * This method will obtain the <code>StorePointsInfo</code> object from * the pParams parameter and invoke the {@link #debit<code>debit</code>} * method. The following code sample is taken from the StorePointsProcessorImpl class.getPaymentInfo(). /** * This method will obtain the <code>StorePointsInfo</code> object from * the pParams parameter and invoke the * {@link #authorize<code>authorize</code>} method. * @return a PaymentStatus object that will detail the authorize details * @exception CommerceException if an error occurs */ public PaymentStatus authorizePaymentGroup(PaymentManagerPipelineArgs pParams) throws CommerceException { StorePointsInfo spi = null.

* @return a PaymentStatus object that will detail the debit details * @exception CommerceException if an error occurs */ public PaymentStatus debitPaymentGroup(PaymentManagerPipelineArgs pParams) throws CommerceException { StorePointsInfo spi = null.Configuring Purchase Process Services . } return debit(spi.getName()).getPaymentGroup(). } StorePointsStatus authStatus = null. logError("Expecting class of type StorePointsStatus but got: " + authStatusClassName). try { spi = (StorePointsInfo)pParams. try { authStatus = (StorePointsStatus) pParams.getN ame(). } throw cce. PaymentGroup and StorePointsStatus object. throw cce. authStatus).getPaymentInfo().getPaymentManager().getClass(). } /** * This method will obtain the <code>StorePointsInfo</code> object from * the pParams parameter and invoke the * {@link #credit<code>credit</code>} method. PaymentGroup pg = pParams.getClass().getLastAuthorizationStatus(pg). 362 11 .getPaymentInfo().getLastAuthorizationStatus(pg). * * @param pParams PaymentManagerPipelineArgs object which contains the * StorePointsInfo. } catch (ClassCastException cce) { if (isLoggingError()) { String authStatusClassName = pParams. } catch (ClassCastException cce) { if (isLoggingError()) logError("Expecting class of type StorePointsInfo but got: " + pParams.µ ATG Commerce Programming Guide * @param pParams PaymentManagerPipelineArgs object which contains the * StorePointsInfo and StorePointsStatus objects.getPaymentManager().

getPaymentGroup(). } return credit(spi. } catch (ClassCastException cce) { if (isLoggingError()) { String debitStatusClassName = pParams.getPaymentManager(). PaymentGroup pg = pParams.processor.getPaymentInfo(). This abstract class is atg.getLastDebitStatus(pg).getName(). throw cce. You might call this pipeline processor class ProcProcessStorePoints. it must also implement the atg.getName()). } StorePointsStatus debitStatus = null.payment. Because the implementation will be called within the context of a pipeline. you only need to define three abstract methods: 363 11 .PipelineProcessor interface. logError("Expecting class of type StorePointsStatus but got: " + debitStatusClassName). } catch (ClassCastException cce) { if (isLoggingError()) logError("Expecting class of type StorePointsInfo but got: " + pParams.getLastDebitStatus(pg).pipeline. ATG Commerce provides an abstract class that implements both the PipelineProcessor interface and several other helper methods that determine what action is requested (authorize.ProcProcessPaymentGroup.Configuring Purchase Process Services . debit. By extending ProcProcessPaymentGroup.getPaymentManager().getClass(). } throw cce.ATG Commerce Programming Guide µ * @return a PaymentStatus object that will detail the credit details * @exception CommerceException if an error occurs */ public PaymentStatus creditPaymentGroup(PaymentManagerPipelineArgs pParams) throws CommerceException { StorePointsInfo spi = null.getClass(). or credit) and then dispatch to the appropriate method call. } Third.getPaymentInfo(). debitStatus).commerce. implement a pipeline processor that performs the payment transactions for the StorePoints PaymentGroup by calling through to StorePointsProcessorImpl. try { spi = (StorePointsInfo)pParams.service. try { debitStatus = (StorePointsStatus) pParams.

package store. implement the ProcCreateStorePointsInfo processor that must construct the StorePointsInfo object and add it to the PaymentManagerPipelineArgs Dictionary object. Additionally. passing in the data from the PaymentManagerPipelineArgs object that is supplied as a parameter. debitPaymentGroup() and creditPaymentGroup(). The StorePointsInfo object must hold all of the data required by the methods in StorePointsProcessorImpl.package.µ ATG Commerce Programming Guide authorizePaymentGroup(). a previous pipeline processor must aggregate the necessary information for performing the requested payment action. before the ProcProcessStorePoints pipeline processor is invoked. ProcProcessStorePoints should include an additional property named storePointsProcessor that can be set to the StorePointsProcessor object that actually performs the payment operations.some.Configuring Purchase Process Services . As 364 11 .storePointsProcessor would be set StorePointsProcessorImpl. public int getNumberOfPoints() { return mNumberOfPoints. These methods should call through to their respective methods in the StorePointsProcessorImpl object. public class StorePointsInfo { public StorePointsInfo() { } private String mUserId = null. public String getUserId() { return mUserId. create an XXXInfo object for use in that action. Instead. The Dictionary object is then passed as an argument “downstream” to the ProcProcessStorePoints pipeline processor and on to the StorePointsProcessorImpl processor. In this StorePoints example. } } Next. and the processor that creates it might be called ProcCreateStorePointsInfo. Recall from the previous code example of StorePointsProcessorImpl that the StorePoints PaymentGroup itself is not passed as a parameter to the StorePointsProcessorImpl processor. This keeps the payment processors independent of the commerce objects in ATG Commerce. The following code sample is an example of the StorePointsInfo class. } public void setNumberOfPoints(int pNumberOfPoints) { mNumberOfPoints = pNumberOfPoints. ProcProcessStorePoints. } private int mNumberOfPoints = 0. and finally add the XXXInfo object to the PaymentManagerPipelineArgs Dictionary object. } public void setUserId(String pUserId) { mUserId = pUserId. the XXXInfo object might be called StorePointsInfo. In this example. It might hold a user ID (Profile ID) and the number of points for the operation.

service.package.getPaymentInfo()</code>.service.some. * */ public class ProcCreateStorePointsInfo extends GenericService implements PipelineProcessor { /** The possible return value for this processor. /** * Return the class to instantiate when creating a new StorePointsInfo * object. **/ public String getStorePointsInfoClass() { return mStorePointsInfoClass. atg.pipeline. * * <p>This processor is designed so that the StorePointsInfo class can * easily be extended.nucleus. See * {@link #setStorePointsInfoClass "<code>setStorePointsInfoClass</code>"} * and * {@link #addDataToStorePoints "<code>addDataToStorePointsInfo</code>"} * for more information.PipelineProcessor interface because the implementation will be called within the context of a pipeline. It places them into the pipeline argument dictionary so * that downstream pipeline processors can retrieve them by calling * <code>PaymentManagerPipelineArgs.*. 365 11 .commerce.GenericService. /** * This pipeline processor element is called to create generic * StorePointsInfo objects from instances of the StorePoints * payment group.StorePointsInfo". the ProcCreateStorePointsInfo class must implement the atg.ATG Commerce Programming Guide µ with the StorePointsProcessorImpl class.service.Configuring Purchase Process Services . atg. atg.pipeline.pipeline.payment.PipelineResult.order.PipelineProcessor. //--------------------------------------------------------------------// property: StorePointsInfoClass String mStorePointsInfoClass = "store.*. import import import import import atg. package store. **/ public static final int SUCCESS = 1.some.commerce. The following code sample is an example of the ProcCreateStorePointsInfo class.package. atg.

double pAmount. * * @param pOrder * The order being paid for.getUserId()). PaymentManagerPipelineArgs pParams.µ } ATG Commerce Programming Guide /** * Specify the class to instantiate when creating a new StorePointsInfo * object.setNumberOfPoints(pPaymentGroup. pStorePointsInfo.getNumberOfPoints()).setUserId(pPaymentGroup. and this method can be overridden * to add data for the new properties (or another pipeline processor * could be added after this processor to populate the additional * properties). * @param pAmount * The amount being authorized. debited.Configuring Purchase Process Services . If the additional data is required. **/ public void setStorePointsInfoClass(String pStorePointsInfoClass) { mStorePointsInfoClass = pStorePointsInfoClass. StorePoints pPaymentGroup. **/ protected void addDataToStorePointsInfo(Order pOrder. If the <code>StorePointsInfo</code> class is extended to * include more information. a subclass of * <code>StorePointsInfo</code> can be created with additional * properties. } //---------------------------------------------------------------------/** 366 11 . or credited * @param pParams * The parameter dictionary passed to this pipeline processor * @param pStorePointsInfo * An object that holds information understood by the store * points payment processor. the <code>storePointsInfoClass</code> property can be * changed to specify the new class. this property can be changed to reflect the * new class. StorePointsInfo pStorePointsInfo) { pStorePointsInfo. * @param pPaymentGroup * The payment group being processed. } //---------------------------------------------------------------------/** * This method populates the <code>StorePointsInfo</code> object with * data.

return spi. * @throws Exception * If any error occurs creating or populating the store points info * object. * * @param pParam * Parameter dictionary of type PaymentManagerPipelineArgs. populate it with data from a * <code>StorePoints</code> payment group by calling * <code>addDataToStorePointsInfo</code>. and add it to the pipeline * argument dictionary so that downstream pipeline processors can access * it. * @param pResult * Pipeline result object. **/ public int runProcess(Object pParam.some. PipelineResult pResult) throws Exception { 367 11 . and must be a subclass * of <code>store. } //---------------------------------------------------------------------/** * Generate a StorePointsInfo object of the class specified by * <code>StorePointsInfoClass</code>. StorePointsInfo spi = (StorePointsInfo) Class.StorePointsInfo</code> * * @return * An object of the class specified by * <code>storePointsInfoClass</code> * @throws Exception * if any instantiation error occurs when creating the info object **/ protected StorePointsInfo getStorePointsInfo() throws Exception { if (isLoggingDebug()) logDebug("Making a new instance of type: " + getStorePointsInfoClass()).package.forName(getStorePointsInfoClass()). The class * that is created is that specified by the * <code>storePointsInfoClass</code> property.newInstance().Configuring Purchase Process Services . * @return * An integer value used to determine which pipeline processor is * called next. not used by this method.ATG Commerce Programming Guide µ * Factory method to create a new StorePointsInfo object.

as PaymentStatusImpl does.getOrder(). The specific list to which it is added depends on the operation.getAmount(). // create and populate store points info class StorePointsInfo spi = getStorePointsInfo(). params. PaymentStatus Property transactionId Type String Description A unique ID for the transaction that is generated by the payment processor. it adds it to one of the authorizationStatus. or creditStatus List objects in the PaymentGroup. * always returns a success code.toString()). params.payment. debitStatus. Order order = params. **/ public int[] getRetCodes() { int retCodes[] = {SUCCESS}. all operations must return an object that implements the PaymentStatus interface. if (isLoggingDebug()) logDebug("Putting StorePointsInfo object into pipeline: " + spi. Follow the steps in Extending the Purchase Process to ensure that objects are persisted properly.Configuring Purchase Process Services . } This processor As previously mentioned. spi). you should extend PaymentStatusImpl. return retCodes. } //---------------------------------------------------------------------/** * Return the possible return values for this processor. when you implement StorePointsStatus. Therefore. return SUCCESS. Because none of the StorePointsProcessor methods throw exceptions. When the PaymentManager gets this object. which implements the atg. The following table describes the properties in the PaymentStatus interface. the StorePointsStatus object represents a transaction on a StorePoints PaymentGroup. addDataToStorePointsInfo(order. storePoints.µ ATG Commerce Programming Guide PaymentManagerPipelineArgs params = (PaymentManagerPipelineArgs)pParam.getPaymentGroup().PaymentStatus interface. 368 11 . amount.setPaymentInfo(spi). StorePoints storePoints = (StorePoints)params. double amount = params.

If transactionSuccess is false. Configure the PaymentManager to invoke the pipeline when an operation is requested on a StorePoints PaymentGroup. and credits.*. See the sections that follow for details. All properties in this object must have values. The most important property is transactionSuccess. Creating the Pipeline To create the pipeline that creates the StorePointsInfo objects and performs actions on the StorePoints PaymentGroup: 369 11 . package store. The time that the transaction was executed.ATG Commerce Programming Guide µ The amount of the transaction.payment.package. 2.Configuring Purchase Process Services . True indicates that the transaction succeeded. public class StorePointsStatus extends PaymentStatusImpl { public StorePointsStatus() { } private String mConfirmationNumber = null. amount transactionSuccess double boolean errorMessage transactionTimestamp String Date Below is an example of the StorePointsStatus class. False indicates that it failed. Create the pipeline that creates StorePointsInfo objects and processes the StorePoints PaymentGroup for authorization. This involves two steps: 1. A detailed error message about the failure. public String getConfirmationNumber() { return mConfirmationNumber. debits.some. Indicates whether the transaction was successful. } } Integrating the New Payment Processors into the PaymentManager Integrating the new payment processors that you created in step 2 for the StorePoints PaymentGroup. } public void setConfirmationNumber(String pConfirmationNumber) { mConfirmationNumber = pConfirmationNumber. then an exception is thrown with the message in the errorMessage property. import atg.

debit.This chain is used to process a store point payment group--> <!-. This XML file should define the single pipeline that operates on StorePoints PaymentGroups.package.some.storePointsProcessor property is set to the StorePointsProcessor object that actually performs the payment operations.payment group. Define the storePointsProcessorChain pipeline and add it to the pipelines used by the /atg/commerce/payment/PaymentPipelineManager. ProcessStorePoints calls through to this object to perform the operations.xml. Create a Nucleus component for the StorePointsProcessorImpl object. To create a Nucleus component located at /store/payment/processor/ProcessStorePoints.some.package.StorePointsInfo 2.ProcProcessStorePoints $scope=global storePointsProcessor=/store/payment/StorePointsProcessorImpl Note that the ProcessStorePoints. create a paymentpipeline. To create a Nucleus component located at /store/payment/processor/CreateStorePointsInfo. create a Nucleus component for the ProcProcessStorePoints object.package. create a Nucleus component for the ProcCreateStorePointsInfo object. it would be set to the StorePointsProcessorImpl Nucleus component.some. it will be combined with the existing XML definition of payment pipelines using XML file combination. To do this. To do this. 3.StorePointsProcessorImpl $scope=global 4. Configure a pipeline processor to authorize.some.package. To create a Nucleus component located at /store/payment/StorePointsProcessor. In this example. place the following properties file into Nucleus at that path: $class=store. This is the object that actual performs the payment operations on the StorePoints payment method.Configuring Purchase Process Services . place the following properties file into Nucleus at that path: $class=store.xml file in Nucleus at /atg/commerce/payment/paymentpipeline. The following is a code example of the storePointsProcessorChain pipeline: <pipelinemanager> <!-. and credit the StorePoints payment method.This single chain knows how to auth/credit/debit a --> <!-. ATG Commerce Programming Guide Configure a pipeline processor to create the StorePointsInfo object. It also creates the StorePointInfo object--> <pipelinechain name="storePointProcessorChain" transaction="TX_REQUIRED" headlink="createStorePointInfo"> <pipelinelink name="createStorePointInfo" transaction="TX_MANDATORY"> <processor jndi="/store/payment/processor/CreateStorePointInfo"/> <transition returnvalue="1" link="processStorePoints"/> 370 11 .µ 1.ProcCreateStorePointsInfo $scope=global storePointsInfoClass=store. place the following properties file into Nucleus at that path: $class=store. To do this.

for the StorePoints payment method you might want to make sure that the number of points specified is greater than zero. You might also want to include other validation logic – for example. you might decide that users cannot apply more than 500 store points to any order. The validateForCheckout pipeline includes a ValidatePaymentGroupsForCheckout processor. which iterates over the payment groups in the Order and calls the validatePaymentGroup pipeline for each one to verify that the payment group is ready for checkout. If you have implemented a custom payment method.paymentGroupToChainNameMap. When a user checks out an Order. You can test all of these conditions in a custom validation component for the StorePoints payment group. and that store points may not be used to pay for more than 25% of the order price.some. the ATG Commerce purchase process performs validation checks on all of the payment groups in the Order by executing the validateForCheckout pipeline.ATG Commerce Programming Guide µ </pipelinelink> <pipelinelink name="processStorePoints" transaction="TX_MANDATORY"> <processor jndi="/store/payment/processor/ProcessStorePoints"/> </pipelinelink> </pipelinechain> </pipelinemanager> Configure the PaymentManager to Invoke the StorePointsProcessorChain To configure the PaymentManager to invoke the storePointsProcessorChain pipeline when an operation is requested on a StorePoints PaymentGroup.StorePoints=storePointsProc essorChain Extending Order Validation to Support New Payment Methods Note: You can also follow this process to extend shipping group validation. Adding validation for your new payment method involves four steps: 371 11 . layer on a configuration file that makes an additional entry to the paymentGroupToChainNameMap property. The validatePaymentGroup pipeline begins with a processor that examines the type of the current PaymentGroup and transfers control to a pipeline processor appropriate to that type.Configuring Purchase Process Services .paymentGroupToChainNameMap. which is defined in commercepipeline. such as the StorePoints payment method described in detail in the previous section. The paymentGroupToChainNameMap property stores a mapping of PaymentGroup class names to the names of the pipelines to invoke when an operation for those PaymentGroups is requested. Credit cards are checked by one processor. you may want to perform validation on the custom payment method during checkout.package. gift certificates by another. you need to add a new entry to PaymentManager. store credits by still another. You can add your own pipeline processor to check the custom payment groups that you create. To add a new entry to PaymentManager.xml. For example. The new configuration file would be located in Nucleus at /atg/commerce/payment/PaymentManager and would look like the following: PaymentGroupToChainNameMap+=Store.

which consists of two methods: • • public int[] getRetCodes(). Step 4: Add the custom payment method to the validatePaymentGroup pipeline. public class ValidateStorePoints extends GenericService implements PipelineProcessor { private static int SUCCESS_CODE = 1. Recall that your processor must implement the interface atg.*. This processor always returns a single value * indicating success. } /** 372 11 .PipelineProcessor. import import import import atg. private static int[] RETURN_CODES = { SUCCESS_CODE }.µ ATG Commerce Programming Guide Step 1: Implement a validation pipeline processor.GenericService.pipeline. This subsections that follow describe each step in detail. **/ public int[] getRetCodes() { return RETURN_CODES.service.payment.pipeline. atg. Step 3: Add the custom payment method to the ValidatePaymentGroupByType processor. Step 2: Create an instance of the processor. using the StorePoints payment group that you created in the previous section as an example. In case of errors.commerce. public int runProcess(Object pParam. atg.service.ValidatePaymentGroupArgs.order. store. Step 1: Implement a validation pipeline processor The first step in validating your custom payment method is to write a pipeline processor that examines a payment group and determines whether it meets the criteria for use in the Order.StorePoints. PipelineResult pResult) throws Exception. /** * Return the list of possible return values from this * processor.nucleus. A validation processor for StorePoints might look similar to the following: package store. it adds messages * to the pipeline result object.checkout.Configuring Purchase Process Services .processor.

getPriceInfo()."). "Store points cannot pay for more than 25% of an order. PaymentGroup pg = args.").getNumberOfPoints(). // Dynamo guarantees that the pipeline parameter object // passed to a payment group validation processor will be // of type ValidatePaymentGroupPipelineArgs. int nPoints = points. // // // // // Now try casting the payment group to the type we expect and validating the fields. "The number of points should be greater than zero. else if (nPoints > 500) pResult. add an error // to the pipeline result before returning.Configuring Purchase Process Services . if (nPoints <= 0) pResult.addError( "NoPointsUsed". // Log some debugging info about the number of points // and the total order price. add an error to the pipeline result so the order manager will abort the checkout process. or if anything else goes wrong. try { StorePoints points = (StorePoints)pg. If the payment group is of the wrong type. // Are we using more than 500 points or trying to pay // for more than 25% of the order? If so. double orderPrice = order.getOrder().addError( "TooManyPointsUsed".getPaymentGroup(). if (isLoggingDebug()) logDebug("Applying " + nPoints + " store points " + " to an order totaling " + orderPrice). "A maximum of 500 points can be used per order."). Order order = args. args = (ValidatePaymentGroupPipelineArgs)pParam.25) pResult.getTotal(). else if (nPoints > orderPrice * . **/ public int runProcess(Object pParam.addError( "PointsValueExceeded". PipelineResult pResult) { ValidatePaymentGroupPipelineArgs args.ATG Commerce Programming Guide µ * Perform validation for a StorePoints payment group. 373 11 .

For the StorePoints example.Configuring Purchase Process Services .ValidateStorePoints loggingDebug=true In this simple example the processor doesn’t require any additional property settings. which maps your payment method’s name (storePoints in this example) to a unique return value. and the server’s Locale from the pipeline parameter map. } } Note the use of the ValidatePaymentGroupPipelineArgs class in the runProcess() method. you must configure an instance of the processor in Nucleus. The validatePaymentGroup pipeline begins with a pipeline processor called ValidatePaymentGroupByType.properties: # Add a return code for the storePoints payment method returnValues+=\ storePoints=10 374 11 . This provides you with a convenient way to retrieve items like the Order.µ ATG Commerce Programming Guide } catch (ClassCastException cce) { pResult. You can use any return value as long as it isn’t used by any other payment method. Configure the property by creating a file as follows in localconfig/atg/commerce/order/processor/ValidatePaymentGroupByType. it guarantees that the pipeline arguments passed to your processor are an instance of this class.checkout. To add support for your payment method. and it is configured with the following properties file: # Store Points validation processor $class=store. This example uses a value of 10. the PaymentGroup.getName() + " instead. the validation processor might be located at /store/checkout/ValidateStorePoints.getClass(). Step 2: Create an instance of the processor After implementing your pipeline processor.addError( "ClassNotRecognized". "Expected a StorePoints payment group. the OrderManager. } return SUCCESS_CODE."). The pipeline then dispatches control to one of a number of different processors based on this return code. Step 3: Add the custom payment method to the ValidatePaymentGroupByType processor Recall that payment groups are validated at checkout by invoking the validatePaymentGroup pipeline for each payment group in the order. When the OrderManager validates payment groups. but got " + pg. which examines the type of each payment group and returns an Integer that identifies the payment method. you must add an entry to ValidatePaymentGroupByType’s returnValues property.

or to construct and save orders to be placed at a later date. storePoints. it is not the name of your payment group’s implementation class. Scheduling Recurring Orders Sites often require the functionality to create orders to be fulfilled repeatedly on a specific schedule. Step 4: Add the custom payment method to the validatePaymentGroup pipeline The final step in adding validation for your StorePoints payment method is to reconfigure the validatePaymentGroup pipeline so it invokes the ValidateStorePoints processor when ValidatePaymentGroupByType returns a value of 10. define the new pipeline link and configure it to invoke your ValidateStorePoints component. Second. The template Order object is a typical Order in the orderRepository. a scheduled Order object (of type scheduledOrder) maintains the schedule information for the scheduled order. the template order is cloned. but simply serves as a prototype. In ATG Commerce. Modify the pipeline using the following code in localconfig/atg/commerce/commercepipeline. but it has a state of TEMPLATE. Consequently. First. You can do both steps using XML combination facilities.Configuring Purchase Process Services . is the name you added to the paymentTypeClassMap in the OrderTools component. You can use ATG Commerce to support these requirements through the use of scheduled orders. This requires two changes to the pipeline configuration.validation for payment groups of type storePoints --> <pipelinemanager> <pipelinechain name="validatePaymentGroup"> <pipelinelink name="dispatchOnPGType"> <transition returnvalue="10" link="validateStorePoints"/> </pipelinelink> <pipelinelink name="validateStorePoints"> <processor jndi="/store/checkout/ValidateStorePoints"/> </pipelinelink> </pipelinechain> </pipelinemanager> ATG Commerce will now perform validation on your StorePoints payment method. and the cloned order is checked out and sent to Fulfillment. When a scheduled order is placed.ATG Commerce Programming Guide µ Note that the payment method name.Modify the validatePaymentGroup chain to include --> <!-.xml: <!-. 375 11 . add a new transition tag to the dispatchOnPGType pipeline link in order to specify the pipeline link to use when ValidatePaymentGroupByType returns a value of 10. the template Order is never processed. and a template Order object maintains the order information for the scheduled order.

Configuring Purchase Process Services .µ ATG Commerce Programming Guide Template orders must include enough information. Note: If unset. see the Scheduling Orders section of the My Account chapter in the ATG Business Commerce Reference Application Guide. A previously processed order or even the user’s shopping cart (once the shipping and payment information has been specified) can be used to create a template order. as well as extra information as defined by the scheduledOrder item descriptor (for example.xml. state clonedOrders schedule nextScheduledRun createDate startDate endDate 376 11 . By default. The profile ID of the user who created the scheduled Order. A string describing the Order’s placement schedule. This section describes the ATG Commerce framework that supports scheduled orders and includes the following subsections: Understanding the scheduledOrder Repository Item Submitting Scheduled Orders Creating. The scheduledOrder item descriptor is defined in /<ATG9dir>/B2BCommerce/atg/commerce/order/orderRepository. the scheduled Order is repeatedly placed indefinitely. or error). The date and time that the scheduled Order becomes inactive. The state of the scheduled Order (active. The ID of the template Order that is cloned whenever the scheduled order is placed. Modifying. maintain the schedule information for scheduled orders. a scheduledOrder repository item contains the following properties: Property name profileId templateOrderId Description The name that the user has assigned to the scheduled Order. These Orders are clones of the template Order that have been checked out. to process the cloned Order without further user interaction. Understanding the scheduledOrder Repository Item The scheduled Order objects. stored in the Order Repository. The date and time that the scheduled Order becomes active. The next date and time that the scheduled Order should be placed. such as all necessary shipping and payment information. The list of scheduled orders that have been placed. name and state). The date and time that the scheduled Order was created. inactive. and Deleting Scheduled Orders For an example implementation of scheduled orders.

If the maxThreads parameter is kept at the default of 1. all orders will be processed in the main thread. However. maxThreads Submitting Scheduled Orders The ScheduledOrderService is the back-end service that polls the Order Repository at a periodic interval and submits scheduled Orders according to their schedules. If the lock is obtained successfully.performScheduledTask(). the state of the scheduled Order is set to Error. you can specify the number of threads that are started to process scheduled orders. machine and database speed and the complexity of the scheduled order templates. the Scheduler calls ScheduledOrderService. The system updates this read-only property automatically. The ScheduledOrderService then attempts to obtain a global write lock from the server lock manager. For each scheduled Order it finds due for checkout. a PlaceScheduledOrders task is scheduled with the /atg/dynamo/service/Scheduler. This is set to scheduledOrder. then a CommerceException is thrown. By setting the parameter maxThreads to a number greater than 1.ATG Commerce Programming Guide µ id type Version The ID of the scheduled Order object. checks out the cloned Order. The type of repository item. At a general level.doScheduledTask() method polls the Order Repository for all scheduled Orders that should be checked out. When an application that includes ATG Commerce deploys. A read-only property. the ScheduledOrderService. the remaining scheduled Orders are processed. A value used to protect against data corruption that might be caused if two users attempt to edit this repository item at the same time. The optimal number of threads depends on a variety of factors. When the scheduled task is run.Configuring Purchase Process Services . it then clones the template Order associated with the scheduled Order. This scheduled task is run at the interval specified in ScheduledOrderService. and the state of the cloned Order is set to PENDING_MERCHANT_ACTION. The current implementation of the scheduled order service can be configured to employ multiple threads when placing orders. then it calls doScheduledTask(). and sets the nextScheduledRun property of the scheduled Order to the next date and time it should be checked out.schedule. including server load. If an error occurs when processing an individual scheduled Order. The following table describes the various methods of ScheduledOrderService that support this process: 377 11 .

set to scheduledOrder).” For information on how to specify a schedule. Other objects can call this method to trigger on demand a poll of the Order Repository for due scheduled Orders.orderRepository property with the repository view defined in the itemDescriptorName property (by default. The method returns an array of scheduled Orders that need to be checked out. 378 11 . Therefore. doScheduledTask Calls processDueScheduledOrders() to process any scheduled Orders that need to be checked out. The placeScheduledOrders task is run at the interval defined in ScheduledOrderService. (See the methods described later in this table for details. When this method is called. This method calls pollForNewOrders() to retrieve the list of scheduled Orders that need to be checked out. it is recommended that you set it to “every 1 day.schedule.µ Method performScheduledTask ATG Commerce Programming Guide Description Called when the Scheduler finds that the placeScheduledOrders task is scheduled to run.) processDueScheduledOrders pollForNewOrders Uses the query defined in the ScheduledOrderService. Processes all scheduled Orders that need to be checked out. as a general rule.” then the scheduled Order is never placed. While the schedule that you set depends on the business needs of your site.pollQuery property to poll the Order Repository defined in the ScheduledOrderService. and if the schedule property of a given scheduled Order is set to “every 12 hours. It then iterates through the array and calls processDueScheduledOrder() on each scheduled Order. the ATG Commerce server is redeployed every 11 hours. see the Scheduler Services section of the Core Dynamo Services chapter in the ATG Programming Guide. for example. Note: Be aware that the defined interval specified in ScheduledOrderService. the ScheduledOrderService calls its own doScheduledTask() method. If the lock is obtained successfully.Configuring Purchase Process Services .schedule begins when an application that includes ATG Commerce deploys. the ScheduledOrderService attempts to obtain a global write lock from the server lock manager. if.

which executes the updateOrder pipeline.repriceScheduledOrder(). it is passed on to Fulfillment.processOrder() and passes in the cloned Order and pipeline to execute. It will be retrieved again for processing the next time that pollForNewOrders() is executed. Third.) Finally. The default is false. the cloned Order is saved to the Order Repository in its present state by calling OrderManager. Fifth. Second. which in turn calls OrderManager. ScheduledOrderTools.ATG Commerce Programming Guide µ Processes the current scheduled Order.updateOrder(). the template Order is cloned by calling ScheduledOrderTools. then it rolls back to its original state. see Checking Out an Order in this chapter. This method calls placeScheduledOrder() to check out the scheduled Order. the cloned Order is checked out by calling ScheduledOrderTools.UseOrderPriceListsFirst identifies if price list information should be extracted from an order template.Configuring Purchase Process Services . if the ScheduledOrderTools. When the order placeScheduledOrder has been checked out successfully. If the scheduled Order is successfully checked out.cloneOrder().getTemplateOrder() and passing in the current scheduled Order. processDueScheduledOrder getNextScheduledRun Sets the next time that the scheduled Order should be checked out. see Updating an Order with the Order Manager in this chapter. Fourth. (For more information on the updateOrder pipeline. The pipeline to execute is set in ScheduledOrderTools. If the scheduled Order fails to be checked out.) 379 11 . the template Order is retrieved by calling ScheduledOrderTools. then the cloned order is repriced by calling ScheduledOrderTools. this property is set to processOrder.repriceOnClone property is set to True.processScheduledOrder(). by default. This method checks out the current scheduled Order using the following process: First. then the method calls getNextScheduledRun() to set its nextScheduledRun property to the next date and time that it should be checked out.processOrderChainId. (For more information on the processOrder pipeline.

µ repriceScheduledOrder ATG Commerce Programming Guide Reprices the cloned Order.repriceScheduledOrder(). Each property of a scheduled Order that maps to more then one form element or needs special processing is represented by an instance of the abstract class atg.service. Similarly.RepositoryFormHandler.servlet. For example. ATG Commerce provides an instance of atg. the schedule property maps to a large number of input fields. while guaranteeing that only one instance of the service will perform the scheduled task at any given time. Modifying.scheduler.Configuring Purchase Process Services .b2bcommerce. However.order.order. Date. deleting. see the Scheduler Services section of the Core Dynamo Services chapter in the ATG Programming Guide.) ATG Commerce provides an instance of class atg.commerce. other complex properties map to a large number of user input fields. activating. namely remapValueFromScheduledOrder() and remapValueFromUserInputField(). By default. you must run a server lock manager and point all client lock managers at it. this property is set to repriceOrder. The ScheduledOrderFormHandler. A scheduled Order has some complex properties that are incapable of being mapped directly from the user interface to the value Dictionary defined in the RepositoryFormHandler (of which ScheduledOrderHandler is a subclass).ComplexScheduledOrderProperty or one of its subclasses.b2bcommerce. It is located in Nucleus at /atg/commerce/order/scheduled/ScheduledOrderService.ScheduledOrderHandler. which extends atg.complexScheduledOrderProperties property is a Map that specifies the complex properties in the scheduled Order.SingletonSchedulableService enables multiple ATG Commerce servers to run the same scheduled service. Simple properties.scheduled. the startDate and endDate properties in the value Dictionary are both mapped to Year. It is located in Nucleus at /atg/commerce/order/scheduled/ScheduledOrderFormHandler.scheduler.scheduled. For more information on SingletonSchedulableService. since the loss of any single ATG Commerce server will not prevent the scheduled service from running on some other ATG Commerce server. Class atg. which executes the repricing pipeline specified in ScheduledOrderTools.scheduled. see the Commerce Processor Chains section. This provides a degree of protection from server failures. which extends atg.order.service. and Deleting Scheduled Orders The ScheduledOrderHandler is responsible for creating. The repriceScheduledOrder() method calls ScheduledOrderTools. To use a SingletonSchedulableService like ScheduledOrderService on multiple ATG Commerce instances. such as name and state. The keys to the Map are the names of the 380 11 .ScheduledOrderService. Month. can be handled by the superclass RepositoryFormHandler. and Hour input fields.repriceOrderChainId.repository. Creating. updating.SingletonSchedulableService. and deactivating scheduled orders. (For more information on the repriceOrder pipeline. The ComplexScheduledOrderProperty class has two methods that facilitate the mapping between the property in the value Dictionary and the corresponding user input fields in a form.

and the values are the names of the classes that represent those properties. readableSchedule and schedule. template ID (templateId) or profile ID (profileId).scheduled. When the user later views the scheduled Order. and the new template Order is assigned a new ID. The templateOrderId property contains a reference to the repository ID of the new template Order. Using a scheduled order item or ID.b2bcommerce. as shown in the following ScheduledOrderFormHandler.properties file: $class=atg.scheduled.order.order.b2bcommerce.b2bcommerce. ScheduledOrderLookup can be used to provide information on scheduled orders for a scheduled order ID (itemId).DateProperty.b2bcommerce.ScheduledOrderHandler $scope=session #From RepositoryFormHandler itemDescriptorName=scheduledOrder repository=/atg/commerce/order/OrderRepository requireIdOnCreate=false clearValueOnSet=true #From ScheduledOrderFormHandler localeService=/atg/userprofiling/LocaleService profile=/atg/userprofiling/Profile orderManager=/atg/commerce/order/OrderManager transactionManager=/atg/dynamo/transaction/TransactionManager scheduledOrderTools=ScheduledOrderTools complexScheduledOrderProperties=\ calendarSchedule=atg. Output parameters to ScheduledOrderInfo are scheduledOrderItem.scheduled.order.b2bcommerce.order.\ startDate=atg. Scheduling information can be displayed in different formats.\ endDate=atg. ScheduledOrderInfo can provide a reference to scheduled objects.\ templateOrderId=atg. Once a scheduled order template has been modified. When a user designates an existing Order as a template Order. The following table describes the important handle methods of ScheduledOrderFormHandler: 381 11 . which extends ComplexScheduledOrderProperty.scheduled.DateProperty.ATG Commerce Programming Guide µ complex properties. the existing Order is copied. this property loads the associated template Order represented by the templateOrderId. the scheduled order item and a readable string representation of the schedule.Configuring Purchase Process Services .TemplateOrderProperty Note that the templateOrderId property is represented by the TemplateOrderProperty class.CalendarSchedu leProperty. Output parameters include scheduledOrders and count.order.scheduled.

µ Method handleRepositoryId ATG Commerce Programming Guide Description Called when the user wants to review or update a scheduled Order. Deletes an existing scheduled Order from the Order Repository. and nextScheduledRun can all be set in the following manner: <dsp:form action="setName. handleCreate handleUpdate handleDelete handleRemove handleRestore Note that the ScheduledOrderFormHandler uses ScheduledOrderTools to fire events for all of the actions that are associated with these handle methods.properties file above. handleVerify Called when the user wants to review the input data for the scheduled Order before it is created in the Order Repository. see the Using Repository Form Handlers chapter of the ATG Page Developer’s Guide.name" type="text"/><br> <dsp:input bean="ScheduledOrderHandler. The method retrieves all of the property values for the scheduled Order with the ID set in ScheduledOrderFormHandler. Using the scheduledOrderFormHandler is very similar to using the RepositoryFormHandler. The following JSP example illustrates how to change these properties. using the month in the startDate as an example: 382 11 . (For more information on using the RepositoryFormHandler. the startDate and endDate complex properties of a scheduled Order are represented by the DateProperty class.Configuring Purchase Process Services .repositoryId.jsp"> new name : <dsp:input bean="ScheduledOrderHandler.update" value="update name" type="submit"/> </dsp:form> Complex properties of the scheduled Order are set according to the configuration of ScheduledOrderFormHandler. Inactivates an existing scheduled Order in the Order Repository by changing the state of the Order from ACTIVE to INACTIVE.value. throwing a form exception if one is invalid. As shown in the ScheduleOrderFormHandler. state. This method is called before the user interface is rendered to the user. Activates an existing scheduled Order in the Order Repository by changing the state of the Order from INACTIVE to ACTIVE.) Simple properties like name. Creates a scheduled Order in the Order Repository. This method validates the submitted values. It then populates the value Dictionary with the properties and finally remaps all the complex properties from the Order Repository to the user interface. Updates an existing scheduled Order in the Order Repository.complexScheduledOrderProperties property.

PeriodicScheduleProperty If used.startDate. and the schedule property is mapped to the user input form fields used by the PeriodicSchedule.update" value="update month" type="submit"/> </dsp:form> You can modify the schedule property of a scheduled Order in a similar manner.order.commerce. and the schedule property is mapped to the user input form fields used by the CalendarSchedule.commerce.update" value="Update" type="submit"/> </dsp:form> 383 11 .Configuring Purchase Process Services . In this example. the frequency of a schedule whose scheduledMode is Monthly is updated: <dsp:form action="setSchedule.order.jsp"> New start month : <dsp:input bean="ScheduledOrderFormHandler. at 2:30 AM on the 1st and 15th of every month). </dsp:select> … <dsp:input bean="ScheduledOrderFormHandler. the schedule property is represented by a PeriodicSchedule.complexScheduledOrderMap.calendarSchedule. • atg. A PeriodicSchedule specifies a task that occurs at regular intervals (for example. userInputFields.scheduled.jsp"> … <dsp:select bean="ScheduledOrderFormHandler.order. Two classes in package atg.CalendarScheduleProperty If used. A CalendarSchedule specifies a task that occurs according to units of the calendar and clock (for example. every 10 seconds in 20 minutes without catch up). The following JSP example illustrates how to change the schedule property.scheduled. the schedule property is represented by a CalendarSchedule.value.commerce.month" type="text"/> <br> <dsp:input bean="ScheduledOrderFormHandler. <dsp:option value="biMonthly"/>every two months. <dsp:option value="quarterly"/>every quarter.scheduleMode" size="1" name="select"> <dsp:option value="onceMonthly"/>once a month.scheduled can represent the schedule property of a scheduled Order: • atg.ATG Commerce Programming Guide µ <dsp:form action="setStartDateMonth.

Rule class represents a rule. RuleEvaluator. >.expression: • • • • Rule. <. such as the following: Order. a given item might be prohibited from sale in certain locations. ExpressionParser. In some situations you may want to prevent an order from being placed.commerce. or you may want to ensure that customers order a minimum quantity of a given item. >=. For more information on CalendarSchedule and PeriodicSchedule. !=.specialInstructions. <=. and containsKey. see the Scheduler Services section of the Core Dynamo Services chapter in the ATG Programming Guide.µ Setting Restrictions on Orders ATG Commerce Programming Guide For more information on CalendarScheduleProperty and PeriodicScheduleProperty.amount > Profile. It does not support & (and) or | (or). which represents the rule.expression. For example.id = null Order. Rule The atg. The functionality for this Order restriction system relies on the following ATG Commerce classes in package atg.expression. or you may want to designate some items as requiring approval for purchase.commerce. ProcPropertyRestriction. This section describes the order restriction system in ATG Commerce and includes the following subsections: Understanding the Order Restriction Classes Implementing Order Restrictions Understanding the Order Restriction Classes You set restrictions on Orders by specifying the criteria or “rules” that an Order must meet if it is to be placed. contains. thereby setting restrictions on certain kinds of orders.priceInfo. see the ATG API Reference.approvalRequired = true Order. You can use ATG Commerce to specify criteria that orders must meet if they are to be placed. which evaluates the rule using the ExpressionParser and RuleEvaluator. which parses the expression (rule).Configuring Purchase Process Services .maxAmountAllowed Profile. A Rule object contains RuleExpressions (operands) and an operator.size != 1000 384 11 . The ExpressionParser. ExpressionParser supports the following operators: =. which evaluates the expression to either to True or False.parseExpression() method takes a string containing an expression to parse.shippingInfo.ExpressionParser class is used to parse expressions. which together are evaluated to either True or False. ExpressionParser The atg.commerce.

(See the table below for more information on these properties. which is located in Nucleus at /atg/commerce/util/. if the expression evaluates to True and the addErrorToResultOnTrueEval property is set to True.RuleEvaluator class is used to evaluate a given rule. The RuleEvaluator. double.commerce. such as Order.commerce.priceInfo. The RuleEvaluator class supports all primitive data types in Java. which is then passed to the RuleEvaluator for evaluation. it returns a Rule object and passes it to the RuleEvaluator. The ExpressionParser Nucleus component. then an EvaluationExpression is thrown.expression.expression.commerce. the ProcPropertyRestriction processor creates a new instance of atg. short.Configuring Purchase Process Services .ruleExpression using the ExpressionParser and then evaluates the rule using the RuleEvaluator. keyed by the string in the pipelineResultErrorMessageKey property. The processor then returns a value based on whether the rule evaluates to True or False. If null.expression.ATG Commerce Programming Guide µ After parsing the expression. ProcPropertyRestriction The atg. which is located in Nucleus at /atg/commerce/util/. RuleEvaluator The atg. The specific value returned is determined by its returnValueForTrueEvaluation and returnValueForFalseEvaluation properties. boolean.ExpressionParser for its use. then the value in the errorMessage property is added to the PipelineResult object. If two incompatible data types are evaluated. This is the rule against which the processor evaluates the Order. the parseExpression() method returns a Rule object. such as a double and boolean. These are long. ATG Commerce provides a globally-scoped instance of RuleEvaluator.0.ProcPropertyRestriction class resolves all references in the rule set in ProcPropertyRestriction.amount > 1000.) The ProcPropertyRestriction processor has the following properties: Property ruleExpression Description The expression that is passed to the ExpressionParser.evaluateRule() method then evaluates the rule to True or False. int. expressionParser 385 11 . Additionally. and String. ATG Commerce provides a globally-scoped instance of ExpressionParser. After the ExpressionParser parses an expression. float. char.

commerce. The key to use when adding the errorMessage to the PipelineResult object. 386 11 . . A boolean property that controls whether the errorMessage is added to the PipelineResult object when the expression evaluates to True. To do so.ProcPropertyRestriction. To insert a new link. The error message to add to the PipelineResult object when the expression evaluates to True. the ProcPropertyRestriction processor creates a new instance of atg.commerce.commerce. The integer to return when the expression evaluates to False.Configuring Purchase Process Services . the validateForCheckout pipeline.service. add a new element to the XML file that references atg.expression.RuleEvaluator for its use. If null. for example. you might check Orders against certain restrictions before checkout by adding a link to the validateForCheckout pipeline in <ATG9dir>/DCS/src/config/atg/commerce/commercepipeline.pipeline.) Then add the processor at any point in any pipeline. as follows: <pipelinechain name="validateForCheckout" transaction="TX_REQUIRED" headlink="validateOrderForCheckout" classname="atg. create an instance of atg. (See the table in the previous section for more information on the properties of ProcPropertyRestriction.PipelineResultImpl"> <pipelinelink name="propertyRestrictions" transaction="TX_MANDATORY"> <processor jndi="/atg/commerce/expression/ProcPropertyRestrictions"/> . The integer to return when the expression evaluates to True.PipelineChain" resultclassname="atg.µ ruleEvaluator returnValueForFalseEvaluation ATG Commerce Programming Guide The RuleEvaluator Nucleus component.pipeline.expression.xml. defining the rule by which Orders are to be evaluated in ProcPropertyRestriction.ProcPropertyRestrictions.ruleExpression and setting the remaining properties as necessary. . returnValueForTrueEvaluation addErrorToResultOnTrueEval errorMessage pipelineResultErrorMessageKey Implementing Order Restrictions You can set restrictions on Orders by adding a ProcPropertyRestriction processor to any pipeline.expression. For example.service.

and report on the activity for a specified time frame. allowing you to track stages in the shopping process from browsing. that may be an indication of poor or confusing application page design. In ATG Commerce. You can also use shopping process tracking to modify a customer’s experience. track activity within the business process. The shopping process is made up of a series of stages that a customer follows. For example. see the Processor Chains and the Pipeline Manager chapter. to adding items to the shopping cart. the duplication mode of the ShoppingProcessConfiguration component is NO_DUPLICATES. see the Defining and Tracking Business Processes chapter in the ATG Personalization Programming Guide Shopping Process Stages ATG Commerce has one business process configured out-of-the-box. from browsing for products to. The ShoppingProcessConfiguration component also specifies the duplication mode for the shopping process. For more information about business process tracking. the shopping process. Tracking the Shopping Process ATG’s Adaptive Customer Engine includes a business tracking feature that lets you define a business process as a series of stages. if all goes well. You can use the information gathered by tracking the stages of the shopping process to understand better how your customers react to their experience with your site. The stages of the shopping process in ATG Commerce are defined as: Browsed AddedToCart ShippingInfoComplete ShippingPriceDisplayed RequestedBillingInfo BillingInfoCompleted CartSummaryViewed These stages are defined in the stageNames property of the /atg/commerce/bp/ShoppingProcessConfiguration component. to completing shipping and billing information. to final check out. which means an order is marked as having reached a new stage in the shopping process only the first time it reaches that stage. By default.Configuring Purchase Process Services . purchasing and checking out. or undesirable pricing schemes. For example.ATG Commerce Programming Guide µ </pipelinechain> For more information on pipelines and how to extend them. No change is made if the order reaches the same stage again. The duplication mode determines what happens if an order reaches a business stage for the second or subsequent time. you could offer special promotions to customers who stall at a particular point in the shopping process. including information about how to create new business processes. if reports show that many customers are abandoning their purchases at the stage where you display the shipping price. we’ve defined the lifecycle of an order (through the point the customer checks out) as a business process. 387 11 .

Configuring Purchase Process Services .droplets package.bp. and check shopping process stages. and check for business process stages. You can as an alternative use the corresponding scenario elements in a scenario. The business process stages that are defined by default in ATG Commerce may not fit the needs of your site. Whether you use the default business process stages or define your own. Working with Shopping Process Stages ATG includes page-based and scenario-based tools that let you add. For the shopping process. these include the following servlet beans and scenario elements: Task Add a shopping process stage Remove a shopping process stage Check if a shopping process stage has been reached Check the most recent shopping process stage that has been reached Servlet Bean AddShoppingProcessStageDroplet Scenario Element Add Stage Reached RemoveShoppingProcessStageDroplet Remove Stage(s) Reached HasShoppingProcessStageDroplet Has Reached Stage MostRecentShoppingProcessStageDro plet Most Recent Stage Reached These servlet beans are instances of classes in the atg.markers. you need to track them by adding servlet beans to your checkout pages or defining scenarios to mark when a stage is reached. remove. you could create a scenario like this: The business stage scenario elements are described in the Creating Scenarios chapter of the ATG Personalization Guide for Business Users.µ ATG Commerce Programming Guide Every commerce site is different. as described in the rest of this section. See Appendix: ATG Commerce Servlet Beans in the ATG Commerce Guide to Setting Up a Store for reference information about these servlet beans. 388 11 . For example. remove. each with the default process name set to ShoppingProcess. You can define whatever business process stages you want by setting the stageNames property of the /atg/commerce/bp/ShoppingProcessConfiguration component. You can use the servlet beans to the checkout pages of a Commerce application to add.

for orders that started the process in the given timeframe. Turning Off Recording of Shopping Process Tracking If you don’t want to generate reports on the shopping process.Configuring Purchase Process Services .order. weekly. The reports give a summary of the number of orders that reach each stage in the shopping process. In the ACC Analysis > Chart Templates section. (For more information on transactions.) • • If errors occur when a user logs in.purchase.updateOrder(). or monthly basis.ATG Commerce Programming Guide µ Shopping Process Recorder Data about stages reached in the shopping process is recorded by the shoppingprocess scenario recorder: This recorder makes a record in the Shopping Process Stage Reached Dataset whenever an order reaches a new stage in the shopping process. you can disable shopping process events by setting the generateEvents property of the /atg/commerce/bp/ShoppingProcessConfiguration component to false. see the Transaction Management chapter in the ATG Programming Guide.CartModifierFormHandler provide good examples of how and when to call getOrderManager. 389 11 . (For more information on the updateOrder() method. you should make sure to follow these guidelines: • When making changes to an Order. you must call the updateOrder() method. set the persistOrders property of the ShoppingCart component to true. see Updating an Order with the Order Manager in the Saving Orders section of this chapter. The handleMoveToPurchaseInfoByRelId method and all other handle methods of atg. Troubleshooting Order Problems If you modify the functionality of the OrderManager or its related components. there are shoppingProcessActivity chart templates you can use to generate reports on the shopping process on a daily.) updateOrder() must always be called within a transaction.commerce. Note that by default the shopping process is configured with the NO_DUPLICATES setting. which means that we only track the first time an order reaches a stage in the shopping process.

Call CommerceItemManager. The quantity property of the ShippingGroupCommerceItemRelationship reflects the quantity that was shipped.updateClaimableStoreCredit() method. The store credit system in ATG Commerce can also manage the return of items. Increases the returnedQuantity property in the ShippingGroupCommerceItemRelationship by the quantity returned. The Claimable Repository contains a storeCreditClaimable item that includes the following properties: • • • • • amount (double) – the original amount of the credit amountAuthorized (double) – the amount of credit authorized for use amountRemaining (double) – the current amount of the store credit ownerId (String) – the ID of the user or organization for which the credit was issued lastUsed (date) – the date the credit was last accessed To modify an existing store credit account (for example. Note that only one store credit account can exist for a given user or organization. call the ClaimableManager. Reduces the quantity property in the ShippingGroupCommerceItemRelationship by the quantity returned. including gift certificates.returnCommerceItem() to mark a given CommerceItem as returned.initializeClaimableStoreCredit() method to set its initial values. It includes the following sections: Managing Transactions in the ATG Commerce Form Handlers Extending the ATG Commerce Form Handlers 390 11 . For more information on the Claimable Repository. To create a new store credit account for a user or organization.ClaimableManager) to create the new store credit and then call the ClaimableManager. call the ClaimableManager.commerce.CommerceItemManager) to manage the return of items in an Order. This method does the following: Reduces the quantity property in the CommerceItem by the quantity returned. Working with ATG Commerce Form Handlers This section provides you with information on working with and extending the form handlers that are provided with ATG Commerce.Configuring Purchase Process Services .order.createClaimableStoreCredit() method (atg.commerce. to increase the amount of remaining credit). see the Configuring Merchandising Services chapter.µ Handling Returned Items • • • ATG Commerce Programming Guide In ATG Commerce. and its returnedQuantity reflects that quantity of the CommerceItem that was returned.claimable. the quantity of the CommerceItem reflects the final quantity that was purchased. you can use the CommerceItemManager (class atg. After the item is returned.

End the synchronization.commerce. It implements the following transactional steps: 1.util. 391 11 .purchase. Commit or roll back any transaction that was created in the beforeSet method. It implements the following transactional steps: 1. the CartModifierFormHandler subclass has a handleAddItemToOrder method that executes the logic of adding an item to an order. beforeSet Method This method is called once before any form handler property is set or handler method is called.droplet. create one. 2. this is the application’s responsibility. The lock name used defaults to the current profile ID.ATG Commerce Programming Guide µ For related.PurchaseProcessFormHandler. Call the OrderManager object’s updateOrder method to save the order data to the repository. 3. Execute logic for modifying the Order object. Managing Transactions in the ATG Commerce Form Handlers Most of the ATG Commerce form handlers extend atg. afterSet. This transaction management pattern is implemented through the form handler’s beforeSet. Synchronize on the Order object.) 2. (Note that use of locking has a small performance impact. This prevents a user from modifying an order in multiple concurrent threads.Configuring Purchase Process Services . and handler methods. For more information. 2.commerce. obtain a transaction lock before the transaction is created. Check for an existing transaction and. more general information. If a transaction lock was acquired in the beforeSet method. This form handler. For example. see atg. If the transaction was already in place before the beforeSet method was called. is an abstract class which implements a transaction management pattern that should be followed by any form handler that works with Order objects. Handler Methods The handler methods implement the following transactions steps: 1. if no transaction exists. If the form handler’s useLocksAroundTransactions property is true (the default).order. 4. which is a subclass of atg. the afterSet method does not end the transaction automatically. afterSet Method This method is called once after all form handler processing is completed.TransactionLockFactory.GenericFormHander. release the lock. see the Working with Forms and Form Handlers chapter in the ATG Programming Guide.

after all computation is complete but before returning any information. the handleAddItemToOrder method invokes the preAddItemToOrder method.µ ATG Commerce Programming Guide If you’re extending an ATG Commerce form handler and your code makes its own decisions about errors. Note that the handleXXX methods of the ATG Commerce form handlers invoke preXXX and postXXX methods before and after any computation is performed. 392 11 . the handleAddItemToOrder method invokes the postAddItemToOrder method. The easiest way to do this is to extend either PurchaseProcessFormHandler or a subclass of PurchaseProcessFormHandler. so you won’t need to replicate their portion of the transaction logic. For more information on PurchaseProcessFormHandler and its subclasses. By default these preXXX and postXXX methods have no functionality. you can mark a transaction for rollback by calling the setTransactionToRollbackOnly method. Your form handler will then inherit the beforeSet and afterSet methods. Extending the ATG Commerce Form Handlers If you write a form handler that modifies the Order object. when a customer adds an item to their shopping cart using CartModifierFormHandler. any new handler methods you write will need to implement the transaction logic described in the Handler Methods section.Configuring Purchase Process Services . you can examine the source files at <ATG9dir>\DCS\src\Java\atg\commerce\order\purchase and refer to the ATG API Reference. However. you should implement the transactionhandling pattern described above. However. Before any computation is done. Additionally. For example. be aware that these methods do not take any input parameters. the submit button on the form submits to the handleAddItemToOrder method. They are provided so you can easily extend the form handlers to support additional functionality.

Includes order ID. Extending the Purchase Process Describes how to store purchasing information that is not included in the out-of-thebox functionality of ATG Commerce. Purchase Process Event Messages The event messages generated by the purchase process are sent at various points in the purchase process. Integrating with Purchase Process Services Describes the integration points in the purchase process and how to add a new credit card type to a payment system integration. and JMS message type Sent when an item is removed from an order. Event ItemAddedToOrder Description Sent when an item is added to an order. commerce item ID and the JMS message type ItemRemovedFromOrder 393 12 . commerce item ID. Merging Orders Describes how to merge orders when you’ve extended ATG Commerce classes to store additional information. Note: This section is for reference.Customizing the Purchase Process Externals . Includes the order ID. It also contains information on how to extend the existing purchase framework. These include messages that are sent when a product or category is browsed. These messages are generated automatically during the purchase process. when an item is added or removed from the order and when an order has been submitted for fulfillment (checkout complete). Purchase Process Event Messages Describes the event messages sent by the purchase process.ATG Commerce Programming Guide µ 12 Customizing the Purchase Process Externals This chapter contains information on ATG Commerce features that operate outside the actual process of creating and placing orders.

the JMS message type Sent when a product or a category is browsed. configure a property of a Nucleus component to reference an object that implements an interface (as described below).commerce.µ SubmitOrder ViewItem ATG Commerce Programming Guide Sent when an order has been submitted for fulfillment (checkout complete). To integrate a component.payment.addressVerificationProcessor 394 12 .DummyCreditCardProcessor. Integrating with Purchase Process Services This section contains the following information: Purchase Process Integration Points Adding Credit Card Types to ATG Commerce Purchase Process Integration Points There are several points in the purchase process where specialized components can be integrated into the system. ATG Commerce actions include giving promotions to customers when they add a particular item to their order or browse a particular product or category.Customizing the Purchase Process Externals .payment. the item type. The gift certificate processing system must implement the atg. atg.GiftCertificateProcessor interface. By default. By default. the PaymentManager is configured to use a dummy processing system.giftcertificate. atg.commerce.CreditCardProcessor interface. The PaymentManager is located in Nucleus at /atg/commerce/payment/. confirmation e-mail is sent through a scenario that is listening for the Submitorder message. Additionally.creditcard. • PaymentManager. Includes the serialized order.giftCertificateProcessor Use this property of the PaymentManager to integrate with a gift certificate processing system. includes the repository name. • VerifyOrderAddresses. The PaymentManager is located in Nucleus at /atg/commerce/payment/. the repository id and the serialized repository item object. the PaymentManager is configured to use the ATG Commerce gift certificate processing system. The credit card processing system must implement the atg.payment. The following list describes the integration points in the purchase process: • PaymentManager.payment.GiftCertificateProcessorImpl.creditCardProcessor Use this property of the PaymentManager to integrate with a credit card processing system.

such as Switch/Solo.getPropertyValue() and super. 2.setPropertyValue().Customizing the Purchase Process Externals . etc. the following code sample creates a property for the issue number of the credit card: //-----------------------------------------------------// property:IssueNumber //-----------------------------------------------------public void setIssueNumber(String pIssueNumber) { setPropertyValue("issueNumber".avs. and TAXWARE.payment. The address verification system must implement the atg. MasterCard. For more information on integrating ATG Commerce with Payflow Pro. The get and set methods need to use super. The following sections describe the three parts to extending ATG Commerce to include new credit card types: 1. Many of these other cards have more validation parameters than the standard cards. 3. atg. ATG Commerce considers only common credit cards valid. see the Integrating Third-Party Software With ATG Commerce chapter of this manual.payment. (pIssueNumber == null ? pIssueNumber : StringUtils. By default. If your commerce site needs to accept these cards. Adding Credit Card Types to ATG Commerce This section describes how to extend ATG Commerce and a payment system integration (such as CyberSource) to use the additional credit card types that the payment system might accept. For general information on extending a class and modifying the ATG Commerce purchase process. you can extend ATG Commerce to handle these card types.removeWhiteSpace(pIssueNumber))). For example. Add get/set methods for each of these properties. so that the underlying repository item is updated correctly. Many payment systems handle many other credit and debit cards. 1.order.DummyAddressVerificationProcessor.commerce. These cards include Visa.commerce. which is located in Nucleus at /atg/commerce/order/processor/. the VerifyOrderAddresses component. see the Extending the Purchase Process section of this chapter. Create a subclass of atg. By default.AddressVerificationProcessor interface. CyberSource.CreditCard and include any new properties you need for the credit card type. is configured to use a dummy processing system.ATG Commerce Programming Guide µ Use this property of the ProcVerifyOrderAddresses object to integrate with an address verification system. Extending the ATG Commerce CreditCard Class Extending the ATG Commerce CreditCardInfo Class Extending the Payment System Integration Extending the ATG Commerce CreditCard Class The following steps describe how to extend the CreditCard class and modify ATG Commerce to use the new class. } 395 12 .

µ ATG Commerce Programming Guide /** * The issue number of this credit card * @beaninfo description: The issue number of this credit card **/ public String getIssueNumber() { return (String) getPropertyValue("issueNumber"). Refer to the payment system’s documentation for information on what properties it needs to process the new credit card type. 4. 2. Create a subclass of atg.paymentGroupToChainNameMap to contain a pointer to your new class: paymentGroupToChainNameMap+=\ my.processor. 1. with any necessary new properties.dir. } 2. Add columns to the dcspp_credit_card table to store your new properties for the CreditCard subclass.dir. Edit the following properties of /atg/commerce/payment/CreditCardTools to include appropriate values for your new CreditCard: cardCodesMap cardLengthsMap cardPrefixesMap cardTypesMap Extending the ATG Commerce CreditCardInfo Class The following steps describe how to extend the CreditCardInfo class to accommodate the new credit card type.myCreditCard=creditCardProcessorChain 6.payment.ProcCreateCreditCardInfo. Modify /atg/commerce/payment/PaymentManger.Customizing the Purchase Process Externals . Extend orderrepository.dir.class.xml to add the new properties in your CreditCard subclass to the existing creditCard item descriptor. 396 12 . In this class. 3.creditCardInfo Class to point to the new subclass.class. Create a new class that extends atg.creditcard. Modify /atg/commerce/order/OrderTools to make ATG Commerce use your new CreditCard subclass instead of the default class.class. 3. For example: beanNameToItemDescriptorMap+=\ my.GenericCreditCardInfo. Modify /atg/commerce/payment/processor/CreateCreditCardInfo.myCreditCard=creditCard paymentTypeClassMap+=\ creditCard=my.commerce.payment.myCreditCard 5.

integrations. For example.ATG Commerce Programming Guide µ extend the addDataToCreditCardInfo method to call the superclass.cybersource. If using CyberSource. Extending the Payment System Integration The final part of the process of adding a new credit card type is to extend the credit card processor for your payment system to use your new card type’s properties in its validation mechanisms. adding logic to use the new properties you added. if you want to allow customers to specify a box size for their purchases. For example. All of these methods get data from the ATG Commerce creditCardInfo object.payment. This means that you need to extend this class and recreate most of the methods. see the Processing Payment of Orders section in the Configuring Purchase Process Services chapter. See the following sections for details: Adding a Subclass with Primitive Data Type Properties Adding a Subclass with Object Data Type Properties Manipulating Extended Objects Note: For information on extending the ATG Commerce payment process to support a new payment method or additional operations for an existing payment method. Adding a Subclass with Primitive Data Type Properties You can extend the commerce object hierarchy by subclassing an existing object and adding new primitive data type properties. 4. the 397 12 . When you add primitive data type properties. the $class line in the properties file for the credit card processor must be changed to use your new subclass. You extend the purchase process by first subclassing an existing object in the commerce object hierarchy to add new properties and then integrating that new class into ATG Commerce.CyberSourceCreditCard uses the credit card info in the authorize. if you are integrating with CyberSource. In addition. followed by code that adds your new properties (added in step 1) to the CreditCardInfo object. you don’t need to write any code to save the properties to or load the properties from the Order Repository. /atg/commerce/payment/CyberSourceCreditCard must be changed.Customizing the Purchase Process Externals .properties to point to your new subclass. Extending the Purchase Process Extending the purchase process is necessary when you want to store purchasing information that is not included in the out-of-the-box functionality of ATG Commerce. The payment system integration will have an implementation of atg. and send the request to CyberSource. you could extend the purchase process to store that information. the class atg.CreditCardProcessor. build a CyberSource request. Using introspection. Modify the class of CreditCreditCardInfo. credit and debit methods.creditcard.

commerce. In ATG Commerce. pShortDescription) in the setShortDescription() method causes the shortDescription repository item property to be set directly when the method is called. This approach reduces the amount of processing when OrderManager.order. note the calls to getPropertyValue() and setPropertyValue(). public String getShortDescription() { return (String) getPropertyValue("shortDescription").µ ATG Commerce Programming Guide processors in the updateOrder and loadOrder pipelines handle this automatically for primitive data type properties. In a commerce object that supports the ChangedProperties interface. In the example above.pricing.commerce. every get() method needs to call the getPropertyValue() method. they are part of the atg. pShortDescription). It extends CommerceItemImpl and adds a new String property called shortDescription. You can do so using one of two approaches: • (Recommended) Add the new properties to an existing item descriptor and then map the new object to that item descriptor. the call to setPropertyValue("shortDescription". This approach is recommended because it eliminates the need to change property values that contain item descriptor names throughout ATG Commerce. Performance is enhanced because you set the values directly to the repository item and only save the properties that have actually been changed in the class.Customizing the Purchase Process Externals . all commerce objects implement the ChangedProperties interface except for atg. the following code creates a new class called MyCommerceItemImpl. For more information. you now need to integrate the new commerce object into ATG Commerce. public class MyCommerceItemImpl extends CommerceItemImpl { public MyCommerceItemImpl() { } // property: shortDescription private String mShortDescription = null.AuxiliaryData and all subclasses of atg.ChangedProperties interface. import atg.updateOrder() is called to save the Order to the repository. and similarly every set() method needs to call the setPropertyValue() method.order. With the MyCommerceItemImpl subclass created. The ChangedProperties interface enhances performance when saving an Order to the Order Repository.CommerceItemImpl. } public void setShortDescription(String pShortDescription) { setPropertyValue("shortDescription".AmountInfo. The call to getPropertyValue("shortDescription") retrieves the property directly from the repository item and eliminates the need to create a member variable in the class to store the value.order. } } In the code example above. These methods retrieve and set the values of properties directly on the repository item objects.commerce. As an example. see Integrating a New Commerce 398 12 .commerce.

xml. the ATG platform uses XML file combination to combine the orderrepository. (For more information on XML file combination.xml. to add the new properties in MyCommerceItemImpl to the existing commerceItem item descriptor.xml file is found in the CONFIGPATH at /atg/commerce/order/orderrepository. you should take the following additional steps: • Override the createAuxiliaryData() method in the subclass so that it creates an instance of that new class. (Recall that AuxiliaryData does not implement the ChangedProperties interface. follow these steps: Step 1 of 3 . In this example.Extend the Order Repository Definition File Extend the Order Repository definition file. orderrepository.) However. The orderrepository. the new property to add is the shortDescription property. • Create a new item descriptor subtype that includes the new properties and map the new object to it. For more information.ATG Commerce Programming Guide µ Object: Using an Existing Item Descriptor. as follows: protected void createAuxiliaryData() { if (mAuxiliaryData == null) { mAuxiliaryData = new MyAuxiliaryData(getRepositoryItem()). If you do so. Integrating a New Commerce Object: Using an Existing Item Descriptor To integrate MyCommerceItemImpl into ATG Commerce using an existing item descriptor. which continues the example of MyCommerceItemImpl.Customizing the Purchase Process Externals . Ensure the database columns that store the new properties of the subclass go into the table that represents the new commerce object. Note: You can also extend the commerce object hierarchy by subclassing AuxiliaryData.xml file that you create might look as follows: <gsa-template xml-combine="append"> <item-descriptor name="commerceItem"> <table name="dcspp_my_item" id-column-name="commerce_item_id"> 399 12 .xml files in the CONFIGPATH into a single composite XML file.xml file at /atg/commerce/order/ in your localconfig directory. During deployment. which continues the example of MyCommerceItemImpl. create a new orderrepository. The new file should define the shortDescription property for the commerceItem item descriptor. see Integrating a New Commerce Object: Using a New Item Descriptor. } • • Ensure the new properties of the subclass are defined within the XML definition for the new commerce object.) The orderrepository. you can integrate the new class into ATG Commerce using either process described in this section. see the Nucleus: Organizing JavaBean Components chapter in the ATG Programming Guide. which holds auxiliary data for a CommerceItem. To extend the file.

CREATE TABLE dcspp_my_item ( commerce_item_id VARCHAR(40) REFERENCES dcspp_item(commerce_item_id).dir. Step 2 of 3 – Modify the Order Repository Database Schema In step 1.CommerceItemImpl=commerceItem beanNameToItemDescriptorMap+=\ my. layer on a configuration file by creating an OrderTools. see the ATG API Reference. such as mapping between commerce object types and class names. Step 3 of 3 – Modify the OrderTools Configuration File The OrderTools component controls many aspects of the purchase process.µ </gsa-template> ATG Commerce Programming Guide <property name="shortDescription" column-name="short_description" data-type="string"/> </table> </item-descriptor> The first line in the above XML example begins the GSA template and instructs the XML combiner to append the contents of the tags in this file to the contents of the tags in the file with which it is combined. Now you need to modify accordingly the Order Repository database schema. defining the default commerce object types. NOT NULL NULL. you defined the new shortDescription property of the commerceItem item descriptor. You need to modify the OrderTools configuration file to support the new MyCommerceItemImpl class. To modify the OrderTools configuration file.order. The following DDL statement creates the database table and columns specified in the orderrepository.properties file at /atg/commerce/order/ in your localconfig directory. The OrderTools.commerce. For more information on setting up a repository and defining item descriptors. and mapping between commerce objects and item descriptors. The next section defines the shortDescription property of a commerceItem repository item. as well as the database table and column that store that property.MyCommerceItemImpl=commerceItem 400 12 .Customizing the Purchase Process Externals . short_description VARCHAR(254) PRIMARY KEY(commerce_item_id) ).xml file that you created in step 1. specifying the database table and column that store that property.class.properties file might look as follows: beanNameToItemDescriptorMap-=\ atg.

myCommerceItem inherits all of the properties of commerceItem. the commerceItemTypeClassMap property maps CommerceItem types to class names.class. the method constructs and returns an instance of the type specified in OrderTools. by passing it a type parameter (such as the string “default”).dir. (For more information on XML file combination.defaultCommerceItemType. the beanNameToItemDescriptorMap property contains this mapping. the ATG platform uses XML file combination to combine the orderrepository. This mapping is used by the createCommerceItem() method in the CommerceItemManager. orderrepository. The orderrepository.Extend the Order Repository Definition File Extend the Order Repository definition file. The configuration file above first removes the out-of-the-box configuration. shortDescription.xml file defines a new item descriptor named myCommerceItem.xml. see the Nucleus: Organizing JavaBean Components chapter in the ATG Programming Guide.) The following orderrepository.xml files in the CONFIGPATH into a single composite XML file.dir prefix indicates some Java package in which the class exists. Because you can have more than one type of CommerceItem object. <gsa-template xml-combine="append"> <item-descriptor name="commerceItem"> <table name="dcspp_item"> <property name="type"> 401 12 . Additionally. is mapped to the new MyCommerceItemImpl class in the commerceItemTypeClassMap property in the configuration file above. By default.xml.dir prefix specifies some Java package in which the class exists. in turn. During deployment. then remaps the existing commerceItem item descriptor to the new Bean class. To extend the file.class. Integrating a New Commerce Object: Using a New Item Descriptor To integrate MyCommerceItemImpl into ATG Commerce using a new item descriptor subtype. it defines one new property. to create a new item descriptor subtype that supports the new properties in MyCommerceItemImpl. The new file should define the new item descriptor subtype. MyCommerceItemImpl. As a subtype of the commerceItem item descriptor. The my. which. the processors that save and load an Order look for an item descriptor that is mapped to the corresponding commerce object class. create a new orderrepository. In ATG Commerce. When one of the createCommerceItem() methods that does not take a type parameter is called.ATG Commerce Programming Guide µ commerceItemTypeClassMap+=\ default=my. follow these steps: Step 1 of 4 .class.xml file at /atg/commerce/order/ in your localconfig directory. the defaultCommerceItemType property is set to the type default.MyCommerceItemImpl The beanNameToItemDescriptorMap property maps Order Repository item descriptors to Bean names. The my. the method constructs and returns an instance of the corresponding class.xml file is found in the CONFIGPATH at /atg/commerce/order/orderrepository.Customizing the Purchase Process Externals .

µ ATG Commerce Programming Guide <option value="myCommerceItem" code="1"/> </property> </table> </item-descriptor> <item-descriptor name="myCommerceItem" super-type="commerceItem" sub-type-value="myCommerceItem"> <table name="dcspp_my_item" id-column-name="commerce_item_id"> <property name="shortDescription" column-name="short_description" data-type="string"/> </table> </item-descriptor> </gsa-template> The first line in the above XML example begins the GSA template and instructs the XML combiner to append the contents of the tags in this file to the contents of the tags in the file with which it is combined. you created the new myCommerceItem item descriptor. For more information on setting up a repository and defining item descriptors.xml file that you created in step 1. CREATE TABLE dcspp_my_item ( commerce_item_id VARCHAR(40) REFERENCES dcspp_item(commerce_item_id). is specified. short_description VARCHAR(254) NOT NULL NULL. defining both its properties and the database table and columns that store those properties. The section then specifies the properties of a myCommerceItem repository item. You do this by adding a new string value for myCommerceItem to the type enumerated property of commerceItem. as well as the database table and columns that store those properties. The following DDL statement creates the database table and columns specified in the orderrepository. However. shortDescription. The base orderrepository. the new type is called myCommerceItem. a single property. 402 12 . its parent item descriptor. specifying commerceItem as the super-type (or parent item descriptor) and myCommerceItem as the sub-type-value. Step 2 of 4 – Modify the Order Repository Database Schema In step 1. Now you need to modify accordingly the Order Repository database schema. In this case.Customizing the Purchase Process Externals . and its corresponding integer value is 1. see the ATG Repository Guide. In this case.xml file contains the other options for the type property of commerceItem. The next section defines myCommerceItem as a subtype of the commerceItem item descriptor. recall that myCommerceItem inherits all of the properties of commerceItem. The last section of the XML file defines the myCommerceItem item descriptor.

Customizing the Purchase Process Externals .class.properties file might look as follows: beanNameToItemDescriptorMap+=\ my. such as mapping between commerce object types and class names. The item descriptor’s id-space-name attribute specifies which IdSpace supplies repository IDs for items of that item type. Step 4 of 4 – Extend the ID Spaces Definition File Note: Because the example provided throughout this section involves an item descriptor subtype rather than a root item descriptor.ATG Commerce Programming Guide µ PRIMARY KEY(commerce_item_id) ). all items use the item descriptor’s name as the ID space unless their item type inherits from another item type. it is requested from the appropriate IdSpace for that repository item. The OrderTools.class.dir. the method constructs and returns an instance of the corresponding class. mapping the myCommerceItem item descriptor that you created in step 1 to the MyCommerceItemImpl class.class. In the latter case. The my. is mapped to the new MyCommerceItemImpl class in the commerceItemTypeClassMap property in the configuration file above. By default.dir prefix specifies some Java package in which the class exists. The my. the commerceItemTypeClassMap property maps CommerceItem types to class names. When an ID is requested for a new repository item. the processors that save and load an Order look for an item descriptor that is mapped to the corresponding commerce object class. To modify the OrderTools configuration file. Step 3 of 4 – Modify the OrderTools Configuration File The OrderTools component controls many aspects of the purchase process. the method constructs and returns an instance of the type specified in OrderTools. By default. which. 403 12 . It is provided here for information when defining root item descriptors.defaultCommerceItemType.dir. When one of the createCommerceItem() methods that does not take a type parameter is called. and mapping between commerce objects and item descriptors. You need to modify the OrderTools configuration file to support the new MyCommerceItemImpl class and myCommerceItem item descriptor.properties file at /atg/commerce/order/ in your localconfig directory. defining the default commerce object types. Because you can have more than one type of CommerceItem object. the defaultCommerceItemType property is set to the type default. in turn. This mapping is used by the createCommerceItem() method in the CommerceItemManager.MyCommerceItemImpl=myCommerceItem commerceItemTypeClassMap+=\ default=my. In ATG Commerce. the beanNameToItemDescriptorMap property contains this mapping. this step is not required for the example.MyCommerceItemImpl The beanNameToItemDescriptorMap property maps Order Repository item descriptors to Bean names. by passing it a type parameter (such as the string “default”). layer on a configuration file by creating an OrderTools.dir prefix indicates some Java package in which the class exists.class. the items use the ID space name of the root item descriptor in the super-type hierarchy. The configuration file above adds a new entry.

ChangedProperties. java. During deployment.xml file might look as follows: <id-spaces xml-combine="append"> <id-space name="myCommerceItem" seed="1" batch-size="10000" prefix="mci"/> </id-spaces> For more information on defining ID spaces and its impact on repository item IDs.xml. public class OrderData extends CommerceIdentifierImpl 404 12 .Set. It extends CommerceIdentifierImpl and adds a new String property called miscInformation. if myCommerceItem were a root item descriptor.util.commerce. A subsequent code example creates a new class called MyOrder.HashSet. idspaces.MutableRepositoryItem.order. atg.µ ATG Commerce Programming Guide If the new item descriptor that you’ve defined is a root item descriptor. which is explained in detail after the code example. java.xml file at /atg/dynamo/service/ in your localconfig directory. Because the example used throughout this section involves the myCommerceItem item descriptor subtype. and each root item descriptor defines the characteristics of its ID space in the idspaces. see the ID Generators section of the Core Dynamo Services chapter in the ATG Programming Guide. the following code creates a new class called OrderData.xml definition file.) The idspaces.Customizing the Purchase Process Externals . Adding a Subclass with Object Data Type Properties You can extend the commerce object hierarchy by subclassing an existing commerce object and adding new object data type properties. import import import import import import atg.util.util. it doesn’t require a defined ID space. Note that the OrderData class implements the ChangedProperties interface. (For more information on XML file combination. which extends OrderImpl and adds a new OrderData property named orderData.commerce. adding new object data type properties requires that you write code to save and load the object’s properties.repository. atg. java. see the Nucleus: Organizing JavaBean Components chapter in the ATG Programming Guide. As an example. you would define an ID space for it by creating a new idspaces.xml files in the CONFIGPATH into a single composite XML file.Observable.CommerceIdentifierImpl. However. the ATG platform uses XML file combination to combine the idspaces. which is a subtype of the commerceItem item descriptor. The ATG Commerce IdGenerator guarantees that IDs within a named ID space are unique.order. Unlike with adding new primitive data type properties (see Adding a Subclass with Primitive Data Type Properties). in order to define an ID space for that item descriptor. package my_package. you need to extend the ID spaces definition file.

ATG Commerce Programming Guide µ implements ChangedProperties { public OrderData() { super(). } else { throw new RuntimeException("Observable update for " + getClass(). } public void setMiscInformation (String pMiscInformation) { setPropertyValue("miscInformation".isEmpty())). } // property: miscInformation public String getMiscInformation() { return (String) getPropertyValue("miscInformation").getName() + " was received with arg type " + arg. public boolean getSaveAllProperties() { return mSaveAllProperties. Object arg) { if (arg instanceof String) { addChangedProperty((String) arg). pMiscInformation).getClass(). 405 12 . public boolean isChanged() { return (mChanged || (mChangedProperties != null && ! getChangedProperties().getName() + ":" + arg).Customizing the Purchase Process Externals . } public void setSaveAllProperties(boolean pSaveAllProperties) { mSaveAllProperties = pSaveAllProperties. } // // Observer implementation // public void update(Observable o. } } // // ChangedProperties implementation // // property: saveAllProperties private boolean mSaveAllProperties = false. } // property: changed private boolean mChanged = false.

if (mutItem == null) throw new RuntimeException("Null repository item: " + getId()). return mutItem.getPropertyValue(pPropertyName). 406 12 . } public void addChangedProperty(String pPropertyName) { mChangedProperties.add(pPropertyName). mutItem.clear(). } public void clearChangedProperties() { mChangedProperties. if (mutItem == null) throw new RuntimeException("Null repository item: " + getId()). } // property: repositoryItem private MutableRepositoryItem mRepositoryItem = null.µ } ATG Commerce Programming Guide public void setChanged(boolean pChanged) { mChanged = pChanged.setPropertyValue(pPropertyName. setChanged(true). pPropertyValue). public MutableRepositoryItem getRepositoryItem() { return mRepositoryItem. } // setPropertyValue/getPropertyValue methods public Object getPropertyValue(String pPropertyName) { MutableRepositoryItem mutItem = getRepositoryItem(). Object pPropertyValue) { MutableRepositoryItem mutItem = getRepositoryItem(). } // property: changedProperties private HashSet mChangedProperties = new HashSet(7). public Set getChangedProperties() { return mChangedProperties. } public void setPropertyValue(String pPropertyName.Customizing the Purchase Process Externals . } public void setRepositoryItem(MutableRepositoryItem pRepositoryItem) { mRepositoryItem = pRepositoryItem.

commerce. and adds a new String property called miscInformation. The ChangedProperties interface enhances performance when saving the object by allowing the object’s property values to be set directly to the repository item. implements the ChangedProperties interface. Contains the repository item that refers to the object. The following code creates a new class called MyOrder. Having the object contain the repository item eliminates the need to look up the item in the repository when saving it. public class MyOrder extends OrderImpl { public MyOrder() { } 407 12 . The property is implemented as a Set to include each property only once. import atg.OrderImpl.repository.order.MutableRepositoryItem. The CommerceIdentifierImpl class is an abstract class that contains a single property called id.ATG Commerce Programming Guide µ } } As previously mentioned.Customizing the Purchase Process Externals . The interface contains the properties described in the following table. The class contains the getId() and setId() methods and implements the CommerceIdentifier interface. which extends OrderImpl and adds a new OrderData property called orderData. import atg. The CommerceIdentifier interface provides a standard way for ATG Commerce systems to access the repository IDs of items. changedProperties repositoryItem saveAllProperties With the OrderData class created. The purpose of the id property is to store the repository ID for the given commerce object. the next step is to add the OrderData property to the Order. package my_package. the code above creates a new OrderData class that extends CommerceIdentifierImpl. it is the base class for all commerce object classes. which contains only the getId() method. Property changed Description A boolean property that returns true if the object has changed since the last update and returns false if it has not. A boolean property that marks all properties as changed. A Set that contains the names of all changed properties. regardless of whether or not they have changed. This causes all properties to be saved to the repository.

you now need to integrate the new commerce objects into ATG Commerce. (For more information on XML file combination. The definition file also defines a root item descriptor named orderData.xml files in the CONFIGPATH into a single composite XML file. see the Nucleus: Organizing JavaBean Components chapter in the ATG Programming Guide. } } With the MyCommerceItemImpl subclass created. setPropertyValue("orderData". To do so. orderData.xml file at /atg/commerce/order/ in your localconfig directory. it defines one new property.xml. During deployment.µ // property: orderData private OrderData mOrderData = null. Additionally. With the OrderData and MyOrder classes created. the ATG platform uses XML file combination to combine the orderrepository. add a new orderrepository.) The following orderrepository. As a subtype of the order item descriptor. which supports the miscInformation property in OrderData. ATG Commerce Programming Guide public OrderData getOrderData() { if (mOrderData == null) { mOrderData = new OrderData(). } return mOrderData. to create new item descriptors that support the new properties in OrderData and MyOrder.getRepositoryItem()). extend the Order Repository definition file. The orderrepository.Customizing the Purchase Process Externals .xml file defines an item descriptor named myOrder. orderrepository.xml. perform the following steps: Step 1 of 7 – Extend the Order Repository Definition File First.xml file is found in the CONFIGPATH at /atg/commerce/order/orderrepository. } public void setOrderData(OrderData pOrderData) { mOrderData = pOrderData. myOrder inherits all of the properties of order. setRepositoryItem((MutableRepositoryItem) getPropertyValue("orderData")). To extend it. you now need to integrate the new commerce object into ATG Commerce. <gsa-template xml-combine="append"> <item-descriptor name="order"> <table name="dcspp_order"> <property name="type"> <option value="myOrder" code="1"/> </property> 408 12 . pOrderData. The new file should define the new item descriptors.

The base orderrepository. The sub-type-value refers to the type property in the order item descriptor.ATG Commerce Programming Guide µ </table> </item-descriptor> <item-descriptor name="myOrder" super-type="order" sub-type-value="myOrder"> <table name="dcspp_my_order" id-column-name="order_id"> <property name="orderData" column-name="order_data" item-type="orderData"/> </table> </item-descriptor> <item-descriptor name="orderData" sub-type-property="type" version-property="version"> <table name="dcspp_order_data" type="primary" id-column-name="order_data_id"> <property name="type" column-name="type" data-type="enumerated" default="orderData" writable="false"> <attribute name="useCodeForValue" value="false"/> <option value="orderData" code="0"/> </property> <property name="version" column-name="version" data-type="int" writable="false"/> <property name="miscInformation" column-name="misc_information" data-type="string"/> </table> </item-descriptor> </gsa-template> The first line in the above XML example begins the GSA template and instructs the XML combiner to append the contents of the tags in this file to the contents of the tags in the file with which it is combined. the table is called dcspp_my_order. as well as the database table and columns that store those properties. declaring order as the super-type (or parent item descriptor) and myOrder as the sub-type-value. Subsequent lines define the name of the table in the database schema that stores the properties of myOrder and then define those properties. and it stores a single property named orderData.) In this case. The last section of the XML file defines orderData as a root item descriptor.Customizing the Purchase Process Externals . (Note that each property of a repository item is stored in a database column that has the same name as the property. The next section defines myOrder as a subtype of the order item descriptor. and miscInformation. unless otherwise specified using the column-name attribute. and its corresponding integer value is 1. the new type is called myOrder. In this case. The section then specifies the properties of an orderdata repository item. In this case.xml file contains the other options for the type property. The subsequent section of XML defines the myOrder item descriptor. The type and version properties are defined as readonly (writable="false" in the XML) because they are used primarily by 409 12 . the following properties are specified: type. You do this by adding a new string value for myOrder to the type enumerated property of order. version.

commerce. In this case. that column is order_data_id. CREATE TABLE dcspp_order_data ( order_data_id VARCHAR(40) type integer version integer misc_information VARCHAR(254) PRIMARY KEY(order_data_id) ). NULL. then call the createOrderData() method that you created in step 1 to create the OrderData object. The following code example subclasses OrderTools and adds a new createOrderData() method. you created the new orderData and myOrder item descriptors. see the Using the SimpleOrderManager section of the Working With Purchase Process Objects chapter. order_data VARCHAR(40) PRIMARY KEY(order_id) ).xml file that you created in step 1. This functionality requires the following two steps: 1.µ ATG Commerce Programming Guide the repository.OrderTools and add a new createOrderData() method that instantiates an OrderData object and creates an OrderData repository item in the Order Repository. Subclass atg. Step 2 of 7 – Modify the Order Repository Database Schema In step 1.order.commerce. 410 12 .Customizing the Purchase Process Externals . The following DDL statements create the database tables and columns specified in the orderrepository. Now you need to modify accordingly the Order Repository database schema.order. NOT NULL NULL. All three properties are stored in the dcspp_my_order database table. NOT NULL. (For more information on the SimpleOrderManager. NOT NULL. and finally add the OrderData object to the Order.OrderManager) and override its createOrder() method. CREATE TABLE dcspp_my_order ( order_id VARCHAR(40) REFERENCES dcspp_order(order_id). NOT NULL.SimpleOrderManager (which extends atg. The new createOrder() method should first call the createOrder() method of the superclass to create the Order object.order.Subclass OrderTools and SimpleOrderManager to Create the New Object When an Order is created. Step 3 of 7 . meaning it defines a column that stores repository IDs. The dcspp_my_order table is declared a primary table. Subclass atg.) 2.commerce. the new OrderData object must also be created and added to the Order object. defining both their properties and the database tables and columns that store those properties.

*.createItem("orderData").commerce. // create the OrderData in the repository and set its id to the // repository's id try { MutableRepository mutRep = (MutableRepository) getOrderRepository().*.setSaveAllProperties(true).getRepositoryId()). } catch (RepositoryException e) { throw new ObjectCreationException(e). public class MyOrderManager extends SimpleOrderManager { public MyOrderManager() { } 411 12 .repository.commerce.pricing. import atg. if (orderData instanceof ChangedProperties) ((ChangedProperties) orderData). MutableRepositoryItem mutItem = mutRep. import atg.order.order. if (orderData instanceof ChangedProperties) ((ChangedProperties) orderData). orderData. overriding its createOrder() method in order to call the createOrderData() method in the OrderTools object. } return orderData. import atg. } } The following code example subclasses SimpleOrderManager.ATG Commerce Programming Guide µ package my_package. public class MyOrderTools extends OrderTools { public MyOrderTools() { } public OrderData createOrderData() throws ObjectCreationException { // instantiate the orderData object OrderData orderData = new OrderData().setRepositoryItem(mutItem).*.commerce. package my_package. import atg.commerce.setId(mutItem. import atg. import atg.*.*.*.Customizing the Purchase Process Externals .commerce.

properties file at /atg/commerce/order/ in your localconfig directory. return order. The OrderTools.Customizing the Purchase Process Externals . ShippingPriceInfo pShippingPriceInfo. configure an instance of MyOrderTools in Nucleus by modifying the existing OrderTools configuration file. Now you need to configure instances of these new classes in Nucleus. pOrderId. pOrderPriceInfo. order. The OrderTools component controls many aspects of the purchase process.class. OrderData orderData = ((MyOrderTools)getOrderTools()).MyOrderTools beanNameToItemDescriptorMap+=\ my. TaxPriceInfo pTaxPriceInfo. such as mapping between commerce object types and class names.class. String pOrderType) throws CommerceException { MyOrder order = (MyOrder)super.µ ATG Commerce Programming Guide public Order createOrder(String pProfileId.dir. First. you subclassed OrderTools and SimpleOrderManager to create the new OrderData object and add it to the Order. } } Step 4 of 7 – Modify the OrderTools and OrderManager Configuration Files In step 3.properties file should look as follows: $class=my_package.MyOrderManager Second.MyOrder=myOrder orderTypeClassMap+=\ default=my. String pOrderId.\ my. pTaxPriceInfo.): $class=my_package.MyOrder 412 12 .class.dir. layer on a configuration file by creating an OrderManager.setOrderData(orderData). To modify the OrderTools configuration file. The OrderManager.createOrderData(). and mapping between commerce objects and item descriptors. pOrderType). You need to modify the OrderTools configuration file to support the new commerce objects and item descriptors that you have created.dir.createOrder( pProfileId. layer on a configuration file by creating an OrderTools.properties file at /atg/commerce/order/ in your localconfig directory. configure an instance of MyOrderManager in Nucleus by modifying the existing OrderManager configuration file. pShippingPriceInfo.properties file should look as follows (Note that no properties need to be configured. defining the default commerce object types. To do so. OrderPriceInfo pOrderPriceInfo.OrderData=orderData.

The my.dir prefix indicates some Java package in which the class exists.*. SavedProperties provides a set of properties and a way to retrieve a mapped property. by passing it a type parameter (such as the string “default”). This class also implements the PipelineProcessor interface. This interface includes the runProcess() and getRetCodes() methods.class. In ATG Commerce. import import import import import import atg. the defaultOrderType property is set to the type “default.commerce.class.order.dir prefix specifies the Java package in which the class exists. the processors that save and load an Order look for an item descriptor that is mapped to the corresponding commerce object class. atg. Because you can have more than one type of Order object.*.commerce. atg.order. you must create a new processor that saves the OrderData object to the Order Repository and insert that new processor into the updateOrder pipeline. is mapped to the new MyOrder class in the orderTypeClassMap property in the configuration file above.defaultOrderType. to save the data in the OrderData object itself.commerce.pipeline.util. import java. By default.” which. /* This class extends a class called SavedProperties. ProcSaveOrderDataObject. atg. The my.service.) First.Customizing the Purchase Process Externals . atg. the method constructs and returns an instance of the corresponding class.processor. mapping the orderData and myOrder item descriptors that you created in step 1 to their corresponding classes. The following Java source file. Step 5 of 7 – Add a Processor to Save the New Object You do not need to write new code to save the orderData reference in the MyOrder object. This functionality corresponds to the savedProperties property and the propertyDescriptorToBeanPropertyMap property in the properties file which corresponds the this object. (For more information on the updateOrder pipeline. However. use the Dynamic Beans mechanism to read and write the values of a bean using their property names. When one of the createOrder() methods that does not take a type parameter is called.java. The processors in the updateOrder pipeline. This mapping is used by the createOrder() method in the OrderManager. All pipeline processors must 413 12 .*. package my_package.*.beans.*.*. which perform the actual saving of the Order object to the Order Repository. the beanNameToItemDescriptorMap property contains this mapping. in turn. write the Java source code for the new processor. the method constructs and returns an instance of the type specified in OrderTools. the orderTypeClassMap property maps Order types to class names.ATG Commerce Programming Guide µ The beanNameToItemDescriptorMap property maps Order Repository item descriptors to Bean names. see Saving Orders in the Configuring Purchase Process Services chapter.CommerceException. serves as an example. The configuration file above adds two new entries. atg.repository.

get(PipelineConstants. This code extracts the required parameters for this processor. } // property: orderDataProperty // This is the order data property.Customizing the Purchase Process Externals . private final int FAILURE = 2.ORDERMANAGER). */ public class ProcSaveOrderDataObject extends SavedProperties implements PipelineProcessor { // These are the two valid return codes for this pipeline processor private final int SUCCESS = 1.get(PipelineConstants. return ret. public String getOrderDataProperty() { return mOrderDataProperty. MutableRepository mutRep = null. } public int runProcess(Object pParam.ORDERREPOSITORY). Order order = (Order) map. 414 12 . public int[] getRetCodes() { int[] ret = {SUCCESS. // The constructor public ProcSaveOrderDataObject() { } // Returns the set of all valid return codes for this processor. OrderManager orderManager = (OrderManager) map. MutableRepositoryItem mutItem = null. FAILURE}.get(PipelineConstants.µ ATG Commerce Programming Guide implement this interface. } public void setOrderDataProperty(String pOrderDataProperty) { mOrderDataProperty = pOrderDataProperty. OrderTools orderTools = (OrderTools) orderManager. private String mOrderDataProperty = "orderData". PipelineResult pResult) throws Exception { /* The pParam parameter contains the data required for executing this pipeline processor.getOrderTools().ORDER). Object value = null. Repository repository = (Repository) map. */ HashMap map = (HashMap) pParam.

*/ try { mutRep = (MutableRepository) repository. then it gets the list of properties whose value has changed. The saveChangedPropertiesOnly property is inherited from SavedProperties.getChangedProperties(). /* Try to cast the repository and make sure that it is a MutableRepository. getOrderDataProperty()). } /* This code is taking advantage of the ChangedProperties interface methods. If it returns true. If so.ATG Commerce Programming Guide µ Object[] savedProperties = null. if (repository == null) throw new InvalidParameterException(). */ CommerceIdentifier orderData = (CommerceIdentifier) DynamicBeans. // Check for null parameters if (order == null) throw new InvalidParameterException(). if (getSaveChangedPropertiesOnly()) { if (orderData instanceof ChangedProperties && (! ((ChangedProperties) orderData).getSaveAllProperties())) savedProperties = ((ChangedProperties) orderData). } /* Next a check is done to get the repositoryItem property from the object if it has 415 12 . } catch (ClassCastException e) { throw e. otherwise it sets the list of properties to save to the savedProperties property. String mappedPropName = null. In most cases it will be a GSA Repository which is mutable. if (orderManager == null) throw new InvalidParameterException(). then the local variable savedProperties is set to the entire list of properties defined in the SaveOrderDataObject. } else { savedProperties = getSavedProperties(). or take advantage of ChangedProperties. If getSaveChangedPropertiesOnly() returns false.properties file.Customizing the Purchase Process Externals . then a check is done to determine whether the orderData object implements ChangedProperties.toArray(). else savedProperties = getSavedProperties(). The first check is checking whether this processor is configured to save all properties always.getPropertyValue(order.

then the property will be saved to the repository. // should not happen } if (orderManager. "repositoryItem". if (! OrderRepositoryUtils.getClass(). then a lookup is done in the repository for the item and set if it has the property.getId().getMappedItemDescriptorName( orderData.getItemForUpdate(orderData.µ ATG Commerce Programming Guide a repositoryItem property defined. i++) { mappedPropName = getMappedPropertyName((String) savedProperties[i]).hasProperty(order.hasProperty("repositoryItem")) { hasProperty = true. if (hasProperty) DynamicBeans. */ for (int i = 0.getName())). */ boolean hasProperty = false.logDebug("save property[" + (String) savedProperties[i] + ":" + value + ":" + orderData.getId() + "]"). mutItem = (MutableRepositoryItem) DynamicBeans.0 to still work. if (DynamicBeans.getClass().getPropertyValue(orderData. } if (mutItem == null) { mutItem = mutRep. mappedPropName)) continue. i < savedProperties. orderData. etc.Customizing the Purchase Process Externals .getBeanInfo(orderData).length. 416 12 . mutItem). orderData.getName() + ":" + orderData. mappedPropName). } catch (PropertyNotFoundException e) { continue. try { value = OrderRepositoryUtils.setPropertyValue(orderData. determines if the property exists.isLoggingDebug()) orderManager. then this for loop can be eliminated. "repositoryItem"). The OrderRepositoryUtils class provides functionality which parses mapped property values and either gets the property values. orderTools. This code is preserved so it will allow classes created for DCS 5. If it does not have the repositoryItem property or its value is null. If your classes do not use the addChangedProperties() method in the set() methods of your beans.getPropertyValue(order. } /* This section loops through all the properties in the savedProperties array and if they exist in the object being saved.

All properties which should be saved should be listed here. } return SUCCESS.setSaveAllProperties(false). This requires that when a property is changed that it be marked # for saving. saveChangedPropertiesOnly=true # # # # # # # These are the properties of the OrderData object which will be saved to the repository. (String) savedProperties[i]. } catch (ConcurrentUpdateException e) { throw new CommerceException("Concurrent Update Attempt". } // for /* Here the repository item is updated to the repository.updateItem(mutItem).Customizing the Purchase Process Externals . value. Nothing needs to be defined for this property 417 12 . This is done here to catch any Concurrency exceptions. } /* Finally. The configuration file might look as follows: $class=my_package. If the name in the bean and repository are not the same then it can be mapped in the property propertyDescriptorToBeanPropertyMap below. This resets the object for more edits.clearChangedProperties(). By default a property name listed here will be saved to the corresponding repository item property with the same name.ProcSaveOrderDataObject # This property tells the processor to only save the properties which have # changed. */ if (orderData instanceof ChangedProperties) { ChangedProperties cp = (ChangedProperties) orderData. */ try { mutRep. cp. orderTools). the ChangedProperties Set is cleared and the saveAllProperties property is set to false. e). configure an instance of ProcSaveOrderDataObject by adding a SaveOrderDataObject. } } Next.saveRepositoryItem(mutRep. cp.ATG Commerce Programming Guide µ OrderRepositoryUtils. Then the SUCCESS value is returned. mutItem.properties file to your localconfig directory at /atg/commerce/order/processor/.

you should insert the processor into the pipeline immediately after the processor that references the new object. To insert the SaveOrderDataObject processor into the updateOrder pipeline.*. ProcLoadOrderDataObject. The updateOrder pipeline is defined in the commerce pipeline definition file. it is located at /<ATG9dir>/B2BCommerce/config/atg/commerce/. By convention.) First. package my_package. In ATG Business Commerce. see the Nucleus: Organizing JavaBean Components chapter in the ATG Programming Guide. commercepipeline. During deployment. If # there are any properties whose names differ. In ATG Consumer Commerce.Customizing the Purchase Process Externals . updateOrderObject. which performs the actual loading of most of the contained objects in the Order.order. write the Java source code for the new processor. setLastModifiedTime. import atg. # The format is repository_property_descriptor=bean_property_name propertyDescriptorToBeanPropertyMap= orderDataProperty=orderData Finally.*. import atg.java serves as an example. regardless of whether the commerce object hierarchy has been extended.xml. For more information on XML file combination. Step 6 of 7 – Add a Processor to Load the New Object You do not need to write new code to load the orderData reference in the Order object. The following Java source file. this file is located at /<ATG9dir>/B2CCommerce/config/atg/commerce/. the most appropriate place would be immediately after the updateOrderObject processor.µ savedProperties= ATG Commerce Programming Guide # This property maps a OrderRepository property descriptor to an OrderData # bean property. By default the processor will look for an OrderRepository # property descriptor which is the same as the bean property name. 418 12 .service. However. insert the SaveOrderDataObject processor into the updateOrder pipeline. they can be mapped here. Insert the new processor into the pipeline somewhere after the first processor.repository. to load the data into the OrderData object itself.commerce.xml files in the CONFIGPATH into a single composite XML file. the ATG platform uses XML file combination to combine the commercepipeline.*. import atg. The loadOrderObject processor in the loadOrder pipeline knows how to load all of the properties of the Order object.xml file by creating a new commercepipeline. see Loading Orders in the Configuring Purchase Process Services chapter. (For more information on loading and refreshing orders. For more information on how to add a processor to an existing pipeline. extend the commercepipeline. you must create a new processor that loads the data from the repository into the OrderData object and insert that new processor into the refreshOrder pipeline.xml file that defines the new processor and placing it in your localconfig directory at /atg/commerce/. refer to Processor Chains and the Pipeline Manager chapter. In this example. and before the last processor.pipeline.

*/ public class ProcLoadOrderDataObject extends LoadProperties implements PipelineProcessor { // These are the two valid return codes for this pipeline processor private final int SUCCESS = 1.util.*. import atg. } // property: orderDataProperty private String mOrderDataProperty = null.processor. public int[] getRetCodes() { int[] ret = {SUCCESS. import java.Customizing the Purchase Process Externals .beans. /* This class extends a class called LoadProperties. This class also implements the PipelineProcessor interface. public String getOrderDataProperty() { return mOrderDataProperty. return ret. FAILURE}. PipelineResult pResult) throws Exception { /* The pParam parameter contains the data required for executing this pipeline processor. // The constructor public ProcLoadOrderDataObject() { } // Returns the set of all valid return codes for this processor. This interface includes the runProcess() and getRetCodes() methods. } public int runProcess(Object pParam. private final int FAILURE = 2.*. This functionality corresponds to the loadProperties property and the propertyDescriptorToBeanPropertyMap property in the properties file which corresponds the this object. All pipeline processors must implement this interface.ATG Commerce Programming Guide µ import atg.commerce.*. 419 12 . This code extracts the required parameters for this processor.order. LoadProperties provides a set of properties and a way to retrieve a mapped property. } public void setOrderDataProperty(String pOrderDataProperty) { mOrderDataProperty = pOrderDataProperty.

getItemDescriptor(). /* Local variables.setPropertyValue(ci.getMappedBeanName(desc.newInstance(). mutItem). /* Next. its id property set to the repository item's id.µ */ ATG Commerce Programming Guide HashMap map = (HashMap) pParam.ORDERREPOSITORYITEM). the item descriptor is set to it.getOrderTools().ORDERMANAGER). mutItem.getBeanInfo(ci). MutableRepositoryItem orderItem = (MutableRepositoryItem) map. /* This section loops through all the properties in the loadProperties array and 420 12 .Customizing the Purchase Process Externals . */ MutableRepositoryItem mutItem = (MutableRepositoryItem) orderItem. Next it gets the orderData item descriptor. "repositoryItem". if (orderItem == null) throw new InvalidParameterException(). The third line of code does a lookup in the OrderTools object and returns the class mapped to the orderData item descriptor. "id". if (DynamicBeans. OrderManager orderManager = (OrderManager) map. // Check for null parameters if (order == null) throw new InvalidParameterException(). Object value. */ String mappedPropName.get(PipelineConstants. String[] loadProperties = getLoadProperties(). DynamicBeans. if (orderManager == null) throw new InvalidParameterException(). OrderTools orderTools = orderManager. /* This section of code first gets the orderData item descriptor from the order repository item.getItemDescriptorName()).setPropertyValue(ci. String className = orderTools. an instance of OrderData is constructed.hasProperty("repositoryItem")) DynamicBeans.getRepositoryId()). Order order = (Order) map.ORDER). */ CommerceIdentifier ci = (CommerceIdentifier) Class.forName(className). loadProperties lists all the properties which must be loaded for this object.get(PipelineConstants.get(PipelineConstants. and if the object has a repositoryItem property. RepositoryItemDescriptor desc = mutItem.getPropertyValue(getOrderDataProperty()).

} } /* If the loaded object implements ChangedProperties.ProcLoadOrderDataObject # These are the properties of the Order which will be loaded from the # repository. loadProperties= 421 12 . The configuration file might look as follows: $class=my_package. DynamicBeans. then clear the changedProperties Set.setPropertyValue(order. then this for loop can be eliminated. */ if (ci instanceof ChangedProperties) ((ChangedProperties) ci).getName() + ":" + ci. If the # name in the bean and repository are not the same then it can be mapped # in the property propertyDescriptorToBeanPropertyMap below.hasProperty(loadProperties[i])) { value = mutItem.getId() + "]"). if (orderManager. i++) { mappedPropName = getMappedPropertyName(loadProperties[i]).logDebug("load property[" + loadProperties[i] + ":" + value + ":" + ci.getPropertyValue(loadProperties[i]).length. return SUCCESS. Nothing needs # to be defined for this property. First we look for a mapping to the property value and then look to see if the property exists in the item descriptor. } } Next.ATG Commerce Programming Guide µ loads the property values from the repository into the object. If so. This code is preserved so it will allow classes created for DCS 5.setPropertyValue(order. OrderRepositoryUtils. The OrderRepositoryUtils class provides functionality which parses mapped property values and either gets the property values. getOrderDataProperty(). mappedPropName.Customizing the Purchase Process Externals . then we load it. configure an instance of ProcLoadOrderDataObject by adding a LoadOrderDataObject.clearChangedProperties().getClass(). value). etc.0 to still work. By default a property name listed here will be loaded from # the corresponding repository item property with the same name. */ for (int i = 0. i < loadProperties. return SUCCESS. Finally. Then set the orderData property in the Order object to ci. ci. If your classes use the getPropertyValue() method in the get() methods of your beans. ci). if (desc.properties file to your localconfig directory at /atg/commerce/order/processor/.isLoggingDebug()) orderManager. determines if the property exists.

loadOrderObjectForRefresh. you should insert the processor into the pipeline immediately after the processor that references the new object. propertyDescriptorToBeanPropertyMap= orderDataProperty=orderData Finally.xml file at /atg/dynamo/service/ in your localconfig directory. As previously mentioned. idspaces.Customizing the Purchase Process Externals . Insert the new processor into the pipeline somewhere after the first processor. create a new idspaces. you need to define an ID space for that descriptor. By default. see the Nucleus: Organizing JavaBean Components chapter in the ATG Programming Guide. orderData. commercepipeline. The refreshOrder pipeline is defined in the commerce pipeline definition file. all items use the item descriptor’s name as the ID space unless their item type inherits from another item type. To do so. To insert the LoadOrderDataObject processor into the refreshOrder pipeline. refer to the Processor Chains and the Pipeline Manager chapter. For more information on XML file combination. the ATG platform uses XML file combination to combine the idspaces. In the latter case. the most appropriate place would be immediately after the loadOrderObjectForRefresh processor. the ATG platform uses XML file combination to combine the commercepipeline. you need to modify the ID spaces definition file. Step 7 of 7 – Extend the ID Spaces Definition File Note: This step is only necessary when the new item descriptor is a root item descriptor.µ ATG Commerce Programming Guide # This property maps a OrderRepository property descriptor to an Order # bean property. they can be mapped here.xml. the items use the ID space name of the root item descriptor in the super-type hierarchy.xml file that defines the new processor and placing it in your localconfig directory at /atg/commerce/. During deployment.xml definition file.xml files in the CONFIGPATH into a single 422 12 . By convention. for more information on how to add a processor to an existing pipeline. Consequently. ATG Commerce IdGenerator guarantees that IDs within a named ID space are unique. and each root item descriptor defines the characteristics of its ID space in the idspaces. In the example used throughout this section.xml file by creating a new commercepipeline.xml. In ATG Business Commerce. you’ve defined a single root item descriptor. The item descriptor’s id-space-name attribute specifies which IdSpace supplies repository IDs for items of that item type.xml files in the CONFIGPATH into a single composite XML file. By default the processor will look for an OrderRepository # property descriptor which is the same as the bean property name. insert the LoadOrderDataObject processor into the refreshOrder pipeline. in order to define an ID space for that item descriptor. In this example. If a new item descriptor that you’ve defined is a root item descriptor. In ATG Consumer Commerce. During deployment. When an ID is requested for a new repository item. If # there are any properties whose names differ. extend the commercepipeline. this file is located at /<ATG9dir>/B2CCommerce/config/atg/commerce/. # The format is repository_property_descriptor=bean_property_name # The repository_property_descriptor name must be listed above in # loadProperties. it is requested from the appropriate IdSpace for that repository item. It does not need to be performed when the new item descriptor is a subclass of an item descriptor. it is located at /<ATG9dir>/B2BCommerce/config/atg/commerce/.

xml file might look as follows: <id-spaces xml-combine="append"> <id-space name="orderData" seed="1" batch-size="10000" prefix="od"/> </id-spaces> For more information on defining ID spaces and its impact on repository item IDs. you may need to extend some additional areas as well: • • If you extend an implementation of CommerceItem or ShippingGroup. you must change the methods used for merging orders so the additional information is copied to the destination order when merging orders. Other types of extensions require extensions to the form handler.mergeOrdersCopyShippingGroup to copy existing shipping groups from the source order to the destination order. if you’ve extended certain ATG Commerce classes to store additional information.Customizing the Purchase Process Externals .ATG Commerce Programming Guide µ composite XML file. depending on the type of the shipping group. and calling ShippingGroupManager. see the Nucleus: Organizing JavaBean Components chapter in the ATG Programming Guide. see the ID Generators section of the Core Dynamo Services chapter in the ATG Programming Guide. Manipulating Extended Objects Regardless of the method you use to extend purchase process objects (using an existing or new item descriptor). If you add custom properties to a CommerceItem. Merging Orders The standard process for merging orders involves OrderManager. However.mergeOrdersCopyCommerceItem() to copy existing commerce items from a source order to a destination order.mergeOrders() calling CommerceItemManager. you should subclass CommerceItemManager and override the mergeOrdersCopyCommerceItem method to first call the superclass method to do the basic copy and then copy your extended commerce item data. (For more information on XML file combination. • If you’ve extended CommerceItem.) The idspaces. you should subclass ShippingGroupManager and override the • 423 12 . This form handler is capable of handling new primitive data type properties automatically. you may need to override portions of CartModifierFormHandler. In the ShippingGroupManager. in turn. mergeOrdersCopyShippingGroup. See Handling Custom Commerce Item Properties in the Implementing Shopping Carts chapter of the ATG Commerce Guide to Setting Up a Store for more information. If you’ve extended HardgoodShippingGroup. you may need to make additional changes as described in Merging Orders in this chapter. calls either mergeOrdersCopyHardgoodShippingGroup or mergeOrdersCopyElectronicShippingGroup.

then the subclass should copy it to the destination order.Customizing the Purchase Process Externals .µ • • ATG Commerce Programming Guide mergeOrdersCopyHardgoodShippingGroup method to first call the superclass method to do the basic copy and then copy your extended commerce item data. the method can call the superclass mergeOrdersCopyShippingGroup method to handle the standard shipping group types. If you’ve created a new shipping group type that is neither a subclass of HardgoodShippingGroup nor ElectronicShippingGroup. Otherwise. you should subclass ShippingGroupManager and override the mergeOrdersCopyElectronicShippingGroup method to first call the superclass method to do the basic copy and then copy your extended commerce item data. If the shipping group is of the new type you created. If you’ve extended ElectronicShippingGroup. you should subclass ShippingGroupManager and override the mergeOrdersCopyShippingGroup method to examine the class of the shipping group. 424 12 .

The Pipeline Manager does so in a transactionally aware way. which make up a processor chain.Processor Chains and the Pipeline Manager . You can imagine a tree structure of processor chains as below: 425 13 .ATG Commerce Programming Guide µ 13 Processor Chains and the Pipeline Manager The Pipeline Manager is a system that executes a series of processors. supporting a subset of the transactional modes that EJB supports. but it is used primarily by ATG Commerce. The pipeline functionality is part of the main Dynamo Application Framework. which are linked in processor chains. The Pipeline Manager enables you to dynamically add and remove processors and chains of processors. The status code determines which processor in the chain to execute next. Each processor in the processor chain is a component that performs a specific function and returns a status code. A processor is a component that executes a piece of functionality and returns a status code. This chapter includes the following sections: Pipeline Manager Overview Using the Pipeline Editor Running a Processor Chain Creating a Processor Pipeline Pipelines and Transactions Extending the Processor Pipeline Classes Adding a Commerce Processor Using XML Combination Commerce Processor Chains Pipeline Manager Overview The Pipeline Manager controls a series of processors. The status code can determine which processor to execute next.

creates a new transaction. Notice that chains are allowed to split and merge together. FraudDetection. it will simply use that transaction for executing the pipeline. which would be the one that was passed to the pipeline manager. viewing and editing pipeline chains. then the Pipeline Manager either commits or rolls back the InventoryReserve transaction. and then resumes the original transaction before it executes the FraudDetection processor. If there was already an existing transaction. Next. and executes the code for InventoryReserve. An element in a processor chain can specify that it should be executed in the context of its own transaction.Processor Chains and the Pipeline Manager . Using the Pipeline Editor The Pipeline Editor in the ATG Control Center provides a graphical user interface for creating. and AddToOrder. This Add to Cart chain might contain the following elements in the given order: InventoryCheck. InventoryReserve. it calls each processor in sequence from InventoryCheck to AddToOrder without altering the transaction in any way. then the Pipeline Manager creates a new one. For example. When the InventoryReserve processor completes execution of its transaction.µ Processor C1 Processor A Processor B Processor C2 ATG Commerce Programming Guide Processor D0 Processor D1 Processor E Processor D2 The processors in the processor chain illustrated above would be executed from left to right. When the request reaches InventoryReserve. the InventoryReserve processor uses its own transaction to access the inventory. the Pipeline Manager suspends the current transaction. If a transaction had not been created. It might include a processor chain that is invoked when users add an item to their shopping cart. For a more concrete example. The following section covers the following topics: • • • Accessing the Pipeline Editor Opening an Existing Pipeline Definition Creating a New Pipeline Definition 426 13 . suppose you have a commerce site. when it reaches the Pipeline Manager.

make sure its manager is running.Processor Chains and the Pipeline Manager . 1.ATG Commerce Programming Guide µ • • • • • Editing Existing Pipeline Definitions Printing a Pipeline Definition Activating Verbose Mode Changing the Display Font of the Pipeline Editor Reinitializing the Pipeline Manager Accessing the Pipeline Editor The pipeline editor is part of the ATG Control Center. The pipeline definition displays in the ACC. 427 13 . The Pipeline Editor opens: Opening an Existing Pipeline Definition The following steps describe how to open an existing pipeline definition. If you have problems loading an existing definition. To access the pipeline editor. select Utilities > Pipeline Editor from the navigation menu of the ACC. Note: The pipeline manager component must be running for its definition to be loaded. Select the Pipeline Manager that you want to open from the list and click on the Open Pipeline Definition button. Click on the Open Pipeline Definition icon. 2.

5. Type a new Pipeline Chain name and select a new Transaction Mode. 4. 2.µ ATG Commerce Programming Guide Creating a New Pipeline Definition Follow these steps to create a new pipeline definition. You will see an empty definition with a single empty chain named PipelineChain1. 1. if necessary.Processor Chains and the Pipeline Manager . Right-click on the line between the new pipeline chain title and termination point and select Create Pipeline Link. Click on the New Pipeline Definition button. Enter a new pipeline link name and change the Transaction Mode and Processor Mode. 3. 428 13 . if necessary. Right-click on the Pipeline Chain title icon and select Edit Details.

The following example registers a new manager called MyPipelineManager and a new processor called MyProcessor: <pipeline-registry-configuration> <pipeline-manager-registry xml-combine="append-without-matching"> <pipeline-manager> <nucleus-path>/atg/commerce/MyPipelineManager</nucleus-path> </pipeline-manager> </pipeline-manager-registry> 429 13 . Save the pipeline definition by selecting one of the following from the File menu. The pipeline editor will automatically display the appropriate number of transitions for the selected processor. Processors are shown with their icon and the description is displayed in a tool tip. Adding New Pipeline Managers and Processors to the ACC The Pipeline Registry is used to register pipeline manager and pipeline processor components with the Pipeline Editor. To create new chain nodes. You can create a new pipeline manager and set its definition file to point to your new definition. select Edit->Insert Pipeline Chain or right click on any execution line and select Insert Pipeline Chain. (JNDI Processor Mode only )Enter a processor for the link or click on Choose Processor to select one from the available processors. Save diffs: Saves only the difference between the latest changes and the xml combined version of the definition file up to the previous layer. You can optionally specify additional properties for processors. The Pipeline Registry component is located at /atg/registry/PipelineRegistry and its associated XML file is pipelineRegistry. To register a new pipeline manager or processor. Repeat the steps for creating pipeline chains and links for the rest of the pipeline definition. This is because you can only open definitions associated with pipeline managers. 7. This ensures that information is not saved to the current layer that is already included in other layers.ATG Commerce Programming Guide µ 6.e. 8. The first pipeline chain node is automatically inserted for the user. The picker lists processors by category. and icon. you need to specify its Nucleus path in the XML file. Click on the check mark to close the pipeline link window. description. If you don’t register new components. Save all: The complete definition (i. 9. all chains and their processors) is completely written out to XML and all chains are marked as “xmlcombine=replace”. Note: If you create a new definition and later want to reopen it. category.xml. you won’t be able to see and select them in the editor. including a display name. you must associate the new XML file with an existing pipeline manager.Processor Chains and the Pipeline Manager . These new properties will be used in the processor picker dialog (edit a link node and for its Processor property hit “Choose Processor”). This ensures that this definition gets accepted when xml combination happens.

You can edit the properties of this node to set the link’s name.PipelineProcessor) are automatically represented as part of the node with separate execution paths. and processor name. You can edit the properties of this node to set the chain’s name and transaction mode. The icon above represents an individual link in a pipeline chain. The icon above represents the name of the pipeline chain. processor mode.service.Processor Chains and the Pipeline Manager . transaction mode.pipeline. 430 13 .µ ATG Commerce Programming Guide <processor-registry xml-combine="append-without-matching"> <processor> <nucleus-path>/atg/commerce/payment/MyProcessor</nucleus-path> <display-name>My Processor</display-name> <category>Payment</category> <description>A Custom Payment Processor</description> </processor> </processor-registry> </pipeline-registry-configuration> Editing Existing Pipeline Definitions Pipelines in the ACC are edited in a way similar to the way scenarios are edited. • • • copy and paste drag and drop processor elements undo and redo actions Overview of Pipeline Editor Interface This section describes the icons in the pipeline editor. You can perform the following editing functionality on editor nodes. the set of possible integer outcomes (as defined by the interface atg. Once you have specified the processor.

order.pipeline. Printing a Pipeline Definition Follow these steps to print the pipeline chains in the open pipeline definition.Processor Chains and the Pipeline Manager .service.commerce.ATG Commerce Programming Guide µ The icon above represents a link whose processor returns a special value. There are 2 predefined return codes with a special meaning: 0 (stop chain execution and commit) and –1 (stop chain execution and rollback).processor. Click on the Print icon. 1. The icon above represents a jump back to a prior link in the chain. Select one of the following and click on OK: Scale to Page: Prints entire pipeline definition on one page No Scaling: Prints pipeline definition at full size on multiple pages (if necessary). The same information is available by double clicking on 431 13 . The icon above represents a special link whose processor is an instance of atg. This processor executes a subchain and returns.PipelineProcessor. These are defined in atg. You can edit the node to change the destination. The information appears in popup window.ProcExecuteChain. 2. You can print any definition in the editor window. The icon above represents a stop in the execution of this path. Activating Verbose Mode Verbose mode allows you to view detailed information for pipeline nodes by moving your cursor over the node.

Select File… Edit pipeline manager component. Select Edit selected pipeline processor component. 1. You can activate verbose mode by selecting File…Set Verbose Mode On. and the possible destinations for a pipeline link. 2. set loggingDebugOnProcessors to true to turn debugging on for all processors in the definition.µ ATG Commerce Programming Guide a node or right clicking and choosing Edit Details In addition. Select a pipeline manager. Right-click on a pipeline link node. Pipeline Debugging You can access the component editors for pipeline manager and pipeline processor components to turn debugging on/off. 432 13 . you can turn it off by selecting File…Set Verbose Mode Off. By default. 3. When verbose mode is active. 2.Processor Chains and the Pipeline Manager . 1. Follow these steps to debug a definition. In the component editor. Follow these steps to debug an individual processor. A link’s destination is the next link to be executed if the current processor returns a certain value. the verbose tool tip lists the headlink for pipeline chains. verbose mode is turned off.

The PipelineManager first finds the requested chain. Follow these steps to reinitialize the pipeline manager. The runProcess() method in the PipelineChain managers execution of the processors. Reinitializing the Pipeline Manager When you deploy an application that includes ATG Commerce. set loggingDebug to true. an exception is thrown. If is not enabled. 1. Click on Save your changes. This is determined by what is defined in the PipelineChain object. The PipelineLink is responsible for three actions: • • • handling the transaction (if required) executing the processor. 2. If you make changes to a pipeline definition and you want the changes to take affect in the session you are currently running. A PipelineResult object or subclass of it is constructed. If the requested chain is enabled. 3. the pipeline manager is automatically reinitialized. Select a new font for the Scenario Editor. Select Tools > Preferences. For example. 3. The runProcess() method is called on the head PipelineLink object of the processor chain. Open an existing pipeline definition Modify the definition. delete a link in a chain or change a link to execute a different processor. In the component editor. 433 13 . 2. you must reinitialize the pipeline manager. and returning the return code to the PipelineChain.ATG Commerce Programming Guide µ 3. Click on the Reinitialize button to load the new definition into the pipeline manager. This section describes what happens when a processor chain is executed. Running a Processor Chain To execute a processor chain in the PipelineManager. 4. The Pipeline Editor uses the same font settings. make a call to the runProcess() method in the PipelineManager. PipelineManager calls runProcess() on it and passes it the user data. Click on the Fonts tab in the dialog box.Processor Chains and the Pipeline Manager . Changing the Display Font of the Pipeline Editor You can change the font that the pipeline editor uses to display the pipeline definitions in the ACC as follows: 1.

If a PipelineLink is returned. You can create and delete pipelines in two ways. This call returns another PipelineLink to execute or null. Creating a Processor Pipeline A processor pipeline consists of a Pipeline Manager and a set of processors. the transactions are handled and the PipelineResult object is returned. see the Creating and Editing Processor Chains Programmatically section.pipeline API. The return value of 0. then the above process repeats. It only can be used for initializing the globally scoped PipelineManager that is created during deployment. which can be organized into processor chains. These methods are called in the following order: These calls make the appropriate calls and construct any required objects for the execution of the processor in the context of the transaction mode. the transaction is rolled back if needed.Processor Chains and the Pipeline Manager . The runProcess() method is called between these methods and the return value of the call is returned to the PipelineChain. and this method exits throwing the appropriate exception object. When STOP_CHAIN_EXECUTION is returned. These calls are described in the Pipelines and Transactions section. Any non-globally scoped Pipeline Managers need to be created using the API. For more information. The API is provided for dynamic creation. For more information. editing. see the Pipeline Definition Files section.STOP_CHAIN_EXECUTION. which is mapped to the static variable PipelineProcessor. and deletion of processor chains and processors. four methods are called before and after the call to runProcess() in the PipelineProcessor.service. If a value other than STOP_CHAIN_EXECUTION is returned. through an XML file or through the atg. If null is returned. then an exception is thrown. STOP_CHAIN_EXECUTION can be returned from any PipelineProcessor. the PipelineChain calls getNextLink() on the PipelineLink just executed and passes it the return value it received. Any other return value from runProcess() indicates the next processor to execute. This provides you with a simple way to construct and manage the global PipelineManager without writing code. The following sections describe how to create a processor pipeline: • Configuring a Pipeline Manager 434 13 . regardless of whether it has next links or not. tells the PipelineManager that execution for this chain should stop normally.µ • • • • preChainTransaction() postChainTransaction() preLinkTransaction() postLinkTransaction() ATG Commerce Programming Guide To handle the transaction. You can initialize a Pipeline Manager with a set of processor chains at application deployment using an XML configuration file called a pipeline definition file.

a Pipeline Manager instance is located at /atg/commerce/PipelineManager. relative to your CONFIGPATH.service. as specified by the Pipeline Manager’s definitionFile property.pipeline. The default setting is: chainLockWaitTimeout=15000 Creating Processors Any Java class can act as a processor in a pipeline by implementing the atg. Pipeline Definition Files The contents of the processor chains controlled by a Pipeline Manager can be determined programmatically.Processor Chains and the Pipeline Manager . definitionFile Property The definitionFile property points to the XML file that defines the processor chains that can be run by the Pipeline Manager.xml The value of this property is a file pathname. chainLockWaitTimeout Property The chainLockWaitTimeout property determines the amount of time the request handling thread should wait for a processor chain to execute its processing of the request. or can be configured by an XML definition file. The value of this property is in milliseconds. Creating and Editing Processor Chains Programmatically. as described in the next section. This XML file can be anywhere in the CONFIGPATH. This section describes how to create an XML definition file for a Pipeline Manager. 435 13 .ATG Commerce Programming Guide µ • • • • Creating Processors Pipeline Definition Files Creating and Editing Processor Chains Programmatically Extending the PipelineChain and PipelineResult Classes Configuring a Pipeline Manager Each processor chain is controlled by a Pipeline Manager component. The PipelineProcessor interface has a single method: int runProcess(Object pParam. PipelineResult pResult) The runProcess() method returns an integer status code that the Pipeline Manager uses to determine the next processor to run. The Pipeline Manager has two properties you may want to configure: definitionFile and chainLockWaitTimeout.PipelineProcessor interface. The Pipeline Definition Files section describes how to create the XML file that defines the processor chains controlled by a Pipeline Manager. If you are using ATG Commerce. For example: definitionFile=/atg/userprofiling/registrationPipeline.

The valid modes are: TX_REQUIRED TX_REQUIRES_NEW TX_SUPPORTS TX_NOT_SUPPORTED TX_MANDATORY classname .service. This configuration file must be written in XML.(required) the name of the processor chain (for example: AddToCart). name . resultclassname . The valid modes are TX_REQUIRED TX_REQUIRES_NEW TX_SUPPORTS TX_NOT_SUPPORTED TX_MANDATORY 436 13 . Tag defining a given processor chain in the Pipeline Manager.the full name of a Java class which is to be instantiated and used as the PipelineChain object. The value must be this class or a subclass of it.Processor Chains and the Pipeline Manager .the full name of a Java class which is to be instantiated and used as the PipelineResult object. headlink . transaction .pipeline. tag.(required) the first processor in the chain to be executed. A pipeline definition file can use the following tags: Description The top level tag that encloses a definition of a Pipeline Manager. Must be unique. Must be unique.PipelineChain. transaction .µ Tag PipelineManager ATG Commerce Programming Guide Configuring processor chains with a pipeline definition file is useful for creating chains that are not edited or creating generic chains that will later be edited dynamically using the API based on some other criteria. The default is atg. A Pipeline Manager can include any number of processor chains.PipelineResult.the default transactional mode of all the processors in this chain. pipelinelink Defines a processor within the chain and names it. The value must implement PipelineResult. The default is atg.service. This corresponds to the id in the PipelineChain object.(required) a name for this processor (for example: CheckInventory).a transactional mode that overrides the default mode of the chain. each defined by a <pipelinechain> Attributes none pipelinechain name .pipeline.

PipelineChain" resultclassname CDATA "atg.(required) the name of a pipelineprocessor that will be executed if the return value of the current pipelineprocessor matches the returnvalue of this link. Document Type Definition for Pipeline Definition Files Pipeline definition files use the following XML document type definition: <!ENTITY %transactionmodes "(TX_REQUIRED|TX_REQUIRES_NEW|TX_SUPPORTS|TX_NOT_SUPPORTED|TX_MANDATORY)"> <!ELEMENT PipelineManager (pipelinechain*)> <!ELEMENT pipelinechain (pipelinelink*)> <!ATTLIST pipelinechain name ID #REQUIRED headlink IDREF #REQUIRED transaction %transactionmodes.ATG Commerce Programming Guide µ class ..the processor class to be referenced to.. processor The name of the PipelineProcessor object.PipelineResultImpl"> <!ELEMENT pipelinelink (processor. jndi .service. "TX_REQUIRED"> <!ELEMENT processor EMPTY> <!ATTLIST processor class CDATA #IMPLIED jndi CDATA #IMPLIED> <!ELEMENT transition EMPTY <!ATTLIST transition 437 13 .transition*)> <!ATTLIST pipelinelink name ID #REQUIRED transaction %transactionmodes. transition A reference to the next link to be executed mapped by a return value. link ..(required) an integer string that is used to define the next pipeline element. then the object is resolved through JNDI and its reference is used as the pipeline element.the processor class to be instantiated or referenced to. If the attribute is of the form packagename. returnvalue .Processor Chains and the Pipeline Manager .. If it is of the form jndi://.pipeline.classname then a new object is to be created./..service. "TX_REQUIRED" classname CDATA "atg.pipeline. The object is resolved through JNDI and its reference is used as the processor.

is an example of a pipeline definition file that might be used for initializing a pipeline.commerce.commerce.addD"/> </pipelinelink> <pipelinelink name="proc6" transaction="TX_NOT_SUPPORTED"> <processor class="atg.pipeline. <?xml version="1.PipelineMonoChain"> <pipelinelink name="proc99"> <processor class="atg.addE"/> <transition returnvalue="1" link="proc6"/> <transition returnvalue="2" link="proc7"/> <transition returnvalue="3" link="proc2"/> </pipelinelink> <pipelinelink name="proc4"> <processor class="atg.addB"/> <transition returnvalue="1" link="proc4"/> <transition returnvalue="2" link="proc5"/> </pipelinelink> <pipelinelink name="proc3"> <processor class="atg.0"?> <!DOCTYPE PipelineManager SYSTEM "PipelineManager.Processor Chains and the Pipeline Manager .commerce.commerce.commerce.commerce.removeA"/> </pipelinelink> 438 13 .addA"/> <transition returnvalue="1" link="proc2"/> <transition returnvalue="2" link="proc3"/> </pipelinelink> <pipelinelink name="proc2" transaction="TX_REQUIRES_NEW"> <processor class="atg.µ returnvalue CDATA #REQUIRED link IDREF #REQUIRED> ATG Commerce Programming Guide Pipeline Definition File Example The following file.addF"/> </pipelinelink> <pipelinelink name="proc7" transaction="TX_SUPPORTS"> <processor jndi="/dynamo/atg/commerce/addG"/> </pipelinelink> </pipelinechain> <pipelinechain name="RemoveFromCart" transaction="TX_REQUIRED" headlink="proc99" classname="atg.commerce.addC"/> </pipelinelink> <pipelinelink name="proc5" transaction="TX_REQUIRES_NEW"> <processor class="atg.xml. PipelineManager.dtd"> <PipelineManager> <pipelinechain name="AddToCart" transaction="TX_REQUIRED" headlink="proc1"> <pipelinelink name="proc1"> <processor class="atg.service.

addA and set the PipelineLink’s processor reference to this object.commerce.commerce. which specifies the name of a PipelineProcessor defined later in the file.0"?> The following line says that this is a XML file and that its DTD (document type definition) is in the file PipelineManager.addA"/> <transition returnvalue="1" link="proc2"/> <transition returnvalue="2" link="proc3"/> </pipelinelink> The next section defines two additional PipelineLinks.xml file is described below.0 specification.commerce. <PipelineManager> The following line begins the definition for a chain named AddToCart. The default transactional mode of the PipelineLinks is TX_REQUIRED.commerce. A <PipelineManager> tag encloses all of the processor chain definitions. TX_REQUIRES_NEW. Both proc2 and proc3 are defined later in the file. <pipelinechain name="AddToCart" transaction="TX_REQUIRED" headlink="proc1"> The next section is the definition of a PipelineLink with name proc1 and PipelineProcessor class name atg. The first line says that this file compiles with the XML version 1. It is like the previous except that proc2 has defined an overriding transactional mode. This PipelineLink has two transitions coming out of it. one with return value 1 which links to proc2 and one with return value 2 which links to proc3.addA. <pipelinelink name="proc2" transaction="TX_REQUIRES_NEW"> <processor class="atg.Processor Chains and the Pipeline Manager . <pipelinelink name="proc1"> <processor class="atg.ATG Commerce Programming Guide µ </pipelinechain> </PipelineManager> Each section of the PipelineManager. <!DOCTYPE PipelineManager SYSTEM "PipelineManager. The PipelineManager initialization routine will construct the object atg.dtd. The head link is proc1.addB"/> <transition returnvalue="1" link="proc4"/> <transition returnvalue="2" link="proc5"/> </pipelinelink> <pipelinelink name="proc3"> 439 13 . <?xml version="1.dtd"> This following line is the start of the PipelineManager definition.

headlink proc99. this processor is defined with a JNDI reference as jndi="/dynamo/atg/commerce/addG".commerce.service.pipeline.Processor Chains and the Pipeline Manager .PipelineMonoChain"> <pipelinelink name="proc99"> <processor class="atg.commerce.commerce. The final line is the closing </pipelinechain> tag for the processor chain.addD"/> </pipelinelink> <pipelinelink name="proc6" transaction="TX_NOT_SUPPORTED"> <processor class="atg. This JNDI reference will be resolved at initialization time and used as the processor for this link. some with overriding transactional modes. It specifies that the classname to be used for the construction of the PipelineChain is called PipelineMonoChain. Creating and Editing Processor Chains Programmatically The following section describes various ways to construct or edit a processor chain using the API.commerce. 440 13 .addF"/> </pipelinelink> <pipelinelink name="proc7" transaction="TX_SUPPORTS"> <processor jndi="/dynamo/atg/commerce/addG"/> </pipelinelink> </pipelinechain> The last section defines another PipelineChain called RemoveFromCart with default transaction mode TX_REQUIRED. start the Pipeline Manager component to construct the PipelineManager and its chains automatically. Instead of using a Java class name definition. <pipelinechain name="RemoveFromCart" transaction="TX_REQUIRED" headlink="proc99" classname="atg. <pipelinelink name="proc4"> <processor class="atg.commerce. The last line is the closing tag that closes off the PipelineManager definition. The interesting part of this section is the processor definition for proc7.removeA"/> </pipelinelink> </pipelinechain> </PipelineManager> After the XML file is defined.addE"/> <transition returnvalue="1" link="proc6"/> <transition returnvalue="2" link="proc7"/> <transition returnvalue="3" link="proc2"/> </pipelinelink> This section defines four more PipelineLink objects.µ ATG Commerce Programming Guide <processor class="atg.addC"/> </pipelinelink> <pipelinelink name="proc5" transaction="TX_REQUIRES_NEW"> <processor class="atg.

This call will block until there are no threads executing the chain and a lock can be obtained. The createChain() method constructs the appropriate PipelineChain object and sets the proper return type into it. If the lock reference is the same as the requesting thread. Call the PipelineManager’s method createChain(). If the lock reference of the chain is null.When you lock a chain. addTransition() is called to create any additional transitions between links. If this count is greater than 0. which means that the chain is already locked by another thread. 2. using the lockChain() method of the PipelineManager. Call enableChain() to allow execution on it and unlockChain() to allow other threads to edit the chain. setHeadLink(). For all other cases an exception is thrown. then the blocked call is notified and the lockChain() method continues. It implicitly locks and disables the chain and then adds it to the Pipeline Manager. then the lock is granted. as described in the preceding Creating a New Processor Chain from Scratch section. When the reference count reaches 0. the PipelineManager gets a reference to the calling thread and stores it within the requested chain.ATG Commerce Programming Guide µ Locking and Synchronization for Editing Processor Chains When you edit a processor chain. Portions of the lockChain() and unlockChain() methods need to be synchronized. Otherwise. then the call to lockChain() blocks until the reference count is 0. Call setHeadLink(). Creating a New Processor Chain from Scratch To create a new processor chain using the API: 1. all the threads sleeping on the runProcess() call will be notified. 1. and addTransition() methods of the PipelineManager. Editing an Existing Processor Chain Follow these steps to edit an existing processor chain. 2. addTransition(). These last two calls must be made in this order. and removeTransition() to edit the chain. 441 13 . setHeadLink() is called to set the first link object into the chain. createLink() is called to create all the PipelineLink objects that will be used in this chain and to link them together. The lock cannot be granted if there are threads executing in the requested chain. Edit the chain by making calls to the createLink(). you must first obtain a lock on the chain. Once this happens. particularly those with sections that check the lock reference and set it. once that method is called. The chain keeps a reference count for all the threads executing within it. To prevent starvation of the lockChain() call. 3.Processor Chains and the Pipeline Manager . other threads attempting to call runProcess() will sleep until unlockChain() is called. an exception will be thrown because enableChain() requires the caller to have a lock on the chain. Call lockChain(). createLink(). then the chain is already locked by the caller and execution falls through.

addTransition().Processor Chains and the Pipeline Manager . Call enableChain() and unlockChain() on the new chain. newChainName). Replacing an Existing Processor Chain Follow these steps to remove a chain and replace it with a new version of the same chain. Call enableChain() to allow execution on it and unlockChain() to allow other threads to edit the chain. using the setHeadLink(). This will replace the chain that has the same name as the new chain. and removeTransition() methods. These last two calls must be made in this order or an exception will be thrown. 3. 4. Create a copy of the chain you want to replace by calling duplicateChain() and passing the chainId. 1. Pipeline Link 1 is the head of the chain. Edit the new chain. Creating a New Processor Chain from an Existing Chain Follow these steps to create a chain based on an existing chain in the PipelineManager. as described in the Editing an Existing Processor Chain section. The transition from Pipeline Link 3 to Pipeline Link 4 is removed. Call copyChain(oldChainName. createLink(). 3. Call replaceChain() with the new chain as the argument. 2. in that order. ATG Commerce Programming Guide Call unlockChain() to release the lock and allow execution of the chain to resume. Edit the new chain if required. because enableChain() requires the caller to have a lock. which will be replaced as the argument. This returns a copy of the chain with a new name. 5. 442 13 . This call will return a duplicate disabled copy of that chain.µ 3. Pipeline Link 1a is inserted after Pipeline Link 1 and before Pipeline Link 2 and Pipeline Link 3. 1. The following before and after diagram demonstrates adding and removing transitions. Call lockChain() on the chain that is to be replaced. as described in the Editing an Existing Processor Chain section. Adding and Removing Transitions to and from a Processor Chain Adding and removing transitions to and from a processor chain requires the use of the addTransition() and removeTransition() methods. 2. The new chain is locked and disabled.

This creates the transition from Pipeline Link 1 to Pipeline Link 1a Call addTransition() twice to add the two transitions to Pipeline Link 2 and Pipeline Link 3. This 443 13 . The only difference is that you need to use another version of the createChain() method. Remove the two transitions from Pipeline Link 1 by doing the following: Get references to Pipeline Link 2 and Pipeline Link 3. and 1. This insures that no thread executes in the chain and no other thread edits this chain.service.service. Call lockChain() in the PipelineManager with the chainId. This version of createChain() takes one argument and constructs and returns an object of type atg.PipelineChain (the default). If you subclass PipelineChain and PipelineResult.Processor Chains and the Pipeline Manager . Call removeTransition() twice to remove the two transitions that come from Pipeline Link 1. Call createLink() in the PipelineChain to create Pipeline Link 1a.PipelineResult will be the object used for that chain’s PipelineResult object. 2. Call unlockChain() on the chain.pipeline.pipeline. Creating and Editing Processor Chains Programmatically. a reference to the link whose ID is Pipeline Link 1. you can create a processor chain with your subclass in the same way you create a chain using the default PipelineChain and PipelineResult objects. 6. atg. Call removeTransition() with arguments Pipeline Link 3 and 1. 5. a PipelineProcessor object.ATG Commerce Programming Guide µ Pipeline 1 Link 2 Pipeline Link 4 Pipeline 1 Link 2 Pipeline Link 1 1 Pipeline Link 4 Pipeline Link 3 1 Pipeline Link 1 1 2 Pipeline Link 1a 1 2 Pipeline Link 3 1. showed how to create processor chains using the default version of the createChain() method. 3. This removes the transition from Pipeline Link 3 to Pipeline Link 4. The arguments to createLink() will be as follows: Pipeline Link 1a. 4. Extending the PipelineChain and PipelineResult Classes The examples in the preceding section.

except that it accepts two String arguments. TransitionException This creates a PipelineMonoLink object instead of a PipelineLink object and returns it to the caller. If there is. then a TransitionException would be thrown. To create the PipelineMonoChain class. the link is mapped. The PipelineMonoChain class overrides the following methods in PipelineChain: createLink().µ Example ATG Commerce Programming Guide createChain() method does the same thing. The main difference is that if aFromLink already has a transition coming out of it. then a TransitionException is thrown. Otherwise. int aRetCode. For PipelineMonoChain to instantiate a PipelineMonoLink. Otherwise execution on the chain ends and the PipelineResult is returned to the caller. Your subclass should include a new version of addTransition() with the following signature: void addTransition(PipelineMonoLink aFromLink. PipelineProcessor aProc. PipelineMonoLink aToLink) throws TransitionException 444 13 . which is a special type of PipelineLink object that only allows a single transition out of it. so each PipelineLink object transitions only to a single PipelineLink. addTransition().service. In PipelineLink. This PipelineChain subclass represents a singly linked list. The code would look like this: protected PipelineLink instantiatePipelineLink(String pLinkId) { return new PipelineMonoLink(pLinkId). int aRetCode) throws CreateLinkException. This example uses a specialized version of PipelineChain called PipelineMonoChain. The aRetCode value has a slightly different meaning in PipelineMonoLink. then the transition is followed. the instantiatePipelineLink method must be overridden to return a new instance of a PipelineLink subclass. It extends atg.pipeline. These String arguments identify the classes to be used for the PipelineChain and PipelineResult objects.Processor Chains and the Pipeline Manager . The declaration of createLink() looks like this: public PipelineMonoLink createLink(String aLinkId. the TransitionException is thrown if the aRetCode was already mapped in aFromLink.PipelineLink. PipelineLink aFromLink. and the two removeTransition() methods. the first step is to subclass PipelineChain. } The addTransition() method checks to see if there is a transition coming out of aFromLink. The subclass’s createLink() method returns PipelineMonoLink. If its value is returned from the PipelineProcessor for that link.

The type in the method above is PipelineMonoLink. rather than PipelineLink. This method would only be called if a PipelineLink (or subclass) that is not a PipelineMonoLink were passed as one of the arguments. It overrides PipelineChain and PipelineLink to force the objects to allow each link to have only one transition. The removeTransition() methods that take PipelineLink objects should again be overridden explicitly and exceptions thrown. The removeTransition() method checks to see if a transition is coming out of aFromLink. The reason PipelineChain is overridden is to create PipelineMonoLink objects rather than PipelineLink objects. as in PipelineChain. getNextLinks().Processor Chains and the Pipeline Manager . If none exists then a TransitionException is thrown.ATG Commerce Programming Guide µ This differs from the addTransition() in PipelineLink by the first and third arguments. The PipelineMonoLink enforces this. If one does exist then the transition would be removed. a getNextLink() method should be defined that takes no arguments and returns a PipelineMonoLink. The inherited getNextLink(int aRetCode) method should just call the one with no arguments and return the PipelineMonoLink object that is cast to a PipelineLink. insert it into an array and return it. Again. new versions of removeTransition() should be added with the following signatures: void removeTransition(PipelineMonoLink aFromLink. The PipelineMonoLink object needs to extend PipelineLink. New methods that are specific to this implementation need to be defined and the following methods need to be overridden: getNextLink(). getNextLink(int aRetCode) should just return the PipelineMonoLink object that is mapped to the link that called the method. The PipelineMonoLink would contain the following methods: public public public public public public PipelineMonoLink getNextLink() PipelineLink getNextLink(int aRetCode) PipelineMonoLink getNextLinks() PipelineLink[] getNextLinks(int[] aRetCodes) int getRetCode() int[] getRetCodes() Although it takes a return code parameter. For cleanliness. 445 13 . The getNextLinks(int[] aRetCodes) method should also just call getNextLinks() and ignore the aRetCodes and put the PipelineMonoLink into a PipelineLink array. which provide for PipelineMonoLink objects to be passed as parameters rather than PipelineLink objects. PipelineMonoLink aToLink) throws TransitionException These differ again by the arguments. The int[] getRetCodes() method should again just call getRetCode() and take the return value. This should be explicitly overridden and the code should throw a TransitionException. int aRetCode) throws TransitionException void removeTransition(PipelineMonoLink aFromLink. The addTransition() method in PipelineLink however still exists and has not been overridden. and getRetCodes(). The example in this section implements a singly linked chain.

The processor then executes its code. each processor has the ability to mark the chain execution to be rolled back. If there is no transaction available when the pipeline manager is called. This table describes each transaction mode and what the Pipeline Manager does for each of those modes. The current transaction is suspended. If one is not available it will still execute. the processor executes.Processor Chains and the Pipeline Manager . then it is suspended. otherwise an error occurs. This means that as it executes the processors in its processor chains. If a transaction is present. see the Transaction Management chapter in the ATG Programming Guide. and then the transaction is resumed. The processor can be executed in a transaction. The processor is not to be executed in a transaction. The Pipeline Manager relies on the Java Transaction API (JTA) for its transactional needs. At completion. but without a transaction. the transaction is either committed or rolled back. TX_REQUIRED The pipeline processor requires that a transaction be present for execution. It will execute in the context of a transaction is one is available.µ Pipelines and Transactions ATG Commerce Programming Guide The Pipeline Manager is transactionally aware. then the manager will create one and use it for execution of the pipeline. This means that a transaction must already be in place. then it is committed when the chain has finished executing. If none of the processors mark the transaction. TX_REQUIRES_NEW TX_NOT_SUPPORTED TX_SUPPORTS TX_MANDATORY 446 13 . For more information about JTA transactions in the ATG platform. The original transaction is then resumed. The pipeline processor requires its own transaction for execution. A new transaction is created before the execution. A processor may handle transactions in one of five modes: TX_REQUIRED TX_REQUIRES_NEW TX_NOT_SUPPORTED TX_SUPPORTS TX_MANDATORY Processor Transaction Management Transaction management refers to the action of executing PipelineProcessors in the context of their defined transaction modes. otherwise it will not be. The transaction is not automatically committed after the request. If the PipelineManager created the transaction then it will be committed after the processor completes.

PipelineResult: an interface that provides access to the pipeline execution error data. The atg. A more flexible way to span transactions over subsets of a chain is to break the subset into a new chain and then execute that chain within a processor of another chain. It must either span an entire chain or one element of a chain.service.pipeline. An example of this was given in the Extending the PipelineChain and PipelineResult Classes topic of the Creating a Processor Pipeline section.Processor Chains and the Pipeline Manager . This new chain should have all its processors marked as either TX_REQUIRES or TX_MANDATORY.service.pipeline package: PipelineManager A global GenericService that controls the management of the pipelines and the execution of requests in the pipelines. An object that contains data about a PipelineChain and a reference to PipelineChainConfiguration the chain itself. you can code the logic for the subset of the chain to be in one processor and then set the transaction mode for that processor to TX_REQUIRES_NEW.pipeline API for customized behavior. 447 13 .pipeline API contains two interfaces that allow the objects in the system to be customized: atg.service. This object is used internally in the PipelineManager.service.service. atg. The processor of the calling chain should have its mode set to TX_REQUIRES_NEW. It also manages the execution and editing of the PipelineLinks.ATG Commerce Programming Guide µ Spanning Transactions over a Chain Subset Transactions cannot span a subset of the chain. PipelineChain An object that contains a PipelineLink to the first PipelineProcessor for a given chain. The following table summarizes the classes in the atg.PipelineProcessor: an interface that is implemented by the processor components that the Pipeline Manager executes.pipeline. Its main method is runProcess(). Extending the Processor Pipeline Classes You can extend the atg. If a transaction must only support a subset of a chain.

Adding a Commerce Processor Using XML Combination There are two ways to extend a pipeline defined for a PipelineManager. It is used by the PipelineChain to call the runProcess() method on the component and then get the reference to the next processor based on the return value. PipelineManagerException The base exception object extended by all exceptions thrown from methods in the atg. This is the default PipelineResult object created by the PipelineManager PipelineResult when a chain is executed if no other PipelineResult object is specified.µ PipelineLink ATG Commerce Programming Guide An object that contains a reference to a PipelineProcessor and a mapping of return values to next processors. Using XML combination is the preferred approach. An object that implements the PipelineResult interface. The other way is to use XML combination. <pipelinechain name="processOrder" transaction="TX_REQUIRED" headlink="executeValidateForCheckoutChain"> <pipelinelink name="executeValidateForCheckoutChain" transaction="TX_MANDATORY"> <processor jndi="/atg/commerce/order/processor/ExecuteValidateForCheckoutChain"/> <transition returnvalue="1" link="checkForExpiredPromotions"/> </pipelinelink> <pipelinelink name="checkForExpiredPromotions" transaction="TX_MANDATORY"> <processor jndi="/atg/commerce/order/processor/CheckForExpiredPromotions"/> <transition returnvalue="1" link="removeEmptyShippingGroups"/> </pipelinelink> 448 13 . The example below demonstrates of how to use XML combination to modify a pipeline chain.Processor Chains and the Pipeline Manager .pipeline package. One is to copy the entire XML file into your CONFIG layer and make the necessary changes. The XML below is a section of the processOrder pipeline chain as it appears out of the box.service.

If it did contain an error. The PipelineManager is a component that executes a series of processors. Commerce Processor Chains Some commerce processes are executed using the PipelineManager. <pipelinemanager> <pipelinechain name="processOrder" transaction="TX_REQUIRED" headlink="executeValidateForCheckoutChain" xml-combine="append"> <pipelinelink name="executeValidateForCheckoutChain" transaction="TX_MANDATORY" xml-combine="replace"> <processor jndi="/atg/commerce/order/processor/ExecuteValidateForCheckoutChain"/> <transition returnvalue="1" link="purgeExcessOrderData"/> </pipelinelink> <pipelinelink name="purgeExcessOrderData" transaction="TX_MANDATORY"> <processor jndi="/atg/commerce/order/processor/PurgeExcessOrderData"/> <transition returnvalue="1" link="checkForExpiredPromotions"/> </pipelinelink> </pipelinechain> </pipelinemanager> The purgeExcessOrderData processor’s transition is what the executeValidateForCheckoutChain's transition is in the base file within the commerce platform. These return values are configurable in the properties file. The execution of a pipeline chain is usually wrapped in a method call that eliminates the need for interacting directly with the PipelineManager. 449 13 . The important sections of this code are the additions of the xml-combine attributes in the pipelinechain and pipelinelink tags. The following XML code should be added to your config layer. The pipelinechain tag indicates what is being appended to its contents. The key to the ProcExecuteChain execution is its return value. each of which accomplish a task.ATG Commerce Programming Guide µ The following example demonstrates how to add a new processor called purgeExcessOrderData between the executeValidateForCheckoutChain and checkForExpiredPromotions processors in the processOrder pipeline chain. The property file of the ProcExecuteChain is configured with a PipelineManager and a chain name to execute. otherwise it will return SUCCESS (SUCCESS is mapped to the value 1 by default). Executing Processor Chains from Processors within Other Chains A processor uses another processor called ProcExecuteChain to execute a subchain.Processor Chains and the Pipeline Manager . The pipelinelink tag for executeValidateForCheckoutChain indicates what is replacing its contents. The value it returns is not that of the last processor in the chain that it executed. but rather whether or not the result object contains errors. ProcExecuteChain will return STOP_CHAIN_EXECUTION_AND_ROLLBACK. This series of processors is called a pipeline.

repriceOrder Pipeline Chain: Prices the order moveToConfirmation Pipeline Chain: Prices the order and validates it. the related XML configuration file is defined in <ATG9dir/B2BCommerce/config/atg/commerce/commercepipeline. The updateOrder() method adds the given Order and the OrderManager to its parameter list.µ ATG Commerce Programming Guide For information editing pipeline chains. validateNoApproval Pipeline Chain: Validates an order that does not require approval. see the Adding a Commerce Processor Using XML Combination section in this chapter. refreshOrder Pipeline Chain: Reloads an order after an error and causes the unloaded portion of an Order to be loaded when accessed. validatePostApproval Pipeline Chain: Revalidates an order after approval.xml. the related XML configuration file is defined in <ATG9dir>/B2CCommerce/config/atg/commerce/commercepipeline. The following pipeline chains are defined in commercepipeline. The updateOrder pipeline chain is executed by the updateOrder() method in the OrderManager. In ATG Consumer Commerce. moveToPurchaseInfo Pipeline Chain: Validates the order. The pipeline chain’s transaction mode is TX_REQUIRED. For information on how to extend a pipeline defined for a PipelineManager. updateOrder Pipeline Chain The updateOrder pipeline saves the Order supplied to it. In ATG Business Commerce. sendScenarioEvent Pipeline Chain: Sends a message to the Dynamo Message System. The following list describes each processor in the pipeline chain: 450 13 .xml. The PipelineManager Nucleus component for ATG Commerce is located at /atg/commerce/PipelineManager. see the Using the Pipeline Editor section and the Adding a Commerce Processor Using XML Combination section in this chapter. validateShippingInfo Pipeline Chain: Validates the shipping groups in the order.Processor Chains and the Pipeline Manager . Each of these chains is described in detail in this chapter: • • • • • • • • • • • • • • updateOrder Pipeline Chain: Saves the order supplied to it.xml. validateForCheckout Pipeline Chain: Verifies that the order is ready for checkout. validatePaymentGroupsPostApproval Pipeline Chain: Validates each payment group in an order after the order has been approved. processOrder Pipeline Chain: Submits the given order for checkout. recalcPaymentGroupAmounts Pipeline Chain: Regenerates the amount that must be assigned to each PaymentGroup in the order. loadOrder Pipeline Chain: Loads the order from the repository whose ID is supplied as a parameter. which is supplied to the executing chain.

PipelineLink Name: updateShippingGroupObjects This processor saves the properties in the ShippingGroup objects in the Order. Transactional mode: TX_MANDATORY Nucleus component: /atg/commerce/order/processor/SaveHandlingInstructionObjects PipelineProcessor object: atg.commerce.order.ProcSaveCommerceItemObjects Transitions: return value of 1 will execute updateShippingGroupObjects next 3.order.processor.ProcSavePaymentGroupObjects Transitions: return value of 1 will execute updatePaymentStatusObjects next 6. PipelineLink Name: updateHandlingInstructionObjects This processor saves the properties in the HandlingInstruction objects in all the ShippingGroups in the Order.Processor Chains and the Pipeline Manager . Transactional mode: TX_MANDATORY Nucleus component: /atg/commerce/order/processor/SavePaymentStatusObjects PipelineProcessor object: 451 13 .processor.commerce.commerce.commerce.processor.processor.order. Transactional mode: TX_MANDATORY Nucleus component: /atg/commerce/order/processor/SaveCommerceItemObjects PipelineProcessor object: atg.ATG Commerce Programming Guide µ 1. PipelineLink Name: updatePaymentGroupObjects This processor saves the properties in the PaymentGroup objects in the Order. PipelineLink Name: updatePaymentStatusObjects This processor saves the properties in the PaymentStatus objects in all the PaymentGroups in the Order. PipelineLink Name: updateOrderObject This processor saves the properties in the Order object.ProcSaveHandlingInstructionObjects Transitions: return value of 1 will execute updatePaymentGroupObjects next 5.order.commerce. PipelineLink Name: updateCommerceItemObjects This processor saves the properties in the CommerceItem objects in the Order. Transactional mode: TX_MANDATORY Nucleus component: /atg/commerce/order/processor/SaveShippingGroupObjects PipelineProcessor object: atg.processor.ProcSaveShippingGroupObjects Transitions: return value of 1 will execute updateHandlingInstructionObjects next 4.ProcSaveOrderObject Transitions: return value of 1 will execute updateCommerceItemObjects next 2. Transactional mode: TX_MANDATORY Nucleus component: /atg/commerce/order/processor/SavePaymentGroupObjects PipelineProcessor object: atg. Transactional mode: TX_MANDATORY Nucleus component: /atg/commerce/order/processor/SaveOrderObject PipelineProcessor object: atg.order.

ProcSavePaymentStatusObjects Transitions: return value of 1 will execute updateRelationshipObjects next PipelineLink Name: updateRelationshipObjects This processor saves the properties in the Relationship objects in the Order.ProcSetLastModifiedTime Transitions: None.processor.commerce.order. Transactional mode: TX_MANDATORY Nucleus component: /atg/commerce/order/processor/SaveRelationshipObjects atg. PipelineLink Name: updatePriceInfoObjects This processor saves the properties in the OrderPriceInfo and TaxPriceInfo objects in the Order. this is the last link in the chain and causes the PipelineManager to return to the caller. If you are not using CSC. changes at checkout time do not affect the adjustment. and the ItemPriceInfo object in the CommerceItems. By default. Transactional Mode: TX_MANDATORY Nucleus component: /atg/commerce/order/processor/SaveManualAdjustments Transitions: return value of 1 will execute setLastModifiedTime next 10. Transactional mode: TX_MANDATORY Nucleus component: /atg/commerce/order/processor/SetLastModifiedTime PipelineProcessor object: atg. Warning: Manual adjustments are changes to an order made by an agent using the ATG Commerce Service Center. this step does not apply. If you want to apply manual adjustments to incomplete orders. If an adjustment is applied to an incomplete order.commerce. Transactional mode: TX_MANDATORY Nucleus component: /atg/commerce/order/processor/SavePriceInfoObjects PipelineProcessor object: atg. set the saveIncompleteOrderAdjustments property to true in the 452 13 . the ShippingPriceInfo object in the ShippingGroups. this behavior is configurable.commerce.commerce. it affects the order’s price regardless of the order’s contents.order.order. the processor is configured not to save manual adjustments for incomplete orders.ProcSavePriceInfoObjects Transitions: return value of 1 will execute saveManualAdjustments next 9. PipelineLink Name: saveManualAdjustments This processor updates the order for any manual adjustments made by agents in the Commerce Service Center application. and the customer removes items. for example. See Warning below.µ 7.Processor Chains and the Pipeline Manager . However. if a $20 credit is manually applied to an incomplete order. Once an adjustment has been added. PipelineLink Name: setLastModifiedTime This processor sets the lastModifiedTime property of an Order to the current time if any changes were made to an Order. in which case the adjustment is discarded if the agent does not check out the order.ProcSaveRelationshipObjects Transitions: return value of 1 will execute updatePriceInfoObjects next 8. the order could end up with a $0 total. PipelineProcessor object: ATG Commerce Programming Guide atg. Manual adjustments are applied unconditionally by the OrderAdjustmentCalculator (see the ATG Commerce Service Center User Guide for information on this class).processor.order.processor.processor.

It then sets the PriceInfo to the corresponding object in the Order. incompleteStates^=/atg/commerce/order/OrderLookupService. PipelineLink Name: loadPriceInfoObjectsForOrder This processor constructs a new OrderPriceInfo and TaxPriceInfo object for the Order it loads and loads the properties from the repository into it. depending on the value of saveIncompleteOrderAdjustments. Otherwise.ProcLoadPriceInfoObjects Transitions: None. which is supplied to the executing chain. this is the last link in the chain and will cause the PipelineManager to return to the caller. To save manual adjustments for orders in additional states. and the OrderManager to its parameter list.commerce.commerce. the # manual adjustments are not saved for incomplete orders. The loadOrder() method adds the given OrderId.processor. 453 13 . saveIncompleteOrderAdjustments=false loadOrder Pipeline Chain The loadOrder pipeline chain loads the Order from the repository whose ID is supplied as a parameter.ATG Commerce Programming Guide µ /atg/commerce/order/processor/SaveManualAdjustments component. adjust the configuration of the incompleteStates property. Transactional mode: TX_MANDATORY Nucleus component: /atg/commerce/order/processor/LoadPriceInfoObjects PipelineProcessor object: atg. Transactional mode: TX_MANDATORY Nucleus component: /atg/commerce/order/processor/LoadOrderObject PipelineProcessor object: atg. CatalogTools Nucleus component.order. The loadOrder pipeline chain is executed by the loadOrder() method in the OrderManager.processor. PipelineLink Name: loadOrderObject This processor constructs a new Order object and loads the properties from the repository into it. OrderRepository. The following list describes each processor in the pipeline chain: 1. # The processor will save the manual adjustments to the repository for orders # in these states.incompleteStates # The processor will save the manual adjustments to the repository for orders # in the configured incomplete states if this property is true.Processor Chains and the Pipeline Manager . The pipeline chain’s transaction mode is TX_REQUIRED.ProcLoadOrderObject Transitions: return value of 1 will execute loadPriceInfoObjectsForOrder next 2.order.

processor. The refreshOrder pipeline chain is not executed explicitly. PipelineLink Name: loadCommerceItemObjects This processor constructs a new CommerceItem object for each item it loads and loads the properties from the repository into it. The pipeline chain’s transaction mode is TX_REQUIRED. The Order object is supplied as a parameter. ATG Commerce Programming Guide The refreshOrder pipeline chain reloads an Order from the repository. Transactional mode: TX_MANDATORY Nucleus component: /atg/commerce/order/processor/LoadOrderObject PipelineProcessor object: atg. etc. PipelineLink Name: loadHandlingInstructionsObjects This processor constructs a new HandlingInstruction object for each ShippingGroup that was loaded in the previous processor and loads the properties from the repository into it.commerce.commerce. such as CommerceItem.Processor Chains and the Pipeline Manager .commerce. Transactional mode: TX_MANDATORY Nucleus component: /atg/commerce/order/processor/LoadShippingGroupObjects PipelineProcessor object: atg. PipelineLink Name: loadPaymentGroupObjects This processor constructs a new PaymentGroup object for each item it loads and loads 454 13 .processor. It then adds the object to the Order.ProcLoadOrderObject Transitions: return value of 1 will execute loadCommerceItemObjects next 2.order.order.processor. ShippingGroup. It also loads all the supporting objects. It then adds the object to the ShippingGroup to which it belongs. but rather by the Commerce components.processor.ProcLoadHandlingInstructionObjects Transitions: return value of 1 will execute loadPaymentGroupObjects next 5. Transactional mode: TX_MANDATORY Nucleus component: /atg/commerce/order/processor/LoadHandlingInstructionObjects PipelineProcessor object: atg.commerce. PipelineLink Name: loadShippingGroupObjects This processor constructs a new ShippingGroup object for each item it loads and loads the properties from the repository into it. Transactional mode: TX_MANDATORY Nucleus component: /atg/commerce/order/processor/LoadCommerceItemObjects PipelineProcessor object: atg.order. The following list describes each processor in the pipeline chain: PipelineLink Name: loadOrderObjectForRefresh This processor takes an existing Order object and reloads the properties from the repository into it.µ refreshOrder Pipeline Chain 1.order.ProcLoadShippingGroupObjects Transitions: return value of 1 will execute loadHandlingInstructionsObjects next 4. It then adds the object to the Order.ProcLoadCommerceItemObjects Transitions: return value of 1 will execute loadShippingGroupObjects next 3.

ProcLoadPaymentGroupObjects Transitions: return value of 1 will execute loadPaymentStatusObjects next 6. Transactional mode: TX_MANDATORY Nucleus component: /atg/commerce/order/processor/SetCatalogRefs PipelineProcessor object: 455 13 . It then adds the object to the PaymentGroup to which it belongs. PipelineLink Name: loadPaymentStatusObjects This processor constructs a new PaymentStatus object for each PaymentGroup that was loaded in the previous processor and loads the properties from the repository into it. PipelineLink Name: loadRelationshipObjects This processor constructs a new Relationship object for each item it loads and loads the properties from the repository into it. if SetCatalogRefs. ShippingPriceInfo.commerce. It does this by loading the RepositoryItem object using the catalogRefId in the auxiliaryData object. or ItemPriceInfo object for each item it loads and loads the properties from the repository into it.ProcLoadRelationshipObjects Transitions: return value of 1 will execute loadPriceInfoObjects next 8.substituteDeletedSkuId.ATG Commerce Programming Guide µ the properties from the repository into it. this processor replaces all deleted SKUs in the Order with the “dummy” SKU defined by SetCatalogRefs.order.processor. TaxPriceInfo.order. It then adds the object to the Order. PipelineLink Name: setCatalogRefs This processor sets the catalogRef property in the auxiliaryData object in the CommerceItem.processor. PipelineLink Name: loadPriceInfoObjects This processor constructs a new OrderPriceInfo.order. Transactional mode: TX_MANDATORY Nucleus component: /atg/commerce/order/processor/LoadPriceInfoObjects PipelineProcessor object: atg.order.ProcLoadPriceInfoObjects Transitions: return value of 1 will execute setCatalogRefs next 9.processor.processor. Transactional mode: TX_MANDATORY Nucleus component: /atg/commerce/order/processor/LoadRelationshipObjects PipelineProcessor object: atg. see Refreshing Orders in the Configuring Purchase Process Services chapter. For more information.commerce. Additionally. It then adds the object to the Order.substituteRemovedSku is true.Processor Chains and the Pipeline Manager . Transactional mode: TX_MANDATORY Nucleus component: /atg/commerce/order/processor/LoadPaymentStatusObjects PipelineProcessor object: atg. It then sets the PriceInfo to the corresponding object in the Order.ProcLoadPaymentStatusObjects Transitions: return value of 1 will execute loadRelationshipObjects next 7. Transactional mode: TX_MANDATORY Nucleus component: /atg/commerce/order/processor/LoadPaymentGroupObjects PipelineProcessor object: atg.commerce.commerce.

Transactional mode: TX_MANDATORY Nucleus component: /atg/commerce/order/processor/RemoveExpiredCommerceItems PipelineProcessor object: atg.commerce. For more information. Locale. For more information. which is supplied to the executing chain.openOrderStates.substituteDeletedProductId. PipelineLink Name: removeExpiredCommerceItems Used in conjunction with SetCatalogRefs and SetProductRefs. see Refreshing Orders in the Configuring Purchase Process Services chapter. the default is true. A “dummy” SKU is automatically removed. PipelineLink Name: setProductRefs This processor sets the productRef property in the auxiliaryData object in the CommerceItem. Additionally. and OrderManager to its parameter list. this processor replaces all deleted products in the Order with the “dummy” product defined by SetProductRefs. The pipeline chain’s transaction mode is TX_REQUIRED. If the execution of this chain causes any errors.removeItemsWithDeletedProducts is set to true.ProcSetProductRefs Transitions: Return value of 1 executes removeExpiredCommerceItems next.order.substituteRemovedProduct is true. A “dummy” product is removed only if RemoveExpiredCommerceItems. this processor removes from the Order any CommerceItem that contains a “dummy” SKU or product that was substituted by SetCatalogRefs or SetProductRefs. The processOrder pipeline chain is executed by the processOrder() method in the OrderManager. The processOrder() method adds the given Order. Transactional mode: TX_MANDATORY Nucleus component: /atg/commerce/order/processor/SetProductRefs PipelineProcessor object: atg.commerce. processOrder Pipeline Chain The processOrder pipeline chain submits the given Order for checkout.order. Transactional mode: TX_MANDATORY Nucleus component: /atg/commerce/order/processor/ExecuteValidateForCheckoutChain PipelineProcessor object: atg.Processor Chains and the Pipeline Manager . Request.processor. Profile. then execution will be returned to the caller.ProcExecuteChain Transitions: In ATG Consumer Commerce.commerce.processor. see Refreshing Orders in the Configuring Purchase Process Services chapter. it causes the PipelineManager to return to the caller. It does this by loading the RepositoryItem object using the productId in the auxiliaryData object.ProcRemoveExpiredCommerceItems Transitions: None.order. if SetProductRefs. 11. If the state of the Order is one that is defined in RemoveExpiredCommerceItems. 10. PipelineLink Name: executeValidateForCheckoutChain This processor causes the validateForCheckout chain to be executed. return value of 1 executes 456 13 .order. The following list describes each processor in the pipeline chain: 1.ProcSetCatalogRefs Transitions: Return value of 1 executes setProductRefs next.processor.µ ATG Commerce Programming Guide atg. this is the last link in the chain.processor.commerce.

commerce. Transactional mode: TX_MANDATORY Nucleus component: /atg/commerce/approval/processor/StopChainIfOrderRequiresApproval PipelineProcessor object: atg. (ATG Business Commerce only) PipelineLink Name: executeApproveOrderChain This processor executes the approveOrder pipeline chain.processor.commerce. (ATG Business Commerce only) Pipeline Link Name: executeValidateNoApprovalChain If the order does not require approval.ProcCheckOrderState Transitions: Return value of 1 executes executeValidatePostApprovalChain next. 4.order. which begins the order approval process.processor. return value of 1 executes executeApproveOrderChain next. If it isn’t.order.processor. the order moves to the next processor in processOrder. 457 13 .Processor Chains and the Pipeline Manager . Return value of 2 executes executeValidateNoApprovalChain. this processor revalidates order information in case the approver changed anything. Transactional mode: TX_MANDATORY Nucleus component: atg/commerce/order/processor/ExecuteValidateNoApprovalChain PipelineProcessor object: atg. finish validation. (ATG Business Commerce only) PipelineLink Name: stopChainIfOrderRequiresApproval This processor checks whether the order has been determined to require approval. it checks whether the state of the order is PENDING_APPROVAL. execution of the processOrder chain stops. PipelineLink Name: checkForExpiredPromotions This processor walks through all the promotions that are being applied to the Order and verifies that none of them have expired. 6.ATG Commerce Programming Guide µ checkForExpiredPromotions next.order.ProcExecuteChain Transitions: Return value of 1 executes checkForExpiredPromotions. (ATG Business Commerce only) Pipeline Link Name: executeValidatePostApprovalChain If the order requires approval and has been approved. Transactional mode: TX_MANDATORY Nucleus component: atg/commerce/order/processor/ExecuteValidatePostApprovalChain PipelineProcessor object: atg.ProcExecuteChain Transitions: Return value of 1 executes checkForExpiredPromotions next. 3. In ATG Business Commerce. 5.ProcExecuteChain Transitions: Return value of 1 executes stopChainIfOrderRequiresApproval next. this means that an error occurred. If it is. 2.commerce.order. Transactional mode: TX_MANDATORY Nucleus component: /atg/commerce/approval/processor/ExecuteApproveOrderChain PipelineProcessor object: atg.commerce. Specifically.processor. Return value of -1 (STOP_CHAIN_EXECUTION_AND_ROLLBACK) stops the execution of the processOrder chain.

This amount is the amount that will ultimately be debited by the PaymentManager. ATG Commerce Programming Guide /atg/commerce/order/processor/CheckForExpiredPromotions atg. If either one of these or both have no Relationships. a Relationship will be created between itself and the Order with type OrderAmountRemaining. Transactional mode: TX_MANDATORY Nucleus component: /atg/commerce/order/processor/SetPaymentGroupAmount PipelineProcessor object: 458 13 .order. Transactional mode: TX_MANDATORY Nucleus component: /atg/commerce/order/processor/RemoveEmptyShippingGroups PipelineProcessor object: atg. An empty ShippingGroup contains no Relationships.µ Transactional mode: TX_MANDATORY Nucleus component: PipelineProcessor object: 7. For the ShippingGroup.Processor Chains and the Pipeline Manager . PipelineLink Name: removeEmptyPaymentGroups This processor checks to see if there are any empty PaymentGroups in the Order.order.processor. For the PaymentGroup. PipelineLink Name: setPaymentGroupAmount This processor sets the amount property of each PaymentGroup in the Order based on the Relationships in each PaymentGroup. If the Order contains only one ShippingGroup then it will not be removed if it is empty.processor. then relationships will automatically be created.commerce. Relationships will be created between it and each CommerceItem. An empty PaymentGroup contains no Relationships.ProcCreateImplicitRelationships Transitions: return value of 1 will execute setPaymentGroupAmount next 10.ProcRemoveEmptyShippingGroups Transitions: return value of 1 will execute removeEmptyPaymentGroups next 8. It removes any empty groups it finds. If so then it will remove them.processor.order. PipelineLink Name: createImplicitRelationships This processor adds Relationships to the Order if there is only one ShippingGroup or one PaymentGroup. If the Order contains only one PaymentGroup then it will not be removed if it is empty. Transactional mode: TX_MANDATORY Nucleus component: /atg/commerce/order/processor/CreateImplicitRelationships PipelineProcessor object: atg.ProcCheckForExpiredPromotions Transitions: return value of 1 will execute removeEmptyShippingGroups next PipelineLink Name: removeEmptyShippingGroups This processor checks to see if there are any empty ShippingGroups in the Order.commerce. Transactional mode: TX_MANDATORY Nucleus component: /atg/commerce/order/processor/RemoveEmptyPaymentGroups PipelineProcessor object: atg.commerce.commerce.order.ProcRemoveEmptyPaymentGroups Transitions: return val