If a customer selects a SKU that is out of stock (i.e., stockLevel
, backorderLevel
, and preorderLevel
are all 0), the label on the Add to Cart button changes to Email Me When Available. If the customer clicks this link, a popup window prompts for an e-mail address to send a notification to when the item is back in stock:
If the customer fills in an e-mail address and clicks the Submit button, a repository item of type backInStockNotifyItem
is created in the profile repository. This item holds the e-mail address plus the product ID and SKU ID of the out-of-stock item.
The Commerce Reference Store Store.Fulfillment
module adds a Patch Bay message sink class, atg.projects.store.inventory.BackInStockNotificationService
, to the standard Fulfillment system. A component of this class, /atg/store/inventory/BackInStockNotificationService
, listens for JMS messages of type UpdateInventory
. This message type, which is typically sent by an external inventory system, informs the Fulfillment system about formerly unavailable products and SKUs that stock is now available for. (See theATG Platform Programming Guide for information about Patch Bay.)
When an UpdateInventory
message is received, BackInStockNotificationService
examines the backInStockNotifyItem
repository items. If a backInStockNotifyItem
contains the product ID or SKU ID of one of the products or SKUs listed in the UpdateInventory
message, the BackInStockNotificationService.validateItems()
method attempts to validate the item by applying the CollectionObjectValidator
components listed in its validators
property. By default, the validators
property is set to:
validators=\
/atg/store/collections/validator/StartEndDateValidator
If the item is valid, BackInStockNotificationService
sends a Back in Stock e-mail message to the address stored in the backInStockNotifyItem
, and then deletes the backInStockNotifyItem
.
See Appendix A, Sample Data for more information about out-of-stock products.