NAME
Interchange6::Schema::Result::PriceModifier
DESCRIPTION
Use cases:
group pricing based on roles
tier pricing (volume discounts)
promotion/action pricing using "start_date" and "end_date"
ACCESSORS
price_modifiers_id
Primary key.
sku
FK on "sku" in Interchange6::Schema::Result::Product.
quantity
Minimum quantity at which price modifier applies (tier pricing).
Defaults to 0.
roles_id
FK on "roles_id" in Interchange6::Schema::Result::Role.
Can be used for role-based pricing.
Is nullable.
price
Price.
discount
Percent rate of discount. This is an alternative to setting "price" directly.
NOTE: It is not possible to create a new PriceModifier
record with both "price" and </percent> set in new/insert.
When "discount" is set or updated the value of "price" will be updated accordingly based on the related "price" in Interchange6::Schema::Result::Product.This is done using the method discount_changed
.
If related "price" in Interchange6::Schema::Result::Product changes then the modified "price" will be updated.
Is nullable.
start_date
The first date from which this modified price is valid. Automatic inflation/deflation to/from DateTime.
Is nullable.
end_date
The last date on which this modified price is valid. Automatic inflation/deflation to/from DateTime.
Is nullable.
RELATIONS
role
Type: belongs_to
Related object: Interchange6::Schema::Result::Role
product
Type: belongs_to
Related object: Interchange6::Schema::Result::Product
METHODS
insert
Throw exception if both "price" and "discount" have been supplied.
If "discount" has been supplied then set "price" based on related <Interchange6::Schema::Result::Product/price>.
discount_changed
Called when "discount" is updated.