From 3b31c48c87f460cb6976c80545c0b586e95b2a5d Mon Sep 17 00:00:00 2001 From: Serhiy Shkolyarenko <sshkolyarenko@ebay.com> Date: Sat, 14 Mar 2015 15:22:15 +0200 Subject: [PATCH] MAGETWO-19331: Impossible add to the shopping cart product with Custom option type="file" changes from Ievgen Shakhsuvarov static test fixes (cherry picked from commit ec03baa) --- .../view/frontend/web/js/catalog-add-to-cart.js | 10 ++++++++++ .../Sales/Controller/Download/DownloadCustomOption.php | 4 ++-- .../Magento/Test/Legacy/_files/obsolete_classes.php | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/view/frontend/web/js/catalog-add-to-cart.js b/app/code/Magento/Catalog/view/frontend/web/js/catalog-add-to-cart.js index 74e1566a8dc..faf107ba548 100644 --- a/app/code/Magento/Catalog/view/frontend/web/js/catalog-add-to-cart.js +++ b/app/code/Magento/Catalog/view/frontend/web/js/catalog-add-to-cart.js @@ -38,6 +38,16 @@ define([ }, submitForm: function(form) { + var self = this; + if (form.has('input[type="file"]').length) { + self.element.off('submit'); + form.submit(); + } else { + self.ajaxSubmit(form); + } + }, + + ajaxSubmit: function(form) { var self = this; $.ajax({ url: form.attr('action'), diff --git a/app/code/Magento/Sales/Controller/Download/DownloadCustomOption.php b/app/code/Magento/Sales/Controller/Download/DownloadCustomOption.php index ae18cf9d1bc..de556cb7ebf 100644 --- a/app/code/Magento/Sales/Controller/Download/DownloadCustomOption.php +++ b/app/code/Magento/Sales/Controller/Download/DownloadCustomOption.php @@ -7,9 +7,9 @@ namespace Magento\Sales\Controller\Download; use Magento\Sales\Model\Download; -use \Magento\Framework\App\Action\Context; +use Magento\Framework\App\Action\Context; use Magento\Catalog\Model\Product\Type\AbstractType; -use \Magento\Framework\Controller\Result\ForwardFactory; +use Magento\Framework\Controller\Result\ForwardFactory; class DownloadCustomOption extends \Magento\Framework\App\Action\Action { diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php index 37f6f3e6f80..467197b5879 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php @@ -115,6 +115,7 @@ return [ ['Magento\Sales\Block\Adminhtml\Order\Shipment\View', 'Magento\Shipping\Block\Adminhtml\View'], ['Magento\Sales\Block\Order\Shipment\Items', 'Magento\Shipping\Block\Items'], ['Magento\Sales\Controller\Adminhtml\Order\Shipment', 'Magento\Shipping\Controller\Adminhtml\Order\Shipment'], + ['Magento\Sales\Controller\Download'], ['Magento\Sales\Block\Order\Shipment', 'Magento\Shipping\Block\Order\Shipment'], ['Mage_Adminhtml_Block_Sales_Order_Create_Customer_Grid'], ['Mage_Adminhtml_Block_Sales_Order_Create_Search_Grid_Renderer_Giftmessage'], -- GitLab