Sha256: 44f4a424a8d015a1454f8840569963c3242a2563899d11071665a925814276ab
Contents?: true
Size: 1.03 KB
Versions: 2
Compression:
Stored size: 1.03 KB
Contents
module Spree class Promotion module Rules class AffiliatedPromotionRule < Spree::PromotionRule belongs_to :affiliate, :class_name => '::Spree::Affiliate' has_and_belongs_to_many :affiliates, :class_name => '::Spree::Affiliate', :join_table => 'spree_affiliates_promotion_rules', :foreign_key => 'promotion_rule_id', :association_foreign_key => 'affiliate_id' def eligible?(order, options = {}) return true if order.user and order.user.affiliate? and affiliates.collect(&:id).include?(order.user.affiliate.id) false end def applicable?(promotable) promotable.is_a?(Spree::Order) end def affiliate_ids_string affiliate_ids.join(',') end def affiliate_ids_string=(s) self.affiliate_ids = s.to_s.split(',').map(&:strip) end def affiliate_list affiliate_ids end def affiliate_list=(a) self.affiliate_ids = a end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spree_reffiliate-2.4.1 | app/models/spree/promotion/rules/affiliated_promotion_rule.rb |
spree_reffiliate-2.3.1 | app/models/spree/promotion/rules/affiliated_promotion_rule.rb |