How to Use a Scriptor to Sum the Price of All of Items in an OrderForm

ID: Q216940


The information in this article applies to:


SUMMARY

The DefaultOrderSubtotal component, which usually appears in the Order Subtotal stage of an order processing pipeline, calculates the subtotal for an order and stores the resulting value in the order._oadjust_subtotal member of the OrderForm. This value represents the sum of the item._oadjust_adjustedprice name/value pair for every item in the OrderForm?s items SimpleList. The DefaultOrderSubtotal component cannot be used to sum the prices if the price associated with a particular item is not reflected in the item._oadjust_adjustedprice name/value pair. It is still possible to sum the price of the all of the items in the OrderForm. This can be useful in situations where two prices are associated with a single item and a sum of all prices needs to be computed.


MORE INFORMATION

  1. Insert a Scriptor in the Order Subtotal Stage.


  2. Replace [_oadjust_adjustedprice] with the item that you want to sum.


  3. Replace [_oadjust_subtotal] with a new property of the orderform, which can be created in the scriptor by simply referencing it in this line of code:
    
       y=0
       for each x in orderform.items
       y = y + x.[_oadjust_adjustedprice] * x.[quantity]
       next
       orderform.[_oadjust_subtotal] = y
       MSCSExecute = 1
       end function
    
       sub MSCSOpen(config)
    
       end sub 


Additional query words:


Keywords          : 
Version           : winnt:3.0
Platform          : winnt 
Issue type        : kbhowto 

Last Reviewed: May 21, 1999