Skip to content

Commit

Permalink
close #567 add default state to product (#568)
Browse files Browse the repository at this point in the history
  • Loading branch information
theachoem authored Sep 12, 2023
1 parent 9c1e000 commit 63f41ec
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/models/spree_cm_commissioner/product_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ def self.prepended(base)
order('spree_variants.position, spree_variants.id, currency')
}, source: :prices, through: :variants_including_master

base.has_one :default_state, through: :vendor

base.scope :min_price, lambda { |vendor|
joins(:prices_including_master)
.where(vendor_id: vendor.id, product_type: vendor.primary_product_type)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ def self.prepended(base)
base.has_many :product_kind_option_types, serializer: :option_type
base.has_many :promoted_option_types, serializer: :option_type
base.has_many :possible_promotions, serializer: ::SpreeCmCommissioner::V2::Storefront::PromotionSerializer

base.has_one :default_state, serializer: :state
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
:variant_kind_option_types,
:product_kind_option_types,
:promoted_option_types,
:possible_promotions
:possible_promotions,
:default_state,
]).serializable_hash
}

Expand Down Expand Up @@ -58,7 +59,8 @@
:variant_kind_option_types,
:product_kind_option_types,
:promoted_option_types,
:possible_promotions
:possible_promotions,
:default_state,
)
end
end
Expand Down

0 comments on commit 63f41ec

Please sign in to comment.