From dee9521f772d530a2b5e7a0a2c5233151ed4b8f5 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley Date: Mon, 1 Apr 2019 11:04:35 +0100 Subject: [PATCH] shipping_category now required for products --- app/models/product_import/entry_validator.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/models/product_import/entry_validator.rb b/app/models/product_import/entry_validator.rb index 50d8879d77..915e78b6f6 100644 --- a/app/models/product_import/entry_validator.rb +++ b/app/models/product_import/entry_validator.rb @@ -40,6 +40,7 @@ module ProductImport category_validation(entry) tax_and_shipping_validation(entry, 'tax', entry.tax_category, @spreadsheet_data.tax_index) tax_and_shipping_validation(entry, 'shipping', entry.shipping_category, @spreadsheet_data.shipping_index) + shipping_presence_validation(entry) product_validation(entry) end end @@ -233,6 +234,10 @@ module ProductImport end end + def shipping_presence_validation(entry) + mark_as_invalid(entry, attribute: "shipping_category", error: I18n.t(:error_required)) unless entry.shipping_category_id + end + def product_validation(entry) products = Spree::Product.where(supplier_id: entry.enterprise_id, name: entry.name,