diff --git a/app/models/spree/product.rb b/app/models/spree/product.rb index 3d858a1272..51c52d451f 100755 --- a/app/models/spree/product.rb +++ b/app/models/spree/product.rb @@ -76,11 +76,11 @@ module Spree } delegate_belongs_to :master, :images, :sku, :unit_value, :unit_description - delegate :images_attributes=, :display_as=, to: :master + delegate :images_attributes=, to: :master - # Transient attribute used temporarily when creating a new product, - # this value is persisted on the product's variant - attr_accessor :price + # Transient attributes used temporarily when creating a new product, + # these values are persisted on the product's variant + attr_accessor :price, :display_as after_create :set_master_variant_defaults after_save :save_master @@ -395,6 +395,7 @@ module Spree variant.product = self variant.is_master = false variant.price = price + variant.display_as = display_as variants << variant end diff --git a/app/views/spree/admin/products/_display_as.html.haml b/app/views/spree/admin/products/_display_as.html.haml index 9a98e660c4..c0719e97f8 100644 --- a/app/views/spree/admin/products/_display_as.html.haml +++ b/app/views/spree/admin/products/_display_as.html.haml @@ -1,4 +1,4 @@ .six.columns.omega{ "ng-if" => "product.variant_unit_with_scale != 'items'" } = f.field_container :display_as do = f.label :product_display_as, t('.display_as') - %input#product_display_as.fullwidth{name: "product[display_as]", placeholder: "{{ placeholder_text }}", type: "text", value: @product.master.display_as} + %input#product_display_as.fullwidth{name: "product[display_as]", placeholder: "{{ placeholder_text }}", type: "text", value: @product.display_as}