A message is published to this topic when a shopper selects all the variant options for a product, thereby identifying a specific SKU.
$.Topic(pubsub.topicNames.SKU_SELECTED).publish(product, selectedSku, variantOptions);
Arguments
product
: The current ProductViewModel
. See the View Model for Oracle Commerce Cloud Service for details on what this view model contains.
selectedSku
: A JSON object that includes data for the selected SKU, for example:
selectedSku = { "salePrices" : null, "resolution" : "14.1-megapixels", "listPrice" : 399.99, "quantity" : 5, "repositoryId" : "camerasku_1_18", "color" : "Black", "dynamicPropertyMapLong" : { "sku-camera_resolution" : 0, "sku-camera_color" : 8 }, "salePrice" : 399.99, "salePriceStartDate" : null, "fractionalQuantitiesAllowed" : false }
variantOptions
: An array whose items reflect the variant options (such as color, size, finish, resolution, and so on) that can be selected for the SKU, along with any currently selected variant options. For example, the following JSON sample shows the color
and resolution
variants returned for the camera selected above.
[ { "optionDisplayName" : "color", "parent" : { "basePath" : "/", "deferredInit" : {}, "prevHistoryLength" : 7, "newHistoryLength" : 8, "localeSubscription" : { "R" : true }, "WIDGET_ID" : "productDetails", "imgMetadata" : [{} ], "firstTimeRender" : true }, "optionId" : "sku-camera_color", "actualOptionId" : "color", "optionCaption" : "Select color ...", "selectedOptionValue" : { "key" : "Antique Brass", "value" : 0 }, "originalOptionValues":[ { "key" : "Antique Brass", "value" : 0 }, { "key" : "Apricot", "value" : 1 }, { "key" : "Aquamarine", "value" : 2 }, ] }, { "optionDisplayName" : "resolution", "parent" : { "basePath" : "/", "deferredInit" : {}, "prevHistoryLength" : 7, "newHistoryLength" : 8, "localeSubscription" : { "R" : true }, "WIDGET_ID" : "productDetails", "imgMetadata" : [{} ], "firstTimeRender" : true }, "optionId" : "sku-camera_resolution", "actualOptionId" : "resolution", "optionCaption" : "Select resolution ...", "selectedOptionValue" : { "key" : "14.1-megapixels", "value" : 0 }, "originalOptionValues":[ { "key" : "14.1-megapixels", "value" : 0 }, { "key" : "24.3-megapixels", "value" : 1 }, ] } ]
Memory enabled
No