Display no shipping method selected error

This commit is contained in:
Jean-Baptiste Bellet
2021-08-23 10:16:53 +02:00
parent 3bee30ac60
commit fe65359d71
4 changed files with 13 additions and 0 deletions

View File

@@ -103,6 +103,10 @@
padding-right: 5px;
padding-top: 2px;
padding-bottom: 2px;
&.standalone {
padding: 10px;
}
}
#distributor_address.panel {

View File

@@ -39,6 +39,9 @@ class SplitCheckoutController < ::BaseController
advance_order_state
redirect_to_step
else
if params[:shipping_method_id].blank?
@order.errors.add(:base, "no_shipping_method_selected")
end
flash.now[:error] = "Saving failed, please update the highlighted fields"
render :edit
end

View File

@@ -68,6 +68,10 @@
= t("split_checkout.step1.delivery_address.title")
- selected_shipping_method = @order.shipping_method&.id
- if selected_shipping_method == nil && @order.errors.messages_for(:base).include?("no_shipping_method_selected")
%div.checkout-input
%span.formError.standalone
= t("split_checkout.step1.delivery_address.errors.no_shipping_method_selected")
- @shipping_methods.each do |shipping_method|
%div.checkout-input
= fields_for shipping_method do |shipping_method_form|

View File

@@ -1660,6 +1660,8 @@ en:
label: Country
delivery_address:
title: Delivery address
errors:
no_shipping_method_selected: No shipping method selected
submit: Next - Payment method
cancel: Back to Edit basket
step2: