mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-14 04:04:23 +00:00
properties_h uses inherit_properties flag, and returns property id rather than presentation
This commit is contained in:
@@ -111,15 +111,18 @@ Spree::Product.class_eval do
|
||||
def properties_h
|
||||
# Product properties override producer properties
|
||||
ps = product_properties.all
|
||||
supplier.producer_properties.each do |producer_property|
|
||||
unless ps.find { |product_property| product_property.property.presentation == producer_property.property.presentation }
|
||||
ps << producer_property
|
||||
|
||||
if inherits_properties
|
||||
supplier.producer_properties.each do |producer_property|
|
||||
unless ps.find { |product_property| product_property.property.presentation == producer_property.property.presentation }
|
||||
ps << producer_property
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ps.
|
||||
sort_by { |pp| pp.position }.
|
||||
map { |pp| {presentation: pp.property.presentation, value: pp.value} }
|
||||
map { |pp| {id: pp.property.id, value: pp.value} }
|
||||
end
|
||||
|
||||
def in_distributor?(distributor)
|
||||
|
||||
Reference in New Issue
Block a user