From 585072302cab740dd92e5983770dc53fec2a1600 Mon Sep 17 00:00:00 2001 From: lin-d-hop Date: Sun, 5 May 2019 14:49:21 +0100 Subject: [PATCH 1/2] Remove non-functional Price field from Edit Product screen Update initializer to override Product Price as required field. Revert "Update initializer to override Product Price as required field." This reverts commit 1bfca09c5cf9245fbc3d30a23e9d80ac545adcf5. --- app/views/spree/admin/products/_form.html.haml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/views/spree/admin/products/_form.html.haml b/app/views/spree/admin/products/_form.html.haml index 4e97d209cd..a2c4cc9962 100644 --- a/app/views/spree/admin/products/_form.html.haml +++ b/app/views/spree/admin/products/_form.html.haml @@ -46,11 +46,6 @@ = f.collection_select(:supplier_id, @producers, :id, :name, {:include_blank => true}, {:class => "select2"}) = f.error_message_on :supplier - = f.field_container :price do - = f.label :price, raw(t(:price) + content_tag(:span, ' *', :class => 'required')) - = f.text_field :price, :value => number_to_currency(@product.price, :unit => '') - = f.error_message_on :price - .clear - unless @product.has_variants? From 7b87e609c4546e492b2faf0b9c65dbad6efc13fa Mon Sep 17 00:00:00 2001 From: lin-d-hop Date: Sun, 5 May 2019 17:31:36 +0100 Subject: [PATCH 2/2] Set master variant price in products controller Set master variant price in products controller Code climate tidy up Syntax improvement Revert "Remove non-functional Price field from Edit Product screen" This reverts commit 585072302cab740dd92e5983770dc53fec2a1600. Syntax improvement fixing revert Revert "Remove non-functional Price field from Edit Product screen" This reverts commit 585072302cab740dd92e5983770dc53fec2a1600. fixing conflicts --- app/controllers/spree/admin/products_controller_decorator.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/controllers/spree/admin/products_controller_decorator.rb b/app/controllers/spree/admin/products_controller_decorator.rb index ef4b28deaa..9be7949898 100644 --- a/app/controllers/spree/admin/products_controller_decorator.rb +++ b/app/controllers/spree/admin/products_controller_decorator.rb @@ -151,4 +151,8 @@ Spree::Admin::ProductsController.class_eval do variant.on_demand = on_demand if on_demand.present? variant.on_hand = on_hand.to_i if on_hand.present? end + + def set_product_master_variant_price_to_zero + @product.price = 0 if @product.price.nil? + end end