From 1cd29bb80d2bb0518d9dc617ce13f6f0db898914 Mon Sep 17 00:00:00 2001 From: Tymur Biedukhin Date: Fri, 14 May 2021 11:18:17 +0300 Subject: [PATCH 001/367] Releasing 5.5.0-rc.1 --- config.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config.json b/config.json index 91114bc4eb..13122aec1f 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,6 @@ { "name": "Cornerstone", - "version": "5.4.0", + "version": "5.5.0-rc.1", "template_engine": "handlebars_v4", "meta": { "price": 0, diff --git a/package.json b/package.json index 9a98ed8724..050b7fa047 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "bigcommerce-cornerstone", "description": "The BigCommerce reference theme for the Stencil platform", - "version": "5.4.0", + "version": "5.5.0-rc.1", "private": true, "author": "BigCommerce", "license": "MIT", From 58ed19ed3f7a76698f9bfa55233bf63739326975 Mon Sep 17 00:00:00 2001 From: Tymur Biedukhin Date: Thu, 20 May 2021 16:04:40 +0300 Subject: [PATCH 002/367] Releasing 5.5.0 --- CHANGELOG.md | 2 ++ config.json | 2 +- package.json | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c078ad827a..589491997a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog ## Draft + +## 5.5.0 (05-20-2021) - Scale focus trap for all modals. [#2049](https://github.com/bigcommerce/cornerstone/pull/2049) - Fixed displaying swatch name for multiple swatch options on page. [#2040](https://github.com/bigcommerce/cornerstone/pull/2040) - Added settings for payment banners. [#2021](https://github.com/bigcommerce/cornerstone/pull/2021) diff --git a/config.json b/config.json index 13122aec1f..273a007b1a 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,6 @@ { "name": "Cornerstone", - "version": "5.5.0-rc.1", + "version": "5.5.0", "template_engine": "handlebars_v4", "meta": { "price": 0, diff --git a/package.json b/package.json index 050b7fa047..e3b3d6f4b8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "bigcommerce-cornerstone", "description": "The BigCommerce reference theme for the Stencil platform", - "version": "5.5.0-rc.1", + "version": "5.5.0", "private": true, "author": "BigCommerce", "license": "MIT", From d9a82a4167b272157d90443458ccf99e23381c5f Mon Sep 17 00:00:00 2001 From: Yevhenii Buliuk <82589781+bc-yevhenii-buliuk@users.noreply.github.com> Date: Mon, 24 May 2021 20:26:10 +0300 Subject: [PATCH 003/367] fix(storefront): BCTHEME-496 Translation Gap: Delete from Cart confirmation popup. (#2065) --- CHANGELOG.md | 1 + assets/js/theme/cart.js | 1 + templates/pages/cart.html | 1 + 3 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 589491997a..7df07fd393 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## Draft +- Translation Gap: Delete from Cart confirmation popup. [#2065](https://github.com/bigcommerce/cornerstone/pull/2065) ## 5.5.0 (05-20-2021) - Scale focus trap for all modals. [#2049](https://github.com/bigcommerce/cornerstone/pull/2049) diff --git a/assets/js/theme/cart.js b/assets/js/theme/cart.js index 347eb08522..1d8f1c83ce 100644 --- a/assets/js/theme/cart.js +++ b/assets/js/theme/cart.js @@ -273,6 +273,7 @@ export default class Cart extends PageManager { text: string, icon: 'warning', showCancelButton: true, + cancelButtonText: this.context.cancelButtonText }).then((result) => { if (result.value) { // remove item from cart diff --git a/templates/pages/cart.html b/templates/pages/cart.html index 9831d27689..77a4d01f13 100644 --- a/templates/pages/cart.html +++ b/templates/pages/cart.html @@ -1,6 +1,7 @@ --- cart: true --- +{{inject 'cancelButtonText' (lang 'common.cancel')}} {{#partial "page"}}
From db80faf96ac8a5d57860b77ea46206e877e01853 Mon Sep 17 00:00:00 2001 From: Alex Saiannyi <67792608+bc-alexsaiannyi@users.noreply.github.com> Date: Mon, 24 May 2021 20:27:21 +0300 Subject: [PATCH 004/367] fix(storefront): BCTHEME-512 add translation for invalid quantity value error on cart (#2062) --- CHANGELOG.md | 1 + assets/js/theme/cart.js | 2 +- lang/en.json | 1 + templates/pages/cart.html | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7df07fd393..a8d511af1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## Draft +- Added translation for invalid quantity value error on Cart. [#2062](https://github.com/bigcommerce/cornerstone/pull/2062) - Translation Gap: Delete from Cart confirmation popup. [#2065](https://github.com/bigcommerce/cornerstone/pull/2065) ## 5.5.0 (05-20-2021) diff --git a/assets/js/theme/cart.js b/assets/js/theme/cart.js index 1d8f1c83ce..a6d5aad74b 100644 --- a/assets/js/theme/cart.js +++ b/assets/js/theme/cart.js @@ -90,7 +90,7 @@ export default class Cart extends PageManager { invalidEntry = $el.val(); $el.val(oldQty); return swal.fire({ - text: `${invalidEntry} is not a valid entry`, + text: this.context.invalidEntryMessage.replace('[ENTRY]', invalidEntry), icon: 'error', }); } else if (newQty < minQty) { diff --git a/lang/en.json b/lang/en.json index 70143f39fa..382b84025a 100755 --- a/lang/en.json +++ b/lang/en.json @@ -67,6 +67,7 @@ }, "label": "Your Cart ({quantity, plural, one {# item} other {# items}})", "is_empty": "Your cart is empty", + "invalid_entry_message": "[ENTRY] is not a valid entry", "coupon_code": "Coupon Code", "discount": "Discount", "included_in_total": " Included in Total", diff --git a/templates/pages/cart.html b/templates/pages/cart.html index 77a4d01f13..12dd9cf22f 100644 --- a/templates/pages/cart.html +++ b/templates/pages/cart.html @@ -3,6 +3,7 @@ --- {{inject 'cancelButtonText' (lang 'common.cancel')}} {{#partial "page"}} +{{inject 'invalidEntryMessage' (lang 'cart.invalid_entry_message')}}
From fb91edd81dcccf79b1fc4b3d84ff2f04a37a65fa Mon Sep 17 00:00:00 2001 From: Alex Saiannyi <67792608+bc-alexsaiannyi@users.noreply.github.com> Date: Mon, 24 May 2021 20:30:55 +0300 Subject: [PATCH 005/367] fix(storefront): BCTHEME-459 fix product quantity change error (#2052) --- CHANGELOG.md | 1 + assets/js/theme/common/models/forms.js | 39 +++++++++++++ assets/js/theme/common/product-details.js | 58 ++++++++++++------- assets/js/theme/common/utils/form-utils.js | 5 +- .../scss/components/citadel/forms/_forms.scss | 4 ++ .../stencil/productView/_productView.scss | 4 ++ lang/en.json | 1 + templates/components/amp/css/form.html | 3 + .../components/products/add-to-cart.html | 1 + 9 files changed, 92 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8d511af1d..0acbabaf61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - Use https:// for schema markup. [#2039](https://github.com/bigcommerce/cornerstone/pull/2039) - Update focus tooltip styles contrast to achieve accessibility AA Complaince. [#2047](https://github.com/bigcommerce/cornerstone/pull/2047) - Apple pay button displaying needs to be fixed. [#2043](https://github.com/bigcommerce/cornerstone/pull/2043) +- Fixed NaN error on increase/decrease product quantity by adding field validation. [#2052](https://github.com/bigcommerce/cornerstone/pull/2052) ## 5.4.0 (04-26-2021) - Incorrect focus order for product carousels. [#2034](https://github.com/bigcommerce/cornerstone/pull/2034) diff --git a/assets/js/theme/common/models/forms.js b/assets/js/theme/common/models/forms.js index ddb7dfc846..23dc4f3829 100644 --- a/assets/js/theme/common/models/forms.js +++ b/assets/js/theme/common/models/forms.js @@ -22,6 +22,45 @@ const forms = { notEmpty(value) { return value.length > 0; }, + + /** + * validates a field like product quantity + * @param value + * @returns {boolean} + * + */ + numbersOnly(value) { + const re = /^\d+$/; + return re.test(value); + }, + + /** + * validates increase in value does not exceed max + * @param {number} value + * @param {number} max + * @returns {number} + * + */ + validateIncreaseAgainstMaxBoundary(value, max) { + const raise = value + 1; + + if (!max || raise <= max) return raise; + return value; + }, + + /** + * validates decrease in value does not fall below min + * @param {number} value + * @param {number} min + * @returns {number} + * + */ + validateDecreaseAgainstMinBoundary(value, min) { + const decline = value - 1; + + if (!min || decline >= min) return decline; + return value; + }, }; export default forms; diff --git a/assets/js/theme/common/product-details.js b/assets/js/theme/common/product-details.js index c475f6b66e..6f1a3f099b 100644 --- a/assets/js/theme/common/product-details.js +++ b/assets/js/theme/common/product-details.js @@ -5,6 +5,9 @@ import 'foundation-sites/js/foundation/foundation.reveal'; import ImageGallery from '../product/image-gallery'; import modalFactory, { alertModal, showAlertModal } from '../global/modal'; import { isEmpty, isPlainObject } from 'lodash'; +import nod from '../common/nod'; +import { announceInputErrorMessage } from '../common/utils/form-utils'; +import forms from '../common/models/forms'; import { normalizeFormData } from './utils/api'; import { isBrowserIE, convertIntoArray } from './utils/ie-helpers'; import bannerUtils from './utils/banner-utils'; @@ -23,6 +26,12 @@ export default class ProductDetails extends ProductDetailsBase { this.storeInitMessagesForSwatches(); const $form = $('form[data-cart-item-add]', $scope); + + this.addToCartValidator = nod({ + submit: $form.find('input#form-action-addToCart'), + tap: announceInputErrorMessage, + }); + const $productOptionsElement = $('[data-product-option-change]', $form); const hasOptions = $productOptionsElement.html().trim().length; const hasDefaultOptions = $productOptionsElement.find('[data-default]').length; @@ -41,7 +50,10 @@ export default class ProductDetails extends ProductDetailsBase { } }; - $(window).on('load', () => $.each($productSwatchLabels, placeSwatchLabelImage)); + $(window).on('load', () => { + this.registerAddToCartValidation(); + $.each($productSwatchLabels, placeSwatchLabelImage); + }); if (context.showSwatchNames) { this.$swatchOptionMessage.removeClass('u-hidden'); @@ -65,7 +77,11 @@ export default class ProductDetails extends ProductDetailsBase { }); $form.on('submit', event => { - this.addProductToCart(event, $form[0]); + this.addToCartValidator.performCheck(); + + if (this.addToCartValidator.areAll('valid')) { + this.addProductToCart(event, $form[0]); + } }); // Update product attributes. Also update the initial view in case items are oos @@ -85,6 +101,19 @@ export default class ProductDetails extends ProductDetailsBase { this.previewModal = modalFactory('#previewModal')[0]; } + registerAddToCartValidation() { + this.addToCartValidator.add([{ + selector: '[data-quantity-change] > .form-input--incrementTotal', + validate: (cb, val) => { + const result = forms.numbersOnly(val); + cb(result); + }, + errorMessage: this.context.productQuantityErrorMessage, + }]); + + return this.addToCartValidator; + } + storeInitMessagesForSwatches() { if (this.swatchGroupIdList.length && isEmpty(this.swatchInitMessageStorage)) { this.swatchGroupIdList.each((_, swatchGroupId) => { @@ -317,35 +346,20 @@ export default class ProductDetails extends ProductDetailsBase { const quantityMin = parseInt($input.data('quantityMin'), 10); const quantityMax = parseInt($input.data('quantityMax'), 10); - let qty = parseInt($input.val(), 10); - + let qty = forms.numbersOnly($input.val()) ? parseInt($input.val(), 10) : quantityMin; // If action is incrementing if ($target.data('action') === 'inc') { - // If quantity max option is set - if (quantityMax > 0) { - // Check quantity does not exceed max - if ((qty + 1) <= quantityMax) { - qty++; - } - } else { - qty++; - } + qty = forms.validateIncreaseAgainstMaxBoundary(qty, quantityMax); } else if (qty > 1) { - // If quantity min option is set - if (quantityMin > 0) { - // Check quantity does not fall below min - if ((qty - 1) >= quantityMin) { - qty--; - } - } else { - qty--; - } + qty = forms.validateDecreaseAgainstMinBoundary(qty, quantityMin); } // update hidden input viewModel.quantity.$input.val(qty); // update text viewModel.quantity.$text.text(qty); + // perform validation after updating product quantity + this.addToCartValidator.performCheck(); }); // Prevent triggering quantity change when pressing enter diff --git a/assets/js/theme/common/utils/form-utils.js b/assets/js/theme/common/utils/form-utils.js index f750b66431..bebb29a536 100644 --- a/assets/js/theme/common/utils/form-utils.js +++ b/assets/js/theme/common/utils/form-utils.js @@ -135,8 +135,9 @@ function announceInputErrorMessage({ element, result }) { } const activeInputContainer = $(element).parent(); // the reason for using span tag is nod-validate lib - // which does not add error message class while initialising form - const errorMessage = $(activeInputContainer).find('span'); + // which does not add error message class while initialising form. + // specific class is added since it can be multiple spans + const errorMessage = $(activeInputContainer).find('span.form-inlineMessage'); if (errorMessage.length) { const $errMessage = $(errorMessage[0]); diff --git a/assets/scss/components/citadel/forms/_forms.scss b/assets/scss/components/citadel/forms/_forms.scss index 0dd0e178fc..18ace621b1 100644 --- a/assets/scss/components/citadel/forms/_forms.scss +++ b/assets/scss/components/citadel/forms/_forms.scss @@ -269,6 +269,10 @@ text-align: center; vertical-align: middle; width: remCalc(35px); + + .form-field--success & { + float:none; + } } diff --git a/assets/scss/components/stencil/productView/_productView.scss b/assets/scss/components/stencil/productView/_productView.scss index 1d51469e38..1b9337e3d9 100644 --- a/assets/scss/components/stencil/productView/_productView.scss +++ b/assets/scss/components/stencil/productView/_productView.scss @@ -301,6 +301,10 @@ font-size: 0; // 2 margin-bottom: 2rem; + &--error > .form-inlineMessage { + font-size: 1rem; + } + // scss-lint:disable SelectorDepth, NestingDepth > .form-checkbox + .form-label { diff --git a/lang/en.json b/lang/en.json index 382b84025a..ca2b6e5090 100755 --- a/lang/en.json +++ b/lang/en.json @@ -694,6 +694,7 @@ "change_product_options": "Change options for {name}", "quantity_decrease": "Decrease Quantity of {name}", "quantity_increase": "Increase Quantity of {name}", + "quantity_error_message":"The quantity should contain only numbers", "purchase_units": "{quantity, plural, =0{0 units} one {# unit} other {# units}}", "max_purchase_quantity": "Maximum Purchase:", "min_purchase_quantity": "Minimum Purchase:", diff --git a/templates/components/amp/css/form.html b/templates/components/amp/css/form.html index 6ba59efca4..4ce03954b4 100644 --- a/templates/components/amp/css/form.html +++ b/templates/components/amp/css/form.html @@ -365,6 +365,9 @@ .form-field--warning .form-input { float: left } +.form-field--success[data-quantity-change] .form-input { + float:none; +} .form-field--success .form-input, .form-field--success .form-select, .form-field--success .form-checkbox + .form-label::before, diff --git a/templates/components/products/add-to-cart.html b/templates/components/products/add-to-cart.html index 5ce93c4214..37d7fa44ae 100644 --- a/templates/components/products/add-to-cart.html +++ b/templates/components/products/add-to-cart.html @@ -1,5 +1,6 @@
{{#if theme_settings.show_product_quantity_box}} + {{inject 'productQuantityErrorMessage' (lang 'products.quantity_error_message')}}
From 27a4d5962964ce7de5189e29b9ddbef9025b4fa6 Mon Sep 17 00:00:00 2001 From: Tymur Biedukhin Date: Mon, 24 May 2021 20:36:12 +0300 Subject: [PATCH 006/367] Fix eslint grunt check --- assets/js/theme/cart.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/theme/cart.js b/assets/js/theme/cart.js index a6d5aad74b..46b630e24c 100644 --- a/assets/js/theme/cart.js +++ b/assets/js/theme/cart.js @@ -273,7 +273,7 @@ export default class Cart extends PageManager { text: string, icon: 'warning', showCancelButton: true, - cancelButtonText: this.context.cancelButtonText + cancelButtonText: this.context.cancelButtonText, }).then((result) => { if (result.value) { // remove item from cart From 2b049c7bca7c91b803d5aa5e21632d878090e009 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 May 2021 20:38:06 +0300 Subject: [PATCH 007/367] build(deps): bump underscore from 1.12.0 to 1.13.1 (#2053) --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index a6346d3754..bcc6b29030 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16893,9 +16893,9 @@ "dev": true }, "underscore": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.12.0.tgz", - "integrity": "sha512-21rQzss/XPMjolTiIezSu3JAjgagXKROtNrYFEOWK109qY1Uv2tVjPTZ1ci2HgvQDA16gHYSthQIJfB+XId/rQ==", + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.1.tgz", + "integrity": "sha512-hzSoAVtJF+3ZtiFX0VgfFPHEDRm7Y/QPjGyNo4TVdnDTdft3tr8hEkD25a1jC+TjTuE7tkHGKkhwCgs9dgBB2g==", "dev": true }, "underscore.string": { From ea5da55f2bb79cea42c029b8dd4fa6c1fb52b3f0 Mon Sep 17 00:00:00 2001 From: Tymur Biedukhin Date: Mon, 24 May 2021 20:42:40 +0300 Subject: [PATCH 008/367] Updated CHANGELOG.md for #2052 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0acbabaf61..433a28c4f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Draft - Added translation for invalid quantity value error on Cart. [#2062](https://github.com/bigcommerce/cornerstone/pull/2062) - Translation Gap: Delete from Cart confirmation popup. [#2065](https://github.com/bigcommerce/cornerstone/pull/2065) +- Fixed NaN error on increase/decrease product quantity by adding field validation. [#2052](https://github.com/bigcommerce/cornerstone/pull/2052) ## 5.5.0 (05-20-2021) - Scale focus trap for all modals. [#2049](https://github.com/bigcommerce/cornerstone/pull/2049) @@ -11,7 +12,6 @@ - Use https:// for schema markup. [#2039](https://github.com/bigcommerce/cornerstone/pull/2039) - Update focus tooltip styles contrast to achieve accessibility AA Complaince. [#2047](https://github.com/bigcommerce/cornerstone/pull/2047) - Apple pay button displaying needs to be fixed. [#2043](https://github.com/bigcommerce/cornerstone/pull/2043) -- Fixed NaN error on increase/decrease product quantity by adding field validation. [#2052](https://github.com/bigcommerce/cornerstone/pull/2052) ## 5.4.0 (04-26-2021) - Incorrect focus order for product carousels. [#2034](https://github.com/bigcommerce/cornerstone/pull/2034) From 9ca4c7432f3d76960fdf25a9ed6a09d0076613eb Mon Sep 17 00:00:00 2001 From: yurytut1993 <66325265+yurytut1993@users.noreply.github.com> Date: Tue, 25 May 2021 19:08:30 +0300 Subject: [PATCH 009/367] fix(storefront): BCTHEME-514 Translation Gap: Gift Certificate -> Code required message (#2064) --- CHANGELOG.md | 1 + assets/js/theme/cart.js | 8 +++++--- assets/js/theme/common/gift-certificate-validator.js | 2 +- assets/js/theme/gift-certificate.js | 6 +++--- lang/en.json | 10 ++++++---- templates/components/cart/gift-certificate-input.html | 2 +- 6 files changed, 17 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 433a28c4f5..ed905dea71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## Draft +- Translation Gap: Gift Certificate -> Code required message. [#2064](https://github.com/bigcommerce/cornerstone/pull/2064) - Added translation for invalid quantity value error on Cart. [#2062](https://github.com/bigcommerce/cornerstone/pull/2062) - Translation Gap: Delete from Cart confirmation popup. [#2065](https://github.com/bigcommerce/cornerstone/pull/2065) - Fixed NaN error on increase/decrease product quantity by adding field validation. [#2052](https://github.com/bigcommerce/cornerstone/pull/2052) diff --git a/assets/js/theme/cart.js b/assets/js/theme/cart.js index 46b630e24c..a08e11dc31 100644 --- a/assets/js/theme/cart.js +++ b/assets/js/theme/cart.js @@ -1,6 +1,7 @@ import PageManager from './page-manager'; import { bind, debounce } from 'lodash'; -import giftCertCheck from './common/gift-certificate-validator'; +import checkIsGiftCertValid from './common/gift-certificate-validator'; +import { createTranslationDictionary } from './common/utils/translations-utils'; import utils from '@bigcommerce/stencil-utils'; import ShippingEstimator from './cart/shipping-estimator'; import { defaultModal } from './global/modal'; @@ -364,9 +365,10 @@ export default class Cart extends PageManager { event.preventDefault(); - if (!giftCertCheck(code)) { + if (!checkIsGiftCertValid(code)) { + const validationDictionary = createTranslationDictionary(this.context); return swal.fire({ - text: $certInput.data('error'), + text: validationDictionary.invalid_gift_certificate, icon: 'error', }); } diff --git a/assets/js/theme/common/gift-certificate-validator.js b/assets/js/theme/common/gift-certificate-validator.js index da49d7fdd7..aad6bf3123 100644 --- a/assets/js/theme/common/gift-certificate-validator.js +++ b/assets/js/theme/common/gift-certificate-validator.js @@ -1,5 +1,5 @@ export default function (cert) { - if (typeof cert !== 'string') { + if (typeof cert !== 'string' || cert.length === 0) { return false; } diff --git a/assets/js/theme/gift-certificate.js b/assets/js/theme/gift-certificate.js index f4cba12f97..d9d0018493 100644 --- a/assets/js/theme/gift-certificate.js +++ b/assets/js/theme/gift-certificate.js @@ -1,6 +1,6 @@ import PageManager from './page-manager'; import nod from './common/nod'; -import giftCertChecker from './common/gift-certificate-validator'; +import checkIsGiftCertValid from './common/gift-certificate-validator'; import formModel from './common/models/forms'; import { createTranslationDictionary } from './common/utils/translations-utils'; import { announceInputErrorMessage } from './common/utils/form-utils'; @@ -204,9 +204,9 @@ export default class GiftCertificate extends PageManager { balanceValidator.add({ selector: $balanceForm.find('input[name="giftcertificatecode"]'), validate(cb, val) { - cb(giftCertChecker(val)); + cb(checkIsGiftCertValid(val)); }, - errorMessage: 'You must enter a certificate code.', + errorMessage: this.validationDictionary.invalid_gift_certificate, }); return balanceValidator; diff --git a/lang/en.json b/lang/en.json index ca2b6e5090..764c8c1c6c 100755 --- a/lang/en.json +++ b/lang/en.json @@ -93,7 +93,6 @@ "gift_certificate": "Gift Certificate", "code_label": "Gift Certificate ({code})", "cert_code": "Enter your certificate code", - "empty_error": "Please enter your valid certificate code.", "remove": "Remove" }, "shipping_estimator": { @@ -925,7 +924,8 @@ "price_max_evaluation": "Min. price must be less than max. price.", "price_min_not_entered": "Min. price is required.", "price_max_not_entered": "Max. price is required.", - "price_invalid_value": "Input must be greater than 0." + "price_invalid_value": "Input must be greater than 0.", + "invalid_gift_certificate": "Please enter your valid certificate code." }, "validation_fallback_messages": { "valid_email": "You must enter a valid email.", @@ -939,7 +939,8 @@ "price_max_evaluation": "Min. price must be less than max. price.", "price_min_not_entered": "Min. price is required.", "price_max_not_entered": "Max. price is required.", - "price_invalid_value": "Input must be greater than 0." + "price_invalid_value": "Input must be greater than 0.", + "invalid_gift_certificate": "Please enter your valid certificate code." }, "validation_default_messages": { "valid_email": "You must enter a valid email.", @@ -953,6 +954,7 @@ "price_max_evaluation": "Min. price must be less than max. price.", "price_min_not_entered": "Min. price is required.", "price_max_not_entered": "Max. price is required.", - "price_invalid_value": "Input must be greater than 0." + "price_invalid_value": "Input must be greater than 0.", + "invalid_gift_certificate": "Please enter your valid certificate code." } } diff --git a/templates/components/cart/gift-certificate-input.html b/templates/components/cart/gift-certificate-input.html index 2759cad7c5..4b8aef4ade 100644 --- a/templates/components/cart/gift-certificate-input.html +++ b/templates/components/cart/gift-certificate-input.html @@ -8,7 +8,7 @@ @@ -154,7 +154,7 @@

data-confirm-delete="{{lang 'cart.confirm_delete'}}" aria-label="{{lang 'cart.remove_item' name=name}}" > - + {{/or}} diff --git a/templates/components/common/currency-selector.html b/templates/components/common/currency-selector.html index 71a7874613..96e6f75546 100644 --- a/templates/components/common/currency-selector.html +++ b/templates/components/common/currency-selector.html @@ -10,7 +10,7 @@ {{lang 'common.currency' code=currency_selector.active_currency_code}} diff --git a/templates/components/common/navigation-dropdown.html b/templates/components/common/navigation-dropdown.html index 2f2b4a20cf..303a315331 100644 --- a/templates/components/common/navigation-dropdown.html +++ b/templates/components/common/navigation-dropdown.html @@ -7,7 +7,7 @@ diff --git a/templates/components/common/wishlist-dropdown.html b/templates/components/common/wishlist-dropdown.html index dda1f5d98a..3637b91a11 100644 --- a/templates/components/common/wishlist-dropdown.html +++ b/templates/components/common/wishlist-dropdown.html @@ -8,7 +8,7 @@ {{lang 'account.wishlists.add_item'}} diff --git a/templates/components/faceted-search/faceted-search-navigation.html b/templates/components/faceted-search/faceted-search-navigation.html index 4312cf72df..1bfec71075 100644 --- a/templates/components/faceted-search/faceted-search-navigation.html +++ b/templates/components/faceted-search/faceted-search-navigation.html @@ -10,10 +10,10 @@ - + - + diff --git a/templates/components/faceted-search/facets/multi.html b/templates/components/faceted-search/facets/multi.html index 9ad003d444..f4b8c45f7d 100644 --- a/templates/components/faceted-search/facets/multi.html +++ b/templates/components/faceted-search/facets/multi.html @@ -18,7 +18,7 @@ diff --git a/templates/components/faceted-search/index.html b/templates/components/faceted-search/index.html index cd889eec7d..7a20b5e10d 100644 --- a/templates/components/faceted-search/index.html +++ b/templates/components/faceted-search/index.html @@ -15,7 +15,7 @@ {{lang 'search.faceted.hide-filters'}} @@ -23,7 +23,7 @@ {{lang 'search.faceted.show-filters'}} diff --git a/templates/components/faceted-search/selected-facets.html b/templates/components/faceted-search/selected-facets.html index 3cab2bbbaa..493b61bb73 100644 --- a/templates/components/faceted-search/selected-facets.html +++ b/templates/components/faceted-search/selected-facets.html @@ -19,7 +19,7 @@

{{/if}} - + diff --git a/templates/components/products/add-to-cart.html b/templates/components/products/add-to-cart.html index 2cbed0e722..b62792f9a1 100644 --- a/templates/components/products/add-to-cart.html +++ b/templates/components/products/add-to-cart.html @@ -1,5 +1,5 @@
- {{#if product.show_quantity_input}} + {{#if theme_settings.show_product_quantity_box}} {{inject 'productQuantityErrorMessage' (lang 'products.quantity_error_message')}}