The rich cart displays both gift with purchase messages and other promotion-related messages.

Retrieving Gift with Purchase Messages for the Rich Cart

The store.war/cart/json/cartMessages.jsp uses a TargetingArray droplet to retrieve all the messages Commerce has placed in the NoCleanBeforePricingSlot. The cartMessages.jsp page then filters those messages using the /atg/store/collections/filter/PromotionMessagesFilter. This filter is a Commerce Reference Store-specific filter of class The filter removes any duplicate gift with purchase messages. It also checks for gift with purchase promotion “failed” messages and, if it finds one, all previous “success” messages for the same promotion are ignored.

Retrieving Other Promotion-Related Messages for the Rich Cart

To retrieve messages related to other types of promotions, Commerce Reference Store includes a custom droplet, /atg/store/droplet/CartMessages. This droplet checks the current order for active promotions and, if it finds any, it returns the message “A promotion has been applied. Click View Full Cart for details.” The CartMessages droplet is of class It has an order input parameter that specifies the order to return messages for; if not specified, the current order is used. It has a message output parameter that contains an atg.web.messaging.UserMessage bean. This bean has several properties: identifier, type, priority and summary. The rich cart displays both the title for the promotion message and the summary. The title is retrieved from the Commerce Reference Store Web application resource bundle using the message’s identifier as a key. (This is the “A promotion has been applied” text.) The summary is retrieved from the message’s summary property (the “Click View Full Cart for details” text).

Rendering the Rich Cart Messages

The cartMessages.jsp page uses the two methods described above to retrieve all the promotion messages for the order. It passes each message it retrieves to the store.war/cart/json/cartMessage.jsp page for translation into a JSON object. cartMessages.jsp stores these JSON objects in a parent JSON object called the messagesContainer. The store.war/javascript/widget/RichCartSummary.js widget’s setAllCartData function, in turn, uses the contents of the messagesContainer to render all of the messages at the bottom of the rich cart.

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