Class: Spree::CommissionRule
- Inherits:
-
Object
- Object
- Spree::CommissionRule
- Includes:
- PreferenceSchema, TypeLabels
- Defined in:
- app/models/spree/commission_rule.rb
Overview
One condition on a Spree::CommissionRate: the rate applies to this sale only if every one of its rules says so.
Typed like Spree::PriceRule and Spree::DeliveryMethodRule, and for the same reason. A rule that could only name a record — this seller, this category — left everything else unsayable: a price band, a channel, a promotional window. Each of those was a schema migration and an edit to the matcher. As a class it is a subclass and a registration.
AND across rules, and a rule holding several ids means any of them, so "(Cameras OR Audio) AND that seller" is two rules rather than a policy setting. A rate with no rules charges every sale.
Direct Known Subclasses
Spree::CommissionRules::CategoryRule, Spree::CommissionRules::ItemTotalRule, Spree::CommissionRules::ProductRule, Spree::CommissionRules::SellerRule
Instance Method Summary collapse
-
#applicable?(context) ⇒ Boolean
Whether this rule admits the sale.
Methods included from TypeLabels
#human_description, #human_name
Methods included from PreferenceSchema
Instance Method Details
#applicable?(context) ⇒ Boolean
Whether this rule admits the sale.
57 58 59 |
# File 'app/models/spree/commission_rule.rb', line 57 def applicable?(context) raise NotImplementedError, "#{self.class.name} must implement #applicable?" end |