Guest User

Untitled

a guest
Apr 24th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. --- ./view/frontend/web/js/catalog-add-to-cart.js 2018-04-16 17:21:32.000000000 +0200
  2. +++ ./view/frontend/web/js/catalog-add-to-cart.js 2018-04-16 17:21:32.000000000 +0200
  3. @@ -33,11 +33,14 @@
  4.  
  5. _bindSubmit: function() {
  6. var self = this;
  7. + this.element.mage('validation');
  8. this.element.on('submit', function(e) {
  9. e.preventDefault();
  10. - self.submitForm($(this));
  11. + if(self.element.valid()) {
  12. + self.submitForm($(this));
  13. + }
  14. });
  15. - },
  16. + },
  17.  
  18. isLoaderEnabled: function() {
  19. return this.options.processStart && this.options.processStop;
  20. @@ -120,7 +123,7 @@
  21. },
  22.  
  23. disableAddToCartButton: function(form) {
  24. - var addToCartButtonTextWhileAdding = this.options.addToCartButtonTextWhileAdding || $t('Adding...');
  25. + var addToCartButtonTextWhileAdding = this.options.addToCartButtonTextWhileAdding || $t('Adding to Bag...');
  26. var addToCartButton = $(form).find(this.options.addToCartButtonSelector);
  27. addToCartButton.addClass(this.options.addToCartButtonDisabledClass);
  28. addToCartButton.find('span').text(addToCartButtonTextWhileAdding);
  29. @@ -128,7 +131,7 @@
  30. },
  31.  
  32. enableAddToCartButton: function(form) {
  33. - var addToCartButtonTextAdded = this.options.addToCartButtonTextAdded || $t('Added');
  34. + var addToCartButtonTextAdded = this.options.addToCartButtonTextAdded || $t('Added to Bag!');
  35. var self = this,
  36. addToCartButton = $(form).find(this.options.addToCartButtonSelector);
  37.  
  38. --- ./view/frontend/templates/product/view/addtocart.phtml 2018-04-17 10:40:22.000000000 +0200
  39. +++ ./view/frontend/templates/product/view/addtocart.phtml 2018-04-17 10:40:22.000000000 +0200
  40. @@ -40,17 +40,17 @@
  41. </div>
  42. </div>
  43. <?php endif; ?>
  44. -<?php if ($block->isRedirectToCartEnabled()) : ?>
  45. +
  46. <script type="text/x-magento-init">
  47. {
  48. "#product_addtocart_form": {
  49. "Magento_Catalog/product/view/validation": {
  50. - "radioCheckboxClosest": ".nested"
  51. + "radioCheckboxClosest": ".nested",
  52. + "bindSubmit": true
  53. }
  54. }
  55. }
  56. </script>
  57. -<?php else : ?>
  58. <script type="text/x-magento-init">
  59. {
  60. "#product_addtocart_form": {
  61. @@ -58,4 +58,3 @@
  62. }
  63. }
  64. </script>
  65. -<?php endif; ?>
Add Comment
Please, Sign In to add comment