From 12bbd395bb1771c0f4cf2f22db79590ce78270f6 Mon Sep 17 00:00:00 2001
From: Olexii Korshenko <okorshenko@ebay.com>
Date: Thu, 2 Jul 2015 19:16:33 +0300
Subject: [PATCH] MAGETWO-38611: No validation message is shipping rate is not
 set

---
 .../Checkout/view/frontend/web/js/view/shipping.js       | 9 +++++++--
 .../Checkout/view/frontend/web/template/shipping.html    | 5 +++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js
index 7a0b60c7609..7b679f3799b 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js
+++ b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js
@@ -69,6 +69,7 @@ define(
                 template: 'Magento_Checkout/shipping'
             },
             visible: ko.observable(!quote.isVirtual()),
+            errorValidationMessage: ko.observable(false),
             isCustomerLoggedIn: customer.isLoggedIn,
             isFormPopUpVisible: formPopUpState.isVisible,
             isFormInline: addressList().length == 0,
@@ -100,12 +101,16 @@ define(
                     stepNavigator.registerStep('shipping', 'Shipping', this.visible, 10);
                 }
 
-                this.isFormPopUpVisible.subscribe(function(value) {
+                this.isFormPopUpVisible.subscribe(function (value) {
                     if (value) {
                         self.getPopUp().openModal();
                     }
                 });
 
+                quote.shippingMethod.subscribe(function (value) {
+                    self.errorValidationMessage(false);
+                });
+
                 return this;
             },
 
@@ -195,7 +200,7 @@ define(
                     emailValidationResult = customer.isLoggedIn();
 
                 if (!quote.shippingMethod()) {
-                    alert($t('Please specify a shipping method'));
+                    this.errorValidationMessage('Please specify a shipping method');
                     return false;
                 }
 
diff --git a/app/code/Magento/Checkout/view/frontend/web/template/shipping.html b/app/code/Magento/Checkout/view/frontend/web/template/shipping.html
index 0ecaf1d41f6..8a0cac3f874 100644
--- a/app/code/Magento/Checkout/view/frontend/web/template/shipping.html
+++ b/app/code/Magento/Checkout/view/frontend/web/template/shipping.html
@@ -126,6 +126,11 @@
                     <!-- ko template: getTemplate() --><!-- /ko -->
                     <!-- /ko -->
                 </div>
+                <!-- ko if: errorValidationMessage().length > 0 -->
+                <div class="message notice">
+                    <span><!-- ko text: $t(errorValidationMessage())--><!-- /ko --></span>
+                </div>
+                <!-- /ko -->
                 <div class="actions-toolbar" id="shipping-method-buttons-container">
                     <div class="primary">
                         <button data-role="opc-continue" type="submit" class="button action continue primary">
-- 
GitLab