shipping_category now required for products

This commit is contained in:
Matt-Yorkley
2019-04-01 11:04:35 +01:00
committed by Matt-Yorkley
parent 6f0d155508
commit dee9521f77

View File

@@ -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,