Class Name |
|
---|---|
Component(s) |
|
The PriceEachItem
servlet bean is to price dynamically a collection of items by taking promotions into account. If you need to show only static prices, you can retrieve the list or sale prices directly from the SKU object.
The PriceEachItem
servlet bean is instantiated from atg.commerce.pricing.PriceEachItemDroplet
, which extends atg.commerce.pricing.
ItemPricingDroplet.
For information on a servlet bean that can be used to price dynamically a collection of items, refer to PriceItemDroplet.
Input Parameters
items (Required)
Either a collection of RepositoryItems
that represent the items to be priced, or a collection of CommerceItems
that can be priced directly. If the supplied items are RepositoryItems,
then a new collection of CommerceItems
is created.
pricingModels
The collection of pricing models (promotions) used to price the items. If this value is not supplied, then by default a collection of pricing models from the customer’s PricingModelHolder
component is used. This component is resolved through the userPricingModelsPath
property.
locale
The locale in which the pricing should take place.
profile
The user for whom pricing is performed. If this value is not supplied, then the profile is resolved through the profilePath
property.
product
The object that represents the product definition of the items to price. Usually, the items that are priced are SKUs. In that case, this is the product that encompasses all of the SKUs.
elementName
The name to use as the parameter set within the output
open parameter.
Output Parameters
element
The collection of priced CommerceItems
. This parameter name can be changed by setting the elementName
input parameter.
Open Parameters
output
The open parameter rendered if the CommerceItems
have been priced successfully.
Example
In the following example, the promotions, locale, and profile are extracted from the request, since they are not supplied as parameters.
<dsp:droplet name="/atg/commerce/pricing/PriceEachItem"> <dsp:param param="product.childSKUs" name="items"/> <!-- the product param is already defined in this scope so we do not need to set it --> <dsp:oparam name="output"> <!-- Now iterate over each of the CommerceItems to display the prices --> <dsp:droplet name="/atg/dynamo/droplet/ForEach"> <dsp:param param="element" name="array"/> <dsp:param value="pricedItem" name="elementName"/> <dsp:oparam name="output"> <dsp:valueof param="pricedItem.auxiliaryData.catalogRef.displayName"/> - <!-- Toggle a different display depending if the item is on sale or not --> <dsp:droplet name="Switch"> <dsp:param param="pricedItem.priceInfo.onSale" name="value"/> <dsp:oparam name="false"> <dsp:valueof param="pricedItem.priceInfo.amount" converter="currency"> no price</dsp:valueof> </dsp:oparam> <dsp:oparam name="true"> List price for <dsp:valueof param="pricedItem.priceInfo.listPrice" converter="currency">no price </dsp:valueof> on sale for <dsp:valueof param="pricedItem.priceInfo.salePrice" converter="currency"/>! </dsp:oparam> </dsp:droplet><BR> </dsp:oparam> </dsp:droplet> </dsp:oparam> </dsp:droplet>