Update shipping_category usage in admin pages

This commit is contained in:
Matt-Yorkley
2023-07-15 15:52:22 +01:00
parent 0c634cf04f
commit eefc356472
4 changed files with 7 additions and 6 deletions

View File

@@ -27,7 +27,7 @@ module Spree
end
def new
@object.shipping_category = DefaultShippingCategory.find_or_create
@object.shipping_category_id = DefaultShippingCategory.find_or_create.id
end
def edit

View File

@@ -19,6 +19,7 @@ module Spree
def edit
@url_filters = ::ProductFilters.new.extract(request.query_parameters)
@object.shipping_category = DefaultShippingCategory.find_or_create
end
def create
@@ -114,6 +115,7 @@ module Spree
def load_data
@tax_categories = TaxCategory.order(:name)
@shipping_categories = ShippingCategory.order(:name)
end
end
end

View File

@@ -38,11 +38,6 @@
.clear
= f.field_container :shipping_categories do
= f.label :shipping_category_id, t(:shipping_categories)
= f.collection_select(:shipping_category_id, @shipping_categories, :id, :name, {}, { :class => 'select2' })
= f.error_message_on :shipping_category
.clear
%div

View File

@@ -68,4 +68,8 @@
= f.label :tax_category_id, t(:tax_category)
= f.collection_select(:tax_category_id, @tax_categories, :id, :name, { include_blank: t(:none) }, { class: 'select2 fullwidth' })
.field
= f.label :shipping_category_id, t(:shipping_categories)
= f.collection_select(:shipping_category_id, @shipping_categories, :id, :name, {}, { class: 'select2 fullwidth' })
.clear