NAME

Interchange6::Cart::Cost - Cart cost class for Interchange6 Shop Machine

DESCRIPTION

Cart cost class for Interchange6.

ATTRIBUTES

id

Cart id can be used for subclasses, e.g. primary key value for cart or product costs in the database.

name

Unique name is required.

label

Label for display. Default is same value as label.

relative

Boolean defaults to 0. If true then amount is relative to object subtotal. If false then amount is an absolute cost.

inclusive

Boolean defaults to 0. If true signifies that the cost is already included in the price for example to calculate the tax component for gross prices.

compound

Boolean defaults to 0. If true signifies that any following costs should be applied to the modified price after this cost has been applied. This might be used for such things as discounts which are applied before taxes are applied to the modified price.

Using "compound" along with "inclusive" makes no sense and no guarantee is given as to what the result might be.

amount

Required amount of the cost. This is the absolute cost unless "relative" is true in which case it is relative to the object subtotal. For example for a tax of 8% amount should be set to 0.08

current_amount

Calculated current amount of cost. Unless "relative" is true this will be the same as "amount". If "relative" is true then this is value is recalulated whenever total is called on the object.

Writer: set_current_amount