Using Dynamic vs Static Product Pricing
在Product Page,ATG 支持两种定价模式,即动态和静态定价方式:
静态定价工作流程:
catalog每一个item都有一个listPrice 属性,然后你可以在shopping cart,order,tax使用它作为基本价格进行计算,你也可以给每一个item一个固定的价格salePrice ,在product page 你可以直接使用。
<dsp:droplet name="/atg/dynamo/droplet/Switch"> <dsp:param param="sku.onSale" name="value"/> <dsp:oparam name="false"> List price of <dsp:valueof param="sku.listPrice" converter="currency"/> </dsp:oparam> <dsp:oparam name="true"> List price of <dsp:valueof param="sku.listPrice" converter="currency"/> on sale for <dsp:valueof param="sku.salePrice" converter="currency"/>! </dsp:oparam> </dsp:droplet>
动态定价的工作方式:
Commerce会使用一下的机构对每一种类型进行定价:
1 Pricing Engine
2 One or more calculators
3 a helper method in the qualifier service
4 an item-descriptor in the promotions repository
How Price Services Generate the Prices?
1 首先会给予2个基本的组件:price engine and price caculators
2 价格引擎做的事:
取得站点访问者的有效的promotions
决定采用哪一个价格计算器计算价格
采用正确的顺序调用计算器
3 价格计算器主要负责:
查询价格
使用价格引擎得到的信息,然后决定价格
4 在定价以前,以下的一些步骤会发生:
- 价格引擎会加载全局的promotions,使用globalPromotionsQuery 属性去查询
- 用户session 开始的时候,会创建PriceModelHolder实例,然后调用价格引擎的getPricingModes();
- pricing engine getPricingModels() method gets any promotions listed in the activePromotions
property of the current customer’s profile, 并且和全局的epromotions进行一个merge - PricingModelHolder 将会定期更新全局的和active promotions
当用户添加一个item到shopping cart 会发生什么?
1 业务逻辑层调用价格引擎
2 定价操作然后调用PricingTools ,接着得到PricingModelHolder
3 PricingTools从PricingModelHolder 得到promotions,然后调用价格引擎的priceItems方法
4 价格引擎接着应用它配置的precalculators,不同种类的价格引擎会调用不同precalculators,比如OrderPricingEngineImpl calls OrderPricingCalculators and the TaxPricingEngineImpl calls
TaxPricingCalculators.
5 价格引擎接着应用它配置的postcalculators
6 价格引擎最后返回更新的priceInfo 对象