01-06-05 10:53 PM
Jimut,
We have developed many Commerce Server sites where the business requirement
is to display line item pricing without order level discounts and to display
the order level discount as a separate line at the order level. In many
cases this is also a requirement for how order data is passed to the backend
fulfillment system. While Commerce Server applies the order level discount
to each line item, it tracks enough detail data that you can easily
calculate the non-discounted values. For example, if you want the line item
total without orderlevel discounts applied, you just need to calcuate
item.[_cy_oadjust_adjustedprice] + item.[_cy_orderlevel_discounts_su
btotal].
We do this in a custom scriptor placed in the pipeline sometime after
OrderLevelDiscountApply. The full code in the scriptor looks like this:
for each item in orderform.items
if not IsNull(item.[_cy_orderlevel_discounts_subtotal]) then
item.[_cy_oadjust_displayprice] =
item.[_cy_oadjust_adjustedprice] + item.[_cy_orderlevel_discounts_su
btotal]
else
item.[_cy_oadjust_displayprice] =
item.[_cy_oadjust_adjustedprice]
end if
next 'item
We then use our custom _cy_oadjust_displayprice in place of
_cy_oadjust_adjustedprice in our display and/or backend integration. Then we
have a separate scriptor in the Order Subtotal stage of the pipeline that
calculates the total order level discount as the sum of
_cy_orderlevel_discounts_subtotal for all line items:
for each item in orderform.items
if not IsNull(item.[_cy_orderlevel_discounts_subtotal]) then
item.[_cy_oadjust_displayprice] =
item.[_cy_oadjust_adjustedprice] + item.[_cy_orderlevel_discounts_su
btotal]
else
item.[_cy_oadjust_displayprice] =
item.[_cy_oadjust_adjustedprice]
end if
next 'item
We've seen lots of different detail requirements about how people want
discounts handled and displayed and most of the time I find that the data
the OrderDiscount component stores in the orderform is sufficient for me to
come up with the numbers I need. They're just not necessarily there by
default.
Hope this helps.
Zoe
"Jimut" <jimutbasa@yahoo.com> wrote in message
news:1dc04d21e1e30a2906e19d838f5356d4@lo
calhost.talkaboutsoftware.com...
> Hi David,
>
> Thanks a lot for the information.
>
> Regards,
> Jimut.
>
[ Post a follow-up to this message ]
|