Browse Source

Orders accept on/off action, error msg

Vova Tkach 5 years ago
parent
commit
fbe1ee7b39

+ 2 - 1
assets/template/header_html_file.go

@@ -49,6 +49,7 @@ var VarHeaderHtmlFile = []byte(`<!doctype html>
 			var ShopOrderRequiredComment = {{$.Data.ShopOrderRequiredComment}};
 
 			var ShopOrderError = 'Error!';
+			var ShopOrderErrorDisabled = 'Sorry, we are currently not accept new orders, please try little later';
 			var ShopOrderErrorBasketEmpty = 'Your basket is empty';
 			var ShopOrderErrorSomethingWrong = 'We cannot process your order, something is wrong...';
 			var ShopOrderEmptyLastName = 'Please enter your last name';
@@ -58,7 +59,7 @@ var VarHeaderHtmlFile = []byte(`<!doctype html>
 			var ShopOrderEmptyEmailAddress = 'Please enter your email address';
 			var ShopOrderEmptyDelivery = 'Please enter delivery comment';
 			var ShopOrderEmptyComment = 'Please enter order comment';
-			var ShopOrderSuccess = '<b>Thank you for your order! We will call you shortly!</b>';
+			var ShopOrderSuccess = '<b>Thank you for your order! We will call you shortly</b>';
 		</script>
 	</head>
 	<body id="body" class="fixed-top-bar">

+ 2 - 1
hosts/localhost/template/header.html

@@ -47,6 +47,7 @@
 			var ShopOrderRequiredComment = {{$.Data.ShopOrderRequiredComment}};
 
 			var ShopOrderError = 'Error!';
+			var ShopOrderErrorDisabled = 'Sorry, we are currently not accept new orders, please try little later';
 			var ShopOrderErrorBasketEmpty = 'Your basket is empty';
 			var ShopOrderErrorSomethingWrong = 'We cannot process your order, something is wrong...';
 			var ShopOrderEmptyLastName = 'Please enter your last name';
@@ -56,7 +57,7 @@
 			var ShopOrderEmptyEmailAddress = 'Please enter your email address';
 			var ShopOrderEmptyDelivery = 'Please enter delivery comment';
 			var ShopOrderEmptyComment = 'Please enter order comment';
-			var ShopOrderSuccess = '<b>Thank you for your order! We will call you shortly!</b>';
+			var ShopOrderSuccess = '<b>Thank you for your order! We will call you shortly</b>';
 		</script>
 	</head>
 	<body id="body" class="fixed-top-bar">

+ 5 - 0
modules/module_shop_act_order.go

@@ -14,6 +14,11 @@ func (this *Modules) RegisterAction_ShopOrder() *Action {
 		Mount:     "shop-order",
 		WantAdmin: false,
 	}, func(wrap *wrapper.Wrapper) {
+		if (*wrap.Config).Shop.Orders.Enabled <= 0 {
+			wrap.Write(`{"error": true, "variable": "ShopOrderErrorDisabled"}`)
+			return
+		}
+
 		if wrap.ShopBasket.ProductsCount(&basket.SBParam{
 			R:         wrap.R,
 			DB:        wrap.DB,