Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- ./view/frontend/web/js/catalog-add-to-cart.js 2018-04-16 17:21:32.000000000 +0200
- +++ ./view/frontend/web/js/catalog-add-to-cart.js 2018-04-16 17:21:32.000000000 +0200
- @@ -33,11 +33,14 @@
- _bindSubmit: function() {
- var self = this;
- + this.element.mage('validation');
- this.element.on('submit', function(e) {
- e.preventDefault();
- - self.submitForm($(this));
- + if(self.element.valid()) {
- + self.submitForm($(this));
- + }
- });
- - },
- + },
- isLoaderEnabled: function() {
- return this.options.processStart && this.options.processStop;
- @@ -120,7 +123,7 @@
- },
- disableAddToCartButton: function(form) {
- - var addToCartButtonTextWhileAdding = this.options.addToCartButtonTextWhileAdding || $t('Adding...');
- + var addToCartButtonTextWhileAdding = this.options.addToCartButtonTextWhileAdding || $t('Adding to Bag...');
- var addToCartButton = $(form).find(this.options.addToCartButtonSelector);
- addToCartButton.addClass(this.options.addToCartButtonDisabledClass);
- addToCartButton.find('span').text(addToCartButtonTextWhileAdding);
- @@ -128,7 +131,7 @@
- },
- enableAddToCartButton: function(form) {
- - var addToCartButtonTextAdded = this.options.addToCartButtonTextAdded || $t('Added');
- + var addToCartButtonTextAdded = this.options.addToCartButtonTextAdded || $t('Added to Bag!');
- var self = this,
- addToCartButton = $(form).find(this.options.addToCartButtonSelector);
- --- ./view/frontend/templates/product/view/addtocart.phtml 2018-04-17 10:40:22.000000000 +0200
- +++ ./view/frontend/templates/product/view/addtocart.phtml 2018-04-17 10:40:22.000000000 +0200
- @@ -40,17 +40,17 @@
- </div>
- </div>
- <?php endif; ?>
- -<?php if ($block->isRedirectToCartEnabled()) : ?>
- +
- <script type="text/x-magento-init">
- {
- "#product_addtocart_form": {
- "Magento_Catalog/product/view/validation": {
- - "radioCheckboxClosest": ".nested"
- + "radioCheckboxClosest": ".nested",
- + "bindSubmit": true
- }
- }
- }
- </script>
- -<?php else : ?>
- <script type="text/x-magento-init">
- {
- "#product_addtocart_form": {
- @@ -58,4 +58,3 @@
- }
- }
- </script>
- -<?php endif; ?>
Add Comment
Please, Sign In to add comment