diff --git a/admin/app/components/solidus_admin/products/show/component.html.erb b/admin/app/components/solidus_admin/products/show/component.html.erb index 3289bd88df..56ee060d60 100644 --- a/admin/app/components/solidus_admin/products/show/component.html.erb +++ b/admin/app/components/solidus_admin/products/show/component.html.erb @@ -36,8 +36,14 @@ <%= render component("ui/forms/field").text_field(f, :meta_title) %> <%= render component("ui/forms/field").text_field(f, :meta_description) %> <%= render component("ui/forms/field").text_area(f, :meta_keywords) %> + <%= render component("ui/forms/field").text_field(f, :gtin) %> + <%= render component("ui/forms/field").select( + f, + :condition, + condition_options, + include_blank: t('spree.unset'), + ) %> <% end %> - <%= render component('ui/panel').new(title: "Media") do |panel| %> <% panel.with_action( name: t(".manage_images"), diff --git a/admin/app/components/solidus_admin/products/show/component.rb b/admin/app/components/solidus_admin/products/show/component.rb index 08d200d17d..66ae89250f 100644 --- a/admin/app/components/solidus_admin/products/show/component.rb +++ b/admin/app/components/solidus_admin/products/show/component.rb @@ -25,4 +25,10 @@ class SolidusAdmin::Products::Show::Component < SolidusAdmin::BaseComponent ["#{_1} (#{_2})", _3] end end + + def condition_options + @condition_options ||= Spree::Variant.conditions.map do |key, value| + [t("spree.condition.#{key}"), value] + end + end end diff --git a/api/lib/spree/api_configuration.rb b/api/lib/spree/api_configuration.rb index 8fd16fb747..77b047f325 100644 --- a/api/lib/spree/api_configuration.rb +++ b/api/lib/spree/api_configuration.rb @@ -13,7 +13,7 @@ module Spree preference :product_property_attributes, :array, default: [:id, :product_id, :property_id, :value, :property_name] preference :variant_attributes, :array, default: [ - :id, :name, :sku, :weight, :height, :width, :depth, :is_master, + :id, :name, :sku, :gtin, :condition, :weight, :height, :width, :depth, :is_master, :slug, :description, :track_inventory ] diff --git a/api/openapi/solidus-api.oas.yml b/api/openapi/solidus-api.oas.yml index 8fbb507795..a59c2662b8 100644 --- a/api/openapi/solidus-api.oas.yml +++ b/api/openapi/solidus-api.oas.yml @@ -74,6 +74,8 @@ paths: product: name: The Majestic Product price: '19.99' + gtin: 12345678 + condition: new shipping_category_id: 8 product_properties_attributes: - property_name: fabric @@ -86,6 +88,8 @@ paths: - price: 19.99 cost_price: 17 sku: SKU-3 + gtin: 12345678 + condition: new track_inventory: true options: - name: size diff --git a/backend/app/views/spree/admin/products/_form.html.erb b/backend/app/views/spree/admin/products/_form.html.erb index dec7f5f0c3..eed4cfcf34 100644 --- a/backend/app/views/spree/admin/products/_form.html.erb +++ b/backend/app/views/spree/admin/products/_form.html.erb @@ -179,6 +179,24 @@ <% else %> +
+ <%= f.field_container :gtin do %> + <%= f.label :gtin %> + <%= f.text_field :gtin %> + <% end %> +
+ +
+ <%= f.field_container :condition do %> + <%= f.label :condition %> + <%= f.select :condition, + Spree::Variant.conditions.map { |key, value| [t("spree.condition.#{key}"), value] }, + { include_blank: t('spree.unset') }, + class: 'custom-select' + %> + <% end %> +
+
<% [:height, :width, :depth, :weight].each_with_index do |field, index| %>
diff --git a/backend/app/views/spree/admin/variants/_form.html.erb b/backend/app/views/spree/admin/variants/_form.html.erb index 9a12b8c3b2..fcddd50950 100644 --- a/backend/app/views/spree/admin/variants/_form.html.erb +++ b/backend/app/views/spree/admin/variants/_form.html.erb @@ -7,6 +7,23 @@ <%= f.text_field :sku, class: 'fullwidth' %>
+ +
+
+ <%= f.label :gtin %> + <%= f.text_field :gtin, class: 'fullwidth' %> +
+
+ +
+
+ <%= f.label :condition %> + <%= f.select :condition, + Spree::Variant.conditions.map { |key, value| [t("spree.condition.#{key}"), value] }, + { include_blank: t('spree.unset') }, + class: 'custom-select fullwidth' %> +
+