From 1ff16642855a313b3b8e4a7a9a6e836c09769c69 Mon Sep 17 00:00:00 2001 From: Dmytro Horytskyi Date: Mon, 3 Sep 2018 18:33:15 +0300 Subject: [PATCH 01/28] MAGETWO-94424: [2.3] Wrong product and shipping prices are applying on admin orders --- app/code/Magento/Store/Model/Store.php | 20 ++-- .../Store/Test/Unit/Model/StoreTest.php | 98 ++++++++++++++++++- 2 files changed, 103 insertions(+), 15 deletions(-) diff --git a/app/code/Magento/Store/Model/Store.php b/app/code/Magento/Store/Model/Store.php index af25957257421..32c9a78448428 100644 --- a/app/code/Magento/Store/Model/Store.php +++ b/app/code/Magento/Store/Model/Store.php @@ -902,23 +902,17 @@ public function setCurrentCurrencyCode($code) */ public function getCurrentCurrencyCode() { + $availableCurrencyCodes = \array_values($this->getAvailableCurrencyCodes(true)); // try to get currently set code among allowed - $code = $this->_httpContext->getValue(Context::CONTEXT_CURRENCY); - $code = $code === null ? $this->_getSession()->getCurrencyCode() : $code; - if (empty($code)) { + $code = $this->_httpContext->getValue(Context::CONTEXT_CURRENCY) ?? $this->_getSession()->getCurrencyCode(); + if (empty($code) || !\in_array($code, $availableCurrencyCodes)) { $code = $this->getDefaultCurrencyCode(); - } - if (in_array($code, $this->getAvailableCurrencyCodes(true))) { - return $code; + if (!\in_array($code, $availableCurrencyCodes) && !empty($availableCurrencyCodes)) { + $code = $availableCurrencyCodes[0]; + } } - // take first one of allowed codes - $codes = array_values($this->getAvailableCurrencyCodes(true)); - if (empty($codes)) { - // return default code, if no codes specified at all - return $this->getDefaultCurrencyCode(); - } - return array_shift($codes); + return $code; } /** diff --git a/app/code/Magento/Store/Test/Unit/Model/StoreTest.php b/app/code/Magento/Store/Test/Unit/Model/StoreTest.php index f98cf5d892e07..f4a5010e51b88 100644 --- a/app/code/Magento/Store/Test/Unit/Model/StoreTest.php +++ b/app/code/Magento/Store/Test/Unit/Model/StoreTest.php @@ -3,11 +3,11 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\Store\Test\Unit\Model; use Magento\Framework\App\Config\ReinitableConfigInterface; use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\Session\SessionManagerInterface; use Magento\Store\Model\ScopeInterface; use Magento\Store\Model\Store; @@ -38,6 +38,16 @@ class StoreTest extends \PHPUnit\Framework\TestCase */ protected $filesystemMock; + /** + * @var ReinitableConfigInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $configMock; + + /** + * @var SessionManagerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $sessionMock; + /** * @var \Magento\Framework\Url\ModifierInterface|\PHPUnit_Framework_MockObject_MockObject */ @@ -61,12 +71,22 @@ protected function setUp() 'isSecure', 'getServer', ]); + $this->filesystemMock = $this->getMockBuilder(\Magento\Framework\Filesystem::class) ->disableOriginalConstructor() ->getMock(); + $this->configMock = $this->getMockBuilder(ReinitableConfigInterface::class) + ->getMock(); + $this->sessionMock = $this->getMockBuilder(SessionManagerInterface::class) + ->setMethods(['getCurrencyCode']) + ->getMockForAbstractClass(); $this->store = $this->objectManagerHelper->getObject( \Magento\Store\Model\Store::class, - ['filesystem' => $this->filesystemMock] + [ + 'filesystem' => $this->filesystemMock, + 'config' => $this->configMock, + 'session' => $this->sessionMock, + ] ); $this->urlModifierMock = $this->createMock(\Magento\Framework\Url\ModifierInterface::class); @@ -694,6 +714,80 @@ public function testGetScopeTypeName() $this->assertEquals('Store View', $this->store->getScopeTypeName()); } + /** + * @param array $availableCodes + * @param string $currencyCode + * @param string $defaultCode + * @param string $expectedCode + * @return void + * @dataProvider currencyCodeDataProvider + */ + public function testGetCurrentCurrencyCode( + array $availableCodes, + string $currencyCode, + string $defaultCode, + string $expectedCode + ): void { + $this->store->setData('available_currency_codes', $availableCodes); + $this->sessionMock->method('getCurrencyCode') + ->willReturn($currencyCode); + $this->configMock->method('getValue') + ->with(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_DEFAULT) + ->willReturn($defaultCode); + + $code = $this->store->getCurrentCurrencyCode(); + $this->assertEquals($expectedCode, $code); + } + + /** + * @return array + */ + public function currencyCodeDataProvider(): array + { + return [ + [ + [ + 'USD', + ], + 'USD', + 'USD', + 'USD', + ], + [ + [ + 'USD', + 'EUR', + ], + 'EUR', + 'USD', + 'EUR', + ], + [ + [ + 'EUR', + 'USD', + ], + 'GBP', + 'USD', + 'USD', + ], + [ + [ + 'USD', + ], + 'GBP', + 'EUR', + 'USD', + ], + [ + [], + 'GBP', + 'EUR', + 'EUR', + ], + ]; + } + /** * @param \Magento\Store\Model\Store $model */ From 12634b0bc936f92ab8b37dbfec5f781e790551d7 Mon Sep 17 00:00:00 2001 From: Dmytro Horytskyi Date: Tue, 25 Sep 2018 15:57:04 +0300 Subject: [PATCH 02/28] MAGETWO-95137: [2.3] Return path e-mail variable system/smtp/return_path_email doesn't work --- app/code/Magento/Email/Model/Transport.php | 44 ++++++++++++++-------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/app/code/Magento/Email/Model/Transport.php b/app/code/Magento/Email/Model/Transport.php index 5a4d64e6d6c0e..c270c3086cca9 100644 --- a/app/code/Magento/Email/Model/Transport.php +++ b/app/code/Magento/Email/Model/Transport.php @@ -31,6 +31,23 @@ class Transport implements TransportInterface */ const XML_PATH_SENDING_RETURN_PATH_EMAIL = 'system/smtp/return_path_email'; + /** + * Configuration of whether return path should be set or no. + * + * Possible values are: + * 0 - no + * 1 - yes (set value as FROM address) + * 2 - use custom value + * + * @var int + */ + private $isSetReturnPath; + + /** + * @var string|null + */ + private $returnPathValue; + /** * @var Sendmail */ @@ -51,25 +68,15 @@ public function __construct( ScopeConfigInterface $scopeConfig, $parameters = null ) { - /* configuration of whether return path should be set or no. Possible values are: - * 0 - no - * 1 - yes (set value as FROM address) - * 2 - use custom value - * @see Magento\Config\Model\Config\Source\Yesnocustom - */ - $isSetReturnPath = $scopeConfig->getValue( + $this->isSetReturnPath = (int) $scopeConfig->getValue( self::XML_PATH_SENDING_SET_RETURN_PATH, ScopeInterface::SCOPE_STORE ); - $returnPathValue = $scopeConfig->getValue( + $this->returnPathValue = $scopeConfig->getValue( self::XML_PATH_SENDING_RETURN_PATH_EMAIL, ScopeInterface::SCOPE_STORE ); - if ($isSetReturnPath == '2' && $returnPathValue !== null) { - $parameters .= ' -f' . \escapeshellarg($returnPathValue); - } - $this->zendTransport = new Sendmail($parameters); $this->message = $message; } @@ -80,9 +87,16 @@ public function __construct( public function sendMessage() { try { - $this->zendTransport->send( - Message::fromString($this->message->getRawMessage()) - ); + $zendMessage = Message::fromString($this->message->getRawMessage()); + if (2 === $this->isSetReturnPath && $this->returnPathValue) { + $zendMessage->setSender($this->returnPathValue); + } elseif (1 === $this->isSetReturnPath && $zendMessage->getFrom()->count()) { + $fromAddressList = $zendMessage->getFrom(); + $fromAddressList->rewind(); + $zendMessage->setSender($fromAddressList->current()->getEmail()); + } + + $this->zendTransport->send($zendMessage); } catch (\Exception $e) { throw new MailException(new Phrase($e->getMessage()), $e); } From caab8f7e1a1c213a7a0928b9c88f9760903ae17a Mon Sep 17 00:00:00 2001 From: Dmytro Horytskyi Date: Wed, 26 Sep 2018 13:12:32 +0300 Subject: [PATCH 03/28] MAGETWO-95137: [2.3] Return path e-mail variable system/smtp/return_path_email doesn't work --- app/code/Magento/Email/Model/Transport.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Email/Model/Transport.php b/app/code/Magento/Email/Model/Transport.php index c270c3086cca9..28d2d171eecf4 100644 --- a/app/code/Magento/Email/Model/Transport.php +++ b/app/code/Magento/Email/Model/Transport.php @@ -32,7 +32,7 @@ class Transport implements TransportInterface const XML_PATH_SENDING_RETURN_PATH_EMAIL = 'system/smtp/return_path_email'; /** - * Configuration of whether return path should be set or no. + * Whether return path should be set or no. * * Possible values are: * 0 - no From 9ff3f48412067730c9926bf6354d896d4b21f4a8 Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov Date: Wed, 3 Oct 2018 13:47:29 +0300 Subject: [PATCH 04/28] MAGETWO-95299: Ability to upload PDP images without compression and downsizing --- .../Magento/Backend/Block/Media/Uploader.php | 26 +++++-- .../Backend/Model/Image/ImageUploadConfig.php | 72 +++++++++++++++++++ .../Image/ImageUploadConfigInterface.php | 37 ++++++++++ app/code/Magento/Backend/etc/adminhtml/di.xml | 1 + .../Magento/Backend/etc/adminhtml/system.xml | 15 +++- app/code/Magento/Backend/etc/config.xml | 1 + .../adminhtml/templates/media/uploader.phtml | 3 +- .../view/adminhtml/web/js/media-uploader.js | 16 +++-- .../Magento/Framework/File/Uploader.php | 4 +- .../Framework/Image/Adapter/Config.php | 12 ++++ .../Image/Adapter/UploadConfigInterface.php | 2 + 11 files changed, 173 insertions(+), 16 deletions(-) create mode 100644 app/code/Magento/Backend/Model/Image/ImageUploadConfig.php create mode 100644 app/code/Magento/Backend/Model/Image/ImageUploadConfigInterface.php diff --git a/app/code/Magento/Backend/Block/Media/Uploader.php b/app/code/Magento/Backend/Block/Media/Uploader.php index eb98808dd644b..6962141c465b8 100644 --- a/app/code/Magento/Backend/Block/Media/Uploader.php +++ b/app/code/Magento/Backend/Block/Media/Uploader.php @@ -10,6 +10,7 @@ use Magento\Framework\App\ObjectManager; use Magento\Framework\Serialize\Serializer\Json; use Magento\Framework\Image\Adapter\UploadConfigInterface; +use Magento\Backend\Model\Image\ImageUploadConfigInterface; /** * Adminhtml media library uploader @@ -39,9 +40,9 @@ class Uploader extends \Magento\Backend\Block\Widget private $jsonEncoder; /** - * @var UploadConfigInterface + * @var ImageUploadConfigInterface */ - private $imageConfig; + private $imageUploadConfig; /** * @param \Magento\Backend\Block\Template\Context $context @@ -49,18 +50,19 @@ class Uploader extends \Magento\Backend\Block\Widget * @param array $data * @param Json $jsonEncoder * @param UploadConfigInterface $imageConfig + * @param ImageUploadConfigInterface $imageUploadConfig */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Framework\File\Size $fileSize, array $data = [], Json $jsonEncoder = null, - UploadConfigInterface $imageConfig = null + UploadConfigInterface $imageConfig = null, + ImageUploadConfigInterface $imageUploadConfig = null ) { $this->_fileSizeService = $fileSize; $this->jsonEncoder = $jsonEncoder ?: ObjectManager::getInstance()->get(Json::class); - $this->imageConfig = $imageConfig ?: ObjectManager::getInstance()->get(UploadConfigInterface::class); - + $this->imageUploadConfig = $imageUploadConfig ?: ObjectManager::getInstance()->get(UploadConfigInterface::class); parent::__construct($context, $data); } @@ -111,7 +113,7 @@ public function getFileSizeService() */ public function getImageUploadMaxWidth() { - return $this->imageConfig->getMaxWidth(); + return $this->imageUploadConfig->getMaxWidth(); } /** @@ -121,7 +123,17 @@ public function getImageUploadMaxWidth() */ public function getImageUploadMaxHeight() { - return $this->imageConfig->getMaxHeight(); + return $this->imageUploadConfig->getMaxHeight(); + } + + /** + * Get image resize configuration + * + * @return bool + */ + public function getIsResizeEnabled(): bool + { + return $this->imageUploadConfig->isResizeEnabled(); } /** diff --git a/app/code/Magento/Backend/Model/Image/ImageUploadConfig.php b/app/code/Magento/Backend/Model/Image/ImageUploadConfig.php new file mode 100644 index 0000000000000..b7e13b1e8274c --- /dev/null +++ b/app/code/Magento/Backend/Model/Image/ImageUploadConfig.php @@ -0,0 +1,72 @@ +config = $config; + } + + /** + * Get maximal width value for resized image + * + * @return int + */ + public function getMaxWidth(): int + { + return (int)$this->config->getValue(self::XML_PATH_MAX_WIDTH_IMAGE); + } + + /** + * Get maximal height value for resized image + * + * @return int + */ + public function getMaxHeight(): int + { + return (int)$this->config->getValue(self::XML_PATH_MAX_HEIGHT_IMAGE); + } + + /** + * Get config value for frontend resize + * + * @return bool + */ + public function isResizeEnabled(): bool + { + return (bool)$this->config->getValue(self::XML_PATH_ENABLE_RESIZE); + } +} diff --git a/app/code/Magento/Backend/Model/Image/ImageUploadConfigInterface.php b/app/code/Magento/Backend/Model/Image/ImageUploadConfigInterface.php new file mode 100644 index 0000000000000..254a13407b2c1 --- /dev/null +++ b/app/code/Magento/Backend/Model/Image/ImageUploadConfigInterface.php @@ -0,0 +1,37 @@ + + diff --git a/app/code/Magento/Backend/etc/adminhtml/system.xml b/app/code/Magento/Backend/etc/adminhtml/system.xml index e061455acbe6b..3a0d3e50acc5a 100644 --- a/app/code/Magento/Backend/etc/adminhtml/system.xml +++ b/app/code/Magento/Backend/etc/adminhtml/system.xml @@ -338,15 +338,26 @@ - + + + Magento\Config\Model\Config\Source\Yesno + Resize performed by javascript during file upload. + + validate-greater-than-zero validate-number required-entry Maximum allowed width for uploaded image. + + 1 + - + validate-greater-than-zero validate-number required-entry Maximum allowed height for uploaded image. + + 1 + diff --git a/app/code/Magento/Backend/etc/config.xml b/app/code/Magento/Backend/etc/config.xml index 45d283ad3ff22..8283fa18dd370 100644 --- a/app/code/Magento/Backend/etc/config.xml +++ b/app/code/Magento/Backend/etc/config.xml @@ -29,6 +29,7 @@ 1 + 1 1920 1200 diff --git a/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml b/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml index 966372773f295..edd54ae38b6a1 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml @@ -14,7 +14,8 @@ "Magento_Backend/js/media-uploader" : { "maxFileSize": getFileSizeService()->getMaxFileSize() ?>, "maxWidth":getImageUploadMaxWidth() ?> , - "maxHeight": getImageUploadMaxHeight() ?> + "maxHeight": getImageUploadMaxHeight() ?>, + "isResizeEnabled": getIsResizeEnabled() ?> } }' > diff --git a/app/code/Magento/Backend/view/adminhtml/web/js/media-uploader.js b/app/code/Magento/Backend/view/adminhtml/web/js/media-uploader.js index 7e0b6bdfb46dd..35e9ec244df24 100644 --- a/app/code/Magento/Backend/view/adminhtml/web/js/media-uploader.js +++ b/app/code/Magento/Backend/view/adminhtml/web/js/media-uploader.js @@ -35,7 +35,10 @@ define([ _create: function () { var self = this, - progressTmpl = mageTemplate('[data-template="uploader"]'); + progressTmpl = mageTemplate('[data-template="uploader"]'), + resizeConfig = { + action: 'resize' + }; this.element.find('input[type=file]').fileupload({ dataType: 'json', @@ -120,14 +123,19 @@ define([ stop: fileUploader.uploaderConfig.stop }); + if (typeof this.options.isResizeEnabled !== 'undefined' && this.options.isResizeEnabled === true) { + resizeConfig.maxWidth = this.options.maxWidth; + resizeConfig.maxHeight = this.options.maxHeight; + } + this.element.find('input[type=file]').fileupload('option', { process: [{ action: 'load', fileTypes: /^image\/(gif|jpeg|png)$/, maxFileSize: this.options.maxFileSize - }, { - action: 'resize' - }, { + }, + resizeConfig, + { action: 'save' }] }); diff --git a/lib/internal/Magento/Framework/File/Uploader.php b/lib/internal/Magento/Framework/File/Uploader.php index 9a6787ddbaffd..0785177042451 100644 --- a/lib/internal/Magento/Framework/File/Uploader.php +++ b/lib/internal/Magento/Framework/File/Uploader.php @@ -140,14 +140,14 @@ class Uploader * @deprecated * @see \Magento\Framework\Image\Adapter\UploadConfigInterface::getMaxWidth() */ - const MAX_IMAGE_WIDTH = 4096; + const MAX_IMAGE_WIDTH = 1920; /** * Maximum Image Height resolution in pixels. For image resizing on client side * @deprecated * @see \Magento\Framework\Image\Adapter\UploadConfigInterface::getMaxHeight() */ - const MAX_IMAGE_HEIGHT = 2160; + const MAX_IMAGE_HEIGHT = 1200; /** * Resulting of uploaded file diff --git a/lib/internal/Magento/Framework/Image/Adapter/Config.php b/lib/internal/Magento/Framework/Image/Adapter/Config.php index a159bc9ffd448..84b6b6dcfbdd1 100644 --- a/lib/internal/Magento/Framework/Image/Adapter/Config.php +++ b/lib/internal/Magento/Framework/Image/Adapter/Config.php @@ -16,8 +16,16 @@ class Config implements ConfigInterface, UploadConfigInterface const XML_PATH_IMAGE_ADAPTERS = 'dev/image/adapters'; + /** + * Config path for the maximal image width value + * @deprecated + */ const XML_PATH_MAX_WIDTH_IMAGE = 'system/upload_configuration/max_width'; + /** + * Config path for the maximal image height value + * @deprecated + */ const XML_PATH_MAX_HEIGHT_IMAGE = 'system/upload_configuration/max_height'; /** @@ -57,6 +65,8 @@ public function getAdapters() * Get Maximum Image Width resolution in pixels. For image resizing on client side. * * @return int + * @deprecated + * @see \Magento\Backend\Model\Image\ImageUploadConfigInterface::getMaxHeight() */ public function getMaxWidth(): int { @@ -67,6 +77,8 @@ public function getMaxWidth(): int * Get Maximum Image Height resolution in pixels. For image resizing on client side. * * @return int + * @deprecated + * @see \Magento\Backend\Model\Image\ImageUploadConfigInterface::getMaxHeight() */ public function getMaxHeight(): int { diff --git a/lib/internal/Magento/Framework/Image/Adapter/UploadConfigInterface.php b/lib/internal/Magento/Framework/Image/Adapter/UploadConfigInterface.php index c42879060b0b2..990062b83ef6f 100644 --- a/lib/internal/Magento/Framework/Image/Adapter/UploadConfigInterface.php +++ b/lib/internal/Magento/Framework/Image/Adapter/UploadConfigInterface.php @@ -9,6 +9,8 @@ /** * Interface UploadConfigInterface + * @deprecated because new interface was introduced + * @see \Magento\Backend\Model\Image\ImageUploadConfigInterface; */ interface UploadConfigInterface { From e5a30aab22728751c8a79a1d0062f4e2206766e4 Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov Date: Wed, 3 Oct 2018 14:32:22 +0300 Subject: [PATCH 05/28] MAGETWO-95299: Ability to upload PDP images without compression and downsizing --- app/code/Magento/Backend/Block/Media/Uploader.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Backend/Block/Media/Uploader.php b/app/code/Magento/Backend/Block/Media/Uploader.php index 6962141c465b8..1995d72661e2e 100644 --- a/app/code/Magento/Backend/Block/Media/Uploader.php +++ b/app/code/Magento/Backend/Block/Media/Uploader.php @@ -62,7 +62,8 @@ public function __construct( ) { $this->_fileSizeService = $fileSize; $this->jsonEncoder = $jsonEncoder ?: ObjectManager::getInstance()->get(Json::class); - $this->imageUploadConfig = $imageUploadConfig ?: ObjectManager::getInstance()->get(UploadConfigInterface::class); + $this->imageUploadConfig = $imageUploadConfig + ?: ObjectManager::getInstance()->get(ImageUploadConfigInterface::class); parent::__construct($context, $data); } From 929ed778dd4f6157d2ddfbc49289661559d384eb Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov Date: Thu, 4 Oct 2018 18:07:35 +0300 Subject: [PATCH 06/28] MAGETWO-95299: Ability to upload PDP images without compression and downsizing --- .../Magento/Backend/Block/Media/Uploader.php | 6 +++--- .../adminhtml/templates/media/uploader.phtml | 2 +- .../view/adminhtml/web/js/media-uploader.js | 18 ++++++++++-------- .../templates/browser/content/uploader.phtml | 15 ++++++++++----- 4 files changed, 24 insertions(+), 17 deletions(-) diff --git a/app/code/Magento/Backend/Block/Media/Uploader.php b/app/code/Magento/Backend/Block/Media/Uploader.php index 1995d72661e2e..22e9197418e4c 100644 --- a/app/code/Magento/Backend/Block/Media/Uploader.php +++ b/app/code/Magento/Backend/Block/Media/Uploader.php @@ -130,11 +130,11 @@ public function getImageUploadMaxHeight() /** * Get image resize configuration * - * @return bool + * @return int */ - public function getIsResizeEnabled(): bool + public function getIsResizeEnabled(): int { - return $this->imageUploadConfig->isResizeEnabled(); + return (int)$this->imageUploadConfig->isResizeEnabled(); } /** diff --git a/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml b/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml index edd54ae38b6a1..d6e97cf4d58e3 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml @@ -13,7 +13,7 @@ data-mage-init='{ "Magento_Backend/js/media-uploader" : { "maxFileSize": getFileSizeService()->getMaxFileSize() ?>, - "maxWidth":getImageUploadMaxWidth() ?> , + "maxWidth": getImageUploadMaxWidth() ?>, "maxHeight": getImageUploadMaxHeight() ?>, "isResizeEnabled": getIsResizeEnabled() ?> } diff --git a/app/code/Magento/Backend/view/adminhtml/web/js/media-uploader.js b/app/code/Magento/Backend/view/adminhtml/web/js/media-uploader.js index 35e9ec244df24..2a15f5262bda1 100644 --- a/app/code/Magento/Backend/view/adminhtml/web/js/media-uploader.js +++ b/app/code/Magento/Backend/view/adminhtml/web/js/media-uploader.js @@ -36,10 +36,17 @@ define([ var self = this, progressTmpl = mageTemplate('[data-template="uploader"]'), - resizeConfig = { - action: 'resize' + isResizeEnabled = this.options.isResizeEnabled, + resizeConfiguration = { + action: 'resize', + maxWidth: this.options.maxWidth, + maxHeight: this.options.maxHeight }; + if (isResizeEnabled === 0) { + resizeConfiguration = {action: 'resize'}; + } + this.element.find('input[type=file]').fileupload({ dataType: 'json', formData: { @@ -123,18 +130,13 @@ define([ stop: fileUploader.uploaderConfig.stop }); - if (typeof this.options.isResizeEnabled !== 'undefined' && this.options.isResizeEnabled === true) { - resizeConfig.maxWidth = this.options.maxWidth; - resizeConfig.maxHeight = this.options.maxHeight; - } - this.element.find('input[type=file]').fileupload('option', { process: [{ action: 'load', fileTypes: /^image\/(gif|jpeg|png)$/, maxFileSize: this.options.maxFileSize }, - resizeConfig, + resizeConfiguration, { action: 'save' }] diff --git a/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml b/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml index 5f4e40667eda5..b1824f639c940 100644 --- a/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml +++ b/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml @@ -17,6 +17,13 @@ foreach ($filters as $media_type) { }, $media_type['files'])); } +$resizeConfig = ($block->getIsResizeEnabled()) + ? "{action: 'resize', maxWidth: " + . $block->getImageUploadMaxWidth() + . ", maxHeight: " + . $block->getImageUploadMaxHeight() + . "}" + : "{action: 'resize'}"; ?>
@@ -145,11 +152,9 @@ require([ action: 'load', fileTypes: /^image\/(gif|jpeg|png)$/, maxFileSize: getFileSizeService()->getMaxFileSize() ?> * 10 - }, { - action: 'resize', - maxWidth: getImageUploadMaxWidth() ?> , - maxHeight: getImageUploadMaxHeight() ?> - }, { + }, + , + { action: 'save' }] }); From 3a65d73ff8b2cc5d801de99f182389a52edec318 Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov Date: Fri, 5 Oct 2018 11:52:38 +0300 Subject: [PATCH 07/28] MAGETWO-95299: Ability to upload PDP images without compression and downsizing --- .../Magento/Catalog/etc/adminhtml/system.xml | 17 +++++++++++++++++ app/code/Magento/Catalog/etc/config.xml | 3 +++ 2 files changed, 20 insertions(+) diff --git a/app/code/Magento/Catalog/etc/adminhtml/system.xml b/app/code/Magento/Catalog/etc/adminhtml/system.xml index 71a799fd22427..26da542cde65b 100644 --- a/app/code/Magento/Catalog/etc/adminhtml/system.xml +++ b/app/code/Magento/Catalog/etc/adminhtml/system.xml @@ -10,6 +10,9 @@ + + +
separator-top @@ -193,5 +196,19 @@
+
+ separator-top + + advanced + Magento_Config::config_system + + + + + validate-greater-than-zero validate-number required-entry digits-range-1-100 + Jpeg quality for images 1-100%. + + +
diff --git a/app/code/Magento/Catalog/etc/config.xml b/app/code/Magento/Catalog/etc/config.xml index f52760aa50743..9c9054dd0ce22 100644 --- a/app/code/Magento/Catalog/etc/config.xml +++ b/app/code/Magento/Catalog/etc/config.xml @@ -66,6 +66,9 @@ custom_options + + 80 + From e194b139c8889587a90aca5cee470e0a40f26422 Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov Date: Fri, 5 Oct 2018 14:04:50 +0300 Subject: [PATCH 08/28] MAGETWO-95299: Ability to upload PDP images without compression and downsizing --- app/code/Magento/Catalog/Helper/Image.php | 1 + .../Magento/Catalog/Model/Product/Image.php | 17 +++++++++++++---- .../Model/Product/Image/ParamsBuilder.php | 9 +++------ 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/Catalog/Helper/Image.php b/app/code/Magento/Catalog/Helper/Image.php index 758e59790d241..74153267f41d6 100644 --- a/app/code/Magento/Catalog/Helper/Image.php +++ b/app/code/Magento/Catalog/Helper/Image.php @@ -298,6 +298,7 @@ public function resize($width, $height = null) * * @param int $quality * @return $this + * @deprecated */ public function setQuality($quality) { diff --git a/app/code/Magento/Catalog/Model/Product/Image.php b/app/code/Magento/Catalog/Model/Product/Image.php index f1ae9ac62dc9b..564b817fc167e 100644 --- a/app/code/Magento/Catalog/Model/Product/Image.php +++ b/app/code/Magento/Catalog/Model/Product/Image.php @@ -24,6 +24,11 @@ */ class Image extends \Magento\Framework\Model\AbstractModel { + /** + * Config path for the jpeg image quality value + */ + const XML_PATH_JPEG_QUALITY = 'system/upload_configuration/jpeg_quality'; + /** * @var int */ @@ -38,8 +43,9 @@ class Image extends \Magento\Framework\Model\AbstractModel * Default quality value (for JPEG images only). * * @var int + * @deprecated */ - protected $_quality = 80; + protected $_quality = null; /** * @var bool @@ -289,6 +295,7 @@ public function getHeight() * * @param int $quality * @return $this + * @deprecated */ public function setQuality($quality) { @@ -303,7 +310,9 @@ public function setQuality($quality) */ public function getQuality() { - return $this->_quality; + return $this->_quality === null + ? $this->_scopeConfig->getValue(self::XML_PATH_JPEG_QUALITY) + : $this->_quality; } /** @@ -461,7 +470,7 @@ public function getImageProcessor() $this->_processor->keepTransparency($this->_keepTransparency); $this->_processor->constrainOnly($this->_constrainOnly); $this->_processor->backgroundColor($this->_backgroundColor); - $this->_processor->quality($this->_quality); + $this->_processor->quality($this->getQuality()); return $this->_processor; } @@ -843,7 +852,7 @@ private function getMiscParams() 'transparency' => $this->_keepTransparency, 'background' => $this->_backgroundColor, 'angle' => $this->_angle, - 'quality' => $this->_quality + 'quality' => $this->getQuality() ] ); } diff --git a/app/code/Magento/Catalog/Model/Product/Image/ParamsBuilder.php b/app/code/Magento/Catalog/Model/Product/Image/ParamsBuilder.php index dd8d352fecebc..21fde84931fa6 100644 --- a/app/code/Magento/Catalog/Model/Product/Image/ParamsBuilder.php +++ b/app/code/Magento/Catalog/Model/Product/Image/ParamsBuilder.php @@ -10,17 +10,13 @@ use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\View\ConfigInterface; use Magento\Store\Model\ScopeInterface; +use Magento\Catalog\Model\Product\Image; /** * Builds parameters array used to build Image Asset */ class ParamsBuilder { - /** - * @var int - */ - private $defaultQuality = 80; - /** * @var array */ @@ -100,11 +96,12 @@ private function overwriteDefaultValues(array $imageArguments): array $transparency = $imageArguments['transparency'] ?? $this->defaultKeepTransparency; $background = $imageArguments['background'] ?? $this->defaultBackground; $angle = $imageArguments['angle'] ?? $this->defaultAngle; + $quality = (int) $this->scopeConfig->getValue(Image::XML_PATH_JPEG_QUALITY); return [ 'background' => (array) $background, 'angle' => $angle, - 'quality' => $this->defaultQuality, + 'quality' => $quality, 'keep_aspect_ratio' => (bool) $aspectRatio, 'keep_frame' => (bool) $frame, 'keep_transparency' => (bool) $transparency, From 5f1b4014093e062169dd9597752eac1c970898e2 Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov Date: Mon, 8 Oct 2018 14:10:04 +0300 Subject: [PATCH 09/28] MAGETWO-95299: Ability to upload PDP images without compression and downsizing --- .../Block/DataProviders/ImageUploadConfig.php | 37 +++++++++++++++++++ .../Magento/Backend/Block/Media/Uploader.php | 10 ----- .../adminhtml/templates/media/uploader.phtml | 2 +- .../Product/Helper/Form/Gallery/Content.php | 20 ++++++++-- .../layout/cms_wysiwyg_images_index.xml | 6 ++- .../templates/browser/content/uploader.phtml | 6 +-- 6 files changed, 63 insertions(+), 18 deletions(-) create mode 100644 app/code/Magento/Backend/Block/DataProviders/ImageUploadConfig.php diff --git a/app/code/Magento/Backend/Block/DataProviders/ImageUploadConfig.php b/app/code/Magento/Backend/Block/DataProviders/ImageUploadConfig.php new file mode 100644 index 0000000000000..1ba3daf35d2cf --- /dev/null +++ b/app/code/Magento/Backend/Block/DataProviders/ImageUploadConfig.php @@ -0,0 +1,37 @@ +imageUploadConfig = $imageUploadConfig; + } + + /** + * Get image resize configuration + * + * @return int + */ + public function getIsResizeEnabled(): int + { + return (int)$this->imageUploadConfig->isResizeEnabled(); + } +} diff --git a/app/code/Magento/Backend/Block/Media/Uploader.php b/app/code/Magento/Backend/Block/Media/Uploader.php index 22e9197418e4c..c332c91b54b27 100644 --- a/app/code/Magento/Backend/Block/Media/Uploader.php +++ b/app/code/Magento/Backend/Block/Media/Uploader.php @@ -127,16 +127,6 @@ public function getImageUploadMaxHeight() return $this->imageUploadConfig->getMaxHeight(); } - /** - * Get image resize configuration - * - * @return int - */ - public function getIsResizeEnabled(): int - { - return (int)$this->imageUploadConfig->isResizeEnabled(); - } - /** * Prepares layout and set element renderer * diff --git a/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml b/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml index d6e97cf4d58e3..4d9ba6a8c4bad 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml @@ -15,7 +15,7 @@ "maxFileSize": getFileSizeService()->getMaxFileSize() ?>, "maxWidth": getImageUploadMaxWidth() ?>, "maxHeight": getImageUploadMaxHeight() ?>, - "isResizeEnabled": getIsResizeEnabled() ?> + "isResizeEnabled": getImageUploadConfigData()->getIsResizeEnabled() ?> } }' > diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php index e1208e25cc7c8..d9e343fd2b3f0 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php @@ -13,11 +13,12 @@ */ namespace Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Gallery; +use Magento\Framework\App\ObjectManager; use Magento\Backend\Block\Media\Uploader; use Magento\Framework\View\Element\AbstractBlock; use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\Exception\FileSystemException; - +use Magento\Backend\Block\DataProviders\ImageUploadConfig as ImageUploadConfigDataProvider; /** * Block for gallery content. */ @@ -43,21 +44,30 @@ class Content extends \Magento\Backend\Block\Widget */ private $imageHelper; + /** + * @var ImageUploadConfigDataProvider + */ + private $imageUploadConfigDataProvider; + /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder * @param \Magento\Catalog\Model\Product\Media\Config $mediaConfig * @param array $data + * @param ImageUploadConfigDataProvider $imageUploadConfigDataProvider */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Framework\Json\EncoderInterface $jsonEncoder, \Magento\Catalog\Model\Product\Media\Config $mediaConfig, - array $data = [] + array $data = [], + ImageUploadConfigDataProvider $imageUploadConfigDataProvider = null ) { $this->_jsonEncoder = $jsonEncoder; $this->_mediaConfig = $mediaConfig; parent::__construct($context, $data); + $this->imageUploadConfigDataProvider = $imageUploadConfigDataProvider + ?: ObjectManager::getInstance()->get(ImageUploadConfigDataProvider::class); } /** @@ -67,7 +77,11 @@ public function __construct( */ protected function _prepareLayout() { - $this->addChild('uploader', \Magento\Backend\Block\Media\Uploader::class); + $this->addChild( + 'uploader', + \Magento\Backend\Block\Media\Uploader::class, + ['image_upload_config_data' => $this->imageUploadConfigDataProvider] + ); $this->getUploader()->getConfig()->setUrl( $this->_urlBuilder->addSessionParam()->getUrl('catalog/product_gallery/upload') diff --git a/app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_index.xml b/app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_index.xml index 1bc8828ef6c8e..6703b6c277123 100644 --- a/app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_index.xml +++ b/app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_index.xml @@ -9,7 +9,11 @@ - + + + Magento\Backend\Block\DataProviders\ImageUploadConfig + + diff --git a/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml b/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml index b1824f639c940..c6810f774238c 100644 --- a/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml +++ b/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml @@ -17,11 +17,11 @@ foreach ($filters as $media_type) { }, $media_type['files'])); } -$resizeConfig = ($block->getIsResizeEnabled()) +$resizeConfig = ($block->getImageUploadConfigData()->getIsResizeEnabled()) ? "{action: 'resize', maxWidth: " - . $block->getImageUploadMaxWidth() + . $block->escapeHtml($block->getImageUploadMaxWidth()) . ", maxHeight: " - . $block->getImageUploadMaxHeight() + . $block->escapeHtml($block->getImageUploadMaxHeight()) . "}" : "{action: 'resize'}"; ?> From e819fc98e142b3f93a45cad3ae6ee061209265a5 Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov Date: Tue, 9 Oct 2018 13:00:35 +0300 Subject: [PATCH 10/28] MAGETWO-95299: Ability to upload PDP images without compression and downsizing --- .../Test/AdminSimpleProductImagesTest.xml | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductImagesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductImagesTest.xml index 69931395a35d5..b10c8e5ad54a0 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductImagesTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductImagesTest.xml @@ -87,10 +87,9 @@ - - + @@ -115,8 +114,7 @@ - - + @@ -136,9 +134,9 @@ - - - + + + @@ -154,16 +152,16 @@ - + - + - + From 2850e6ee21634c9251125cfca82fb83b600e29eb Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov Date: Tue, 9 Oct 2018 16:40:16 +0300 Subject: [PATCH 11/28] MAGETWO-95299: Ability to upload PDP images without compression and downsizing --- .../Block/DataProviders/ImageUploadConfig.php | 3 + .../Magento/Backend/Block/Media/Uploader.php | 11 +++- .../Product/Helper/Form/Gallery/Content.php | 1 + app/code/Magento/Catalog/Helper/Image.php | 6 ++ .../Magento/Catalog/Model/Product/Image.php | 58 +++++++++++++++++-- .../Model/Product/Image/ParamsBuilder.php | 7 +++ 6 files changed, 81 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Backend/Block/DataProviders/ImageUploadConfig.php b/app/code/Magento/Backend/Block/DataProviders/ImageUploadConfig.php index 1ba3daf35d2cf..6ec40cfa0b2d4 100644 --- a/app/code/Magento/Backend/Block/DataProviders/ImageUploadConfig.php +++ b/app/code/Magento/Backend/Block/DataProviders/ImageUploadConfig.php @@ -20,6 +20,9 @@ class ImageUploadConfig implements ArgumentInterface */ private $imageUploadConfig; + /** + * @param ImageUploadConfigInterface $imageUploadConfig + */ public function __construct(ImageUploadConfigInterface $imageUploadConfig) { $this->imageUploadConfig = $imageUploadConfig; diff --git a/app/code/Magento/Backend/Block/Media/Uploader.php b/app/code/Magento/Backend/Block/Media/Uploader.php index c332c91b54b27..941d6f37737fe 100644 --- a/app/code/Magento/Backend/Block/Media/Uploader.php +++ b/app/code/Magento/Backend/Block/Media/Uploader.php @@ -44,6 +44,13 @@ class Uploader extends \Magento\Backend\Block\Widget */ private $imageUploadConfig; + /** + * @var UploadConfigInterface + * @deprecated + * @see \Magento\Backend\Model\Image\ImageUploadConfigInterface + */ + private $imageConfig; + /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Framework\File\Size $fileSize @@ -58,10 +65,12 @@ public function __construct( array $data = [], Json $jsonEncoder = null, UploadConfigInterface $imageConfig = null, - ImageUploadConfigInterface $imageUploadConfig = null + ImageUploadConfigInterface $imageUploadConfig = null ) { $this->_fileSizeService = $fileSize; $this->jsonEncoder = $jsonEncoder ?: ObjectManager::getInstance()->get(Json::class); + $this->imageConfig = $imageConfig + ?: ObjectManager::getInstance()->get(UploadConfigInterface::class); $this->imageUploadConfig = $imageUploadConfig ?: ObjectManager::getInstance()->get(ImageUploadConfigInterface::class); parent::__construct($context, $data); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php index d9e343fd2b3f0..063503682f4db 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php @@ -19,6 +19,7 @@ use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\Exception\FileSystemException; use Magento\Backend\Block\DataProviders\ImageUploadConfig as ImageUploadConfigDataProvider; + /** * Block for gallery content. */ diff --git a/app/code/Magento/Catalog/Helper/Image.php b/app/code/Magento/Catalog/Helper/Image.php index 74153267f41d6..4a12bf7093943 100644 --- a/app/code/Magento/Catalog/Helper/Image.php +++ b/app/code/Magento/Catalog/Helper/Image.php @@ -407,6 +407,7 @@ public function rotate($angle) /** * Add watermark to image + * * size param in format 100x200 * * @param string $fileName @@ -534,6 +535,8 @@ public function getUrl() } /** + * Save changes + * * @return $this */ public function save() @@ -554,6 +557,8 @@ public function getResizedImageInfo() } /** + * Getter for placeholder url + * * @param null|string $placeholder * @return string */ @@ -656,6 +661,7 @@ protected function getWatermarkPosition() /** * Set watermark size + * * param size in format 100x200 * * @param string $size diff --git a/app/code/Magento/Catalog/Model/Product/Image.php b/app/code/Magento/Catalog/Model/Product/Image.php index 564b817fc167e..8ad4e89d7b480 100644 --- a/app/code/Magento/Catalog/Model/Product/Image.php +++ b/app/code/Magento/Catalog/Model/Product/Image.php @@ -15,6 +15,8 @@ use Magento\Catalog\Model\Product\Image\ParamsBuilder; /** + * Image operations + * * @method string getFile() * @method string getLabel() * @method string getPosition() @@ -209,16 +211,16 @@ class Image extends \Magento\Framework\Model\AbstractModel * @param \Magento\Framework\Image\Factory $imageFactory * @param \Magento\Framework\View\Asset\Repository $assetRepo * @param \Magento\Framework\View\FileSystem $viewFileSystem + * @param ImageFactory $viewAssetImageFactory + * @param PlaceholderFactory $viewAssetPlaceholderFactory * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection * @param array $data - * @param ImageFactory|null $viewAssetImageFactory - * @param PlaceholderFactory|null $viewAssetPlaceholderFactory - * @param SerializerInterface|null $serializer + * @param SerializerInterface $serializer * @param ParamsBuilder $paramsBuilder * @SuppressWarnings(PHPMD.ExcessiveParameterList) - * @SuppressWarnings(PHPMD.UnusedLocalVariable) + * @SuppressWarnings(PHPMD.UnusedLocalVariable)1 */ public function __construct( \Magento\Framework\Model\Context $context, @@ -255,6 +257,8 @@ public function __construct( } /** + * Set image width property + * * @param int $width * @return $this */ @@ -265,6 +269,8 @@ public function setWidth($width) } /** + * Get image width property + * * @return int */ public function getWidth() @@ -273,6 +279,8 @@ public function getWidth() } /** + * Set image height property + * * @param int $height * @return $this */ @@ -283,6 +291,8 @@ public function setHeight($height) } /** + * Get image height property + * * @return int */ public function getHeight() @@ -316,6 +326,8 @@ public function getQuality() } /** + * Set _keepAspectRatio property + * * @param bool $keep * @return $this */ @@ -326,6 +338,8 @@ public function setKeepAspectRatio($keep) } /** + * Set _keepFrame property + * * @param bool $keep * @return $this */ @@ -336,6 +350,8 @@ public function setKeepFrame($keep) } /** + * Set _keepTransparency + * * @param bool $keep * @return $this */ @@ -346,6 +362,8 @@ public function setKeepTransparency($keep) } /** + * Set _constrainOnly + * * @param bool $flag * @return $this */ @@ -356,6 +374,8 @@ public function setConstrainOnly($flag) } /** + * Set background color + * * @param int[] $rgbArray * @return $this */ @@ -366,6 +386,8 @@ public function setBackgroundColor(array $rgbArray) } /** + * Set size + * * @param string $size * @return $this */ @@ -420,6 +442,8 @@ public function setBaseFile($file) } /** + * Get base filename + * * @return string */ public function getBaseFile() @@ -428,6 +452,8 @@ public function getBaseFile() } /** + * Get new file + * * @deprecated 101.1.0 * @return bool|string */ @@ -447,6 +473,8 @@ public function isBaseFilePlaceholder() } /** + * Set image processor + * * @param MagentoImage $processor * @return $this */ @@ -457,6 +485,8 @@ public function setImageProcessor($processor) } /** + * Get image processor + * * @return MagentoImage */ public function getImageProcessor() @@ -475,6 +505,8 @@ public function getImageProcessor() } /** + * Resize image + * * @see \Magento\Framework\Image\Adapter\AbstractAdapter * @return $this */ @@ -488,6 +520,8 @@ public function resize() } /** + * Rotate image + * * @param int $angle * @return $this */ @@ -514,6 +548,7 @@ public function setAngle($angle) /** * Add watermark to image + * * size param in format 100x200 * * @param string $file @@ -573,6 +608,8 @@ public function setWatermark( } /** + * Save file + * * @return $this */ public function saveFile() @@ -587,6 +624,8 @@ public function saveFile() } /** + * Get url + * * @return string */ public function getUrl() @@ -595,6 +634,8 @@ public function getUrl() } /** + * Set destination subdir + * * @param string $dir * @return $this */ @@ -605,6 +646,8 @@ public function setDestinationSubdir($dir) } /** + * Get destination subdir + * * @return string */ public function getDestinationSubdir() @@ -613,6 +656,8 @@ public function getDestinationSubdir() } /** + * Check is image cached + * * @return bool */ public function isCached() @@ -780,7 +825,10 @@ public function getWatermarkHeight() } /** + * Clear cache + * * @return void + * @throws \Magento\Framework\Exception\FileSystemException */ public function clearCache() { @@ -793,6 +841,7 @@ public function clearCache() /** * First check this file on FS + * * If it doesn't exist - try to download it from DB * * @param string $filename @@ -811,6 +860,7 @@ protected function _fileExists($filename) /** * Return resized product image information + * * @return array * @throws NotLoadInfoImageException */ diff --git a/app/code/Magento/Catalog/Model/Product/Image/ParamsBuilder.php b/app/code/Magento/Catalog/Model/Product/Image/ParamsBuilder.php index 21fde84931fa6..f6be7f7392b5e 100644 --- a/app/code/Magento/Catalog/Model/Product/Image/ParamsBuilder.php +++ b/app/code/Magento/Catalog/Model/Product/Image/ParamsBuilder.php @@ -65,6 +65,8 @@ public function __construct( } /** + * Build image params + * * @param array $imageArguments * @return array * @SuppressWarnings(PHPMD.NPathComplexity) @@ -85,6 +87,8 @@ public function build(array $imageArguments): array } /** + * Overwrite default values + * * @param array $imageArguments * @return array */ @@ -110,6 +114,8 @@ private function overwriteDefaultValues(array $imageArguments): array } /** + * Get watermark + * * @param string $type * @return array */ @@ -150,6 +156,7 @@ private function getWatermark(string $type): array /** * Get frame from product_image_white_borders + * * @return bool */ private function hasDefaultFrame(): bool From 38abe3d4558df5ffaa91e3ba5ed7fa73c5172a42 Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov Date: Tue, 9 Oct 2018 16:50:25 +0300 Subject: [PATCH 12/28] MAGETWO-95299: Ability to upload PDP images without compression and downsizing --- app/code/Magento/Catalog/Helper/Image.php | 4 ++-- app/code/Magento/Catalog/Model/Product/Image.php | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Catalog/Helper/Image.php b/app/code/Magento/Catalog/Helper/Image.php index 4a12bf7093943..170f1209ad9e6 100644 --- a/app/code/Magento/Catalog/Helper/Image.php +++ b/app/code/Magento/Catalog/Helper/Image.php @@ -408,7 +408,7 @@ public function rotate($angle) /** * Add watermark to image * - * size param in format 100x200 + * Size param in format 100x200 * * @param string $fileName * @param string $position @@ -662,7 +662,7 @@ protected function getWatermarkPosition() /** * Set watermark size * - * param size in format 100x200 + * Param size in format 100x200 * * @param string $size * @return $this diff --git a/app/code/Magento/Catalog/Model/Product/Image.php b/app/code/Magento/Catalog/Model/Product/Image.php index 8ad4e89d7b480..adde1263e1bf9 100644 --- a/app/code/Magento/Catalog/Model/Product/Image.php +++ b/app/code/Magento/Catalog/Model/Product/Image.php @@ -549,7 +549,7 @@ public function setAngle($angle) /** * Add watermark to image * - * size param in format 100x200 + * Size param in format 100x200 * * @param string $file * @param string $position @@ -690,7 +690,8 @@ public function getWatermarkFile() /** * Get relative watermark file path - * or false if file not found + * + * Return false if file not found * * @return string | bool */ From 6e03f0ff8d21259526d6948de51ed29266241d61 Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov Date: Tue, 9 Oct 2018 17:00:58 +0300 Subject: [PATCH 13/28] MAGETWO-95299: Ability to upload PDP images without compression and downsizing --- .../view/adminhtml/templates/browser/content/uploader.phtml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml b/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml index c6810f774238c..54f42bb4ecc1f 100644 --- a/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml +++ b/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml @@ -19,9 +19,9 @@ foreach ($filters as $media_type) { $resizeConfig = ($block->getImageUploadConfigData()->getIsResizeEnabled()) ? "{action: 'resize', maxWidth: " - . $block->escapeHtml($block->getImageUploadMaxWidth()) + . $block->getImageUploadMaxWidth() . ", maxHeight: " - . $block->escapeHtml($block->getImageUploadMaxHeight()) + . $block->getImageUploadMaxHeight() . "}" : "{action: 'resize'}"; ?> @@ -153,7 +153,7 @@ require([ fileTypes: /^image\/(gif|jpeg|png)$/, maxFileSize: getFileSizeService()->getMaxFileSize() ?> * 10 }, - , + escapeHtml($resizeConfig) ?>, { action: 'save' }] From 65670eacceaa1d812ff251c2304540859e9b4142 Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov Date: Tue, 9 Oct 2018 18:18:57 +0300 Subject: [PATCH 14/28] MAGETWO-95299: Ability to upload PDP images without compression and downsizing --- .../Magento/Backend/view/adminhtml/web/js/media-uploader.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Backend/view/adminhtml/web/js/media-uploader.js b/app/code/Magento/Backend/view/adminhtml/web/js/media-uploader.js index 2a15f5262bda1..6789dfa3f2b8e 100644 --- a/app/code/Magento/Backend/view/adminhtml/web/js/media-uploader.js +++ b/app/code/Magento/Backend/view/adminhtml/web/js/media-uploader.js @@ -44,7 +44,9 @@ define([ }; if (isResizeEnabled === 0) { - resizeConfiguration = {action: 'resize'}; + resizeConfiguration = { + action: 'resize' + }; } this.element.find('input[type=file]').fileupload({ From 38dadb1f19dfa304083c019ba619ccda4bb44426 Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov Date: Wed, 10 Oct 2018 16:11:33 +0300 Subject: [PATCH 15/28] MAGETWO-95299: Ability to upload PDP images without compression and downsizing --- .../Magento/Backend/view/adminhtml/web/js/media-uploader.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/Backend/view/adminhtml/web/js/media-uploader.js b/app/code/Magento/Backend/view/adminhtml/web/js/media-uploader.js index 6789dfa3f2b8e..e1d5a0a9debe5 100644 --- a/app/code/Magento/Backend/view/adminhtml/web/js/media-uploader.js +++ b/app/code/Magento/Backend/view/adminhtml/web/js/media-uploader.js @@ -135,8 +135,7 @@ define([ this.element.find('input[type=file]').fileupload('option', { process: [{ action: 'load', - fileTypes: /^image\/(gif|jpeg|png)$/, - maxFileSize: this.options.maxFileSize + fileTypes: /^image\/(gif|jpeg|png)$/ }, resizeConfiguration, { From 66198844e9a8653b3f53b63588d7b071daf65589 Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov Date: Thu, 11 Oct 2018 17:20:25 +0300 Subject: [PATCH 16/28] MAGETWO-95299: Ability to upload PDP images without compression and downsizing --- .../Block/DataProviders/ImageUploadConfig.php | 8 ++++---- app/code/Magento/Backend/Block/Media/Uploader.php | 12 ++++++------ ...{ImageUploadConfig.php => UploadResizeConfig.php} | 2 +- ...Interface.php => UploadResizeConfigInterface.php} | 4 ++-- app/code/Magento/Backend/etc/adminhtml/di.xml | 2 +- app/code/Magento/Backend/etc/adminhtml/system.xml | 4 ++-- .../Backend/view/adminhtml/web/js/media-uploader.js | 8 +++----- app/code/Magento/Catalog/etc/adminhtml/system.xml | 2 +- .../Magento/Framework/Image/Adapter/Config.php | 4 ++-- .../Image/Adapter/UploadConfigInterface.php | 4 ++-- 10 files changed, 24 insertions(+), 26 deletions(-) rename app/code/Magento/Backend/Model/Image/{ImageUploadConfig.php => UploadResizeConfig.php} (96%) rename app/code/Magento/Backend/Model/Image/{ImageUploadConfigInterface.php => UploadResizeConfigInterface.php} (89%) diff --git a/app/code/Magento/Backend/Block/DataProviders/ImageUploadConfig.php b/app/code/Magento/Backend/Block/DataProviders/ImageUploadConfig.php index 6ec40cfa0b2d4..9c17b0e5538f4 100644 --- a/app/code/Magento/Backend/Block/DataProviders/ImageUploadConfig.php +++ b/app/code/Magento/Backend/Block/DataProviders/ImageUploadConfig.php @@ -8,7 +8,7 @@ namespace Magento\Backend\Block\DataProviders; use Magento\Framework\View\Element\Block\ArgumentInterface; -use Magento\Backend\Model\Image\ImageUploadConfigInterface; +use Magento\Backend\Model\Image\UploadResizeConfigInterface; /** * Provides additional data for image uploader @@ -16,14 +16,14 @@ class ImageUploadConfig implements ArgumentInterface { /** - * @var ImageUploadConfigInterface + * @var UploadResizeConfigInterface */ private $imageUploadConfig; /** - * @param ImageUploadConfigInterface $imageUploadConfig + * @param UploadResizeConfigInterface $imageUploadConfig */ - public function __construct(ImageUploadConfigInterface $imageUploadConfig) + public function __construct(UploadResizeConfigInterface $imageUploadConfig) { $this->imageUploadConfig = $imageUploadConfig; } diff --git a/app/code/Magento/Backend/Block/Media/Uploader.php b/app/code/Magento/Backend/Block/Media/Uploader.php index 941d6f37737fe..84fa487281ac8 100644 --- a/app/code/Magento/Backend/Block/Media/Uploader.php +++ b/app/code/Magento/Backend/Block/Media/Uploader.php @@ -10,7 +10,7 @@ use Magento\Framework\App\ObjectManager; use Magento\Framework\Serialize\Serializer\Json; use Magento\Framework\Image\Adapter\UploadConfigInterface; -use Magento\Backend\Model\Image\ImageUploadConfigInterface; +use Magento\Backend\Model\Image\UploadResizeConfigInterface; /** * Adminhtml media library uploader @@ -40,14 +40,14 @@ class Uploader extends \Magento\Backend\Block\Widget private $jsonEncoder; /** - * @var ImageUploadConfigInterface + * @var UploadResizeConfigInterface */ private $imageUploadConfig; /** * @var UploadConfigInterface * @deprecated - * @see \Magento\Backend\Model\Image\ImageUploadConfigInterface + * @see \Magento\Backend\Model\Image\UploadResizeConfigInterface */ private $imageConfig; @@ -57,7 +57,7 @@ class Uploader extends \Magento\Backend\Block\Widget * @param array $data * @param Json $jsonEncoder * @param UploadConfigInterface $imageConfig - * @param ImageUploadConfigInterface $imageUploadConfig + * @param UploadResizeConfigInterface $imageUploadConfig */ public function __construct( \Magento\Backend\Block\Template\Context $context, @@ -65,14 +65,14 @@ public function __construct( array $data = [], Json $jsonEncoder = null, UploadConfigInterface $imageConfig = null, - ImageUploadConfigInterface $imageUploadConfig = null + UploadResizeConfigInterface $imageUploadConfig = null ) { $this->_fileSizeService = $fileSize; $this->jsonEncoder = $jsonEncoder ?: ObjectManager::getInstance()->get(Json::class); $this->imageConfig = $imageConfig ?: ObjectManager::getInstance()->get(UploadConfigInterface::class); $this->imageUploadConfig = $imageUploadConfig - ?: ObjectManager::getInstance()->get(ImageUploadConfigInterface::class); + ?: ObjectManager::getInstance()->get(UploadResizeConfigInterface::class); parent::__construct($context, $data); } diff --git a/app/code/Magento/Backend/Model/Image/ImageUploadConfig.php b/app/code/Magento/Backend/Model/Image/UploadResizeConfig.php similarity index 96% rename from app/code/Magento/Backend/Model/Image/ImageUploadConfig.php rename to app/code/Magento/Backend/Model/Image/UploadResizeConfig.php index b7e13b1e8274c..8155aa5e2fe2d 100644 --- a/app/code/Magento/Backend/Model/Image/ImageUploadConfig.php +++ b/app/code/Magento/Backend/Model/Image/UploadResizeConfig.php @@ -10,7 +10,7 @@ /** * Image uploader config provider. */ -class ImageUploadConfig implements ImageUploadConfigInterface +class UploadResizeConfig implements UploadResizeConfigInterface { /** * Config path for the maximal image width value diff --git a/app/code/Magento/Backend/Model/Image/ImageUploadConfigInterface.php b/app/code/Magento/Backend/Model/Image/UploadResizeConfigInterface.php similarity index 89% rename from app/code/Magento/Backend/Model/Image/ImageUploadConfigInterface.php rename to app/code/Magento/Backend/Model/Image/UploadResizeConfigInterface.php index 254a13407b2c1..50582dfafbcd1 100644 --- a/app/code/Magento/Backend/Model/Image/ImageUploadConfigInterface.php +++ b/app/code/Magento/Backend/Model/Image/UploadResizeConfigInterface.php @@ -8,11 +8,11 @@ namespace Magento\Backend\Model\Image; /** - * Interface ImageUploadConfigInterface + * Interface UploadResizeConfigInterface * * Used to retrieve configuration for frontend image uploader */ -interface ImageUploadConfigInterface +interface UploadResizeConfigInterface { /** * Get maximal width value for resized image diff --git a/app/code/Magento/Backend/etc/adminhtml/di.xml b/app/code/Magento/Backend/etc/adminhtml/di.xml index dcfc99cfed310..4abea272c5495 100644 --- a/app/code/Magento/Backend/etc/adminhtml/di.xml +++ b/app/code/Magento/Backend/etc/adminhtml/di.xml @@ -168,5 +168,5 @@ - + diff --git a/app/code/Magento/Backend/etc/adminhtml/system.xml b/app/code/Magento/Backend/etc/adminhtml/system.xml index 3a0d3e50acc5a..2915d8d671a01 100644 --- a/app/code/Magento/Backend/etc/adminhtml/system.xml +++ b/app/code/Magento/Backend/etc/adminhtml/system.xml @@ -339,9 +339,9 @@ - + Magento\Config\Model\Config\Source\Yesno - Resize performed by javascript during file upload. + Resize performed via javascript before file upload. diff --git a/app/code/Magento/Backend/view/adminhtml/web/js/media-uploader.js b/app/code/Magento/Backend/view/adminhtml/web/js/media-uploader.js index e1d5a0a9debe5..119e7a35747cb 100644 --- a/app/code/Magento/Backend/view/adminhtml/web/js/media-uploader.js +++ b/app/code/Magento/Backend/view/adminhtml/web/js/media-uploader.js @@ -33,8 +33,7 @@ define([ * @private */ _create: function () { - var - self = this, + var self = this, progressTmpl = mageTemplate('[data-template="uploader"]'), isResizeEnabled = this.options.isResizeEnabled, resizeConfiguration = { @@ -43,7 +42,7 @@ define([ maxHeight: this.options.maxHeight }; - if (isResizeEnabled === 0) { + if (!isResizeEnabled) { resizeConfiguration = { action: 'resize' }; @@ -64,8 +63,7 @@ define([ * @param {Object} data */ add: function (e, data) { - var - fileSize, + var fileSize, tmpl; $.each(data.files, function (index, file) { diff --git a/app/code/Magento/Catalog/etc/adminhtml/system.xml b/app/code/Magento/Catalog/etc/adminhtml/system.xml index 2d872fc06b416..74661acb8f136 100644 --- a/app/code/Magento/Catalog/etc/adminhtml/system.xml +++ b/app/code/Magento/Catalog/etc/adminhtml/system.xml @@ -207,7 +207,7 @@ validate-greater-than-zero validate-number required-entry digits-range-1-100 - Jpeg quality for images 1-100%. + Jpeg quality for resized images 1-100%. diff --git a/lib/internal/Magento/Framework/Image/Adapter/Config.php b/lib/internal/Magento/Framework/Image/Adapter/Config.php index 84b6b6dcfbdd1..636bbcdcbdb41 100644 --- a/lib/internal/Magento/Framework/Image/Adapter/Config.php +++ b/lib/internal/Magento/Framework/Image/Adapter/Config.php @@ -66,7 +66,7 @@ public function getAdapters() * * @return int * @deprecated - * @see \Magento\Backend\Model\Image\ImageUploadConfigInterface::getMaxHeight() + * @see \Magento\Backend\Model\Image\UploadResizeConfigInterface::getMaxHeight() */ public function getMaxWidth(): int { @@ -78,7 +78,7 @@ public function getMaxWidth(): int * * @return int * @deprecated - * @see \Magento\Backend\Model\Image\ImageUploadConfigInterface::getMaxHeight() + * @see \Magento\Backend\Model\Image\UploadResizeConfigInterface::getMaxHeight() */ public function getMaxHeight(): int { diff --git a/lib/internal/Magento/Framework/Image/Adapter/UploadConfigInterface.php b/lib/internal/Magento/Framework/Image/Adapter/UploadConfigInterface.php index 990062b83ef6f..0a2dbefff8ee0 100644 --- a/lib/internal/Magento/Framework/Image/Adapter/UploadConfigInterface.php +++ b/lib/internal/Magento/Framework/Image/Adapter/UploadConfigInterface.php @@ -9,8 +9,8 @@ /** * Interface UploadConfigInterface - * @deprecated because new interface was introduced - * @see \Magento\Backend\Model\Image\ImageUploadConfigInterface; + * @deprecated moved to proper namespace and extended + * @see \Magento\Backend\Model\Image\UploadResizeConfigInterface; */ interface UploadConfigInterface { From 2eb844f239c68591a6998d279103246609ef4a3d Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov Date: Thu, 11 Oct 2018 18:19:10 +0300 Subject: [PATCH 17/28] MAGETWO-95299: Ability to upload PDP images without compression and downsizing --- app/code/Magento/Catalog/Model/Product/Image.php | 6 +++--- .../view/adminhtml/templates/browser/content/uploader.phtml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Image.php b/app/code/Magento/Catalog/Model/Product/Image.php index adde1263e1bf9..a0be36c5a327c 100644 --- a/app/code/Magento/Catalog/Model/Product/Image.php +++ b/app/code/Magento/Catalog/Model/Product/Image.php @@ -45,7 +45,7 @@ class Image extends \Magento\Framework\Model\AbstractModel * Default quality value (for JPEG images only). * * @var int - * @deprecated + * @deprecated use config setting with path self::XML_PATH_JPEG_QUALITY */ protected $_quality = null; @@ -220,7 +220,7 @@ class Image extends \Magento\Framework\Model\AbstractModel * @param SerializerInterface $serializer * @param ParamsBuilder $paramsBuilder * @SuppressWarnings(PHPMD.ExcessiveParameterList) - * @SuppressWarnings(PHPMD.UnusedLocalVariable)1 + * @SuppressWarnings(PHPMD.UnusedLocalVariable) */ public function __construct( \Magento\Framework\Model\Context $context, @@ -305,7 +305,7 @@ public function getHeight() * * @param int $quality * @return $this - * @deprecated + * @deprecated use config setting with path self::XML_PATH_JPEG_QUALITY */ public function setQuality($quality) { diff --git a/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml b/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml index 54f42bb4ecc1f..df0a74c48ac23 100644 --- a/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml +++ b/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml @@ -17,7 +17,7 @@ foreach ($filters as $media_type) { }, $media_type['files'])); } -$resizeConfig = ($block->getImageUploadConfigData()->getIsResizeEnabled()) +$resizeConfig = $block->getImageUploadConfigData()->getIsResizeEnabled() ? "{action: 'resize', maxWidth: " . $block->getImageUploadMaxWidth() . ", maxHeight: " From e3fc117bfa5158b51c875e76461539aba5b2b6a7 Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov Date: Tue, 16 Oct 2018 15:33:43 +0300 Subject: [PATCH 18/28] MAGETWO-95299: Ability to upload PDP images without compression and downsizing --- app/code/Magento/Catalog/etc/adminhtml/system.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/etc/adminhtml/system.xml b/app/code/Magento/Catalog/etc/adminhtml/system.xml index 74661acb8f136..1b0fe4c85f617 100644 --- a/app/code/Magento/Catalog/etc/adminhtml/system.xml +++ b/app/code/Magento/Catalog/etc/adminhtml/system.xml @@ -206,7 +206,7 @@ - validate-greater-than-zero validate-number required-entry digits-range-1-100 + validate-greater-than-zero validate-digits validate-range required-entry digits-range-1-100 Jpeg quality for resized images 1-100%. From c83a1caa6b1eb7182f235310938c22cfea7826f4 Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov Date: Fri, 19 Oct 2018 11:58:59 +0300 Subject: [PATCH 19/28] MAGETWO-95299: Ability to upload PDP images without compression and downsizing --- app/code/Magento/Catalog/etc/adminhtml/system.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/etc/adminhtml/system.xml b/app/code/Magento/Catalog/etc/adminhtml/system.xml index 1b0fe4c85f617..7478fa2226454 100644 --- a/app/code/Magento/Catalog/etc/adminhtml/system.xml +++ b/app/code/Magento/Catalog/etc/adminhtml/system.xml @@ -206,7 +206,7 @@ - validate-greater-than-zero validate-digits validate-range required-entry digits-range-1-100 + validate-digits validate-digits-range digits-range-1-100 required-entry Jpeg quality for resized images 1-100%. From dfc9cd0a5ce6d9285b56b40f9cc4c429f8d5f33c Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov Date: Fri, 26 Oct 2018 17:23:09 +0300 Subject: [PATCH 20/28] MAGETWO-95299: Ability to upload PDP images without compression and downsizing --- .../Catalog/Test/Mftf/Test/AdminSimpleProductImagesTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductImagesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductImagesTest.xml index b10c8e5ad54a0..1cd0e15780c11 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductImagesTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductImagesTest.xml @@ -161,7 +161,7 @@ - + From 8641218ebe978623fb1aa731544b76be99003448 Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov Date: Wed, 31 Oct 2018 11:09:20 +0200 Subject: [PATCH 21/28] MAGETWO-95299: Ability to upload PDP images without compression and downsizing --- .../view/adminhtml/templates/browser/content/uploader.phtml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml b/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml index df0a74c48ac23..414d42cb45382 100644 --- a/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml +++ b/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml @@ -19,9 +19,9 @@ foreach ($filters as $media_type) { $resizeConfig = $block->getImageUploadConfigData()->getIsResizeEnabled() ? "{action: 'resize', maxWidth: " - . $block->getImageUploadMaxWidth() + . $block->escapeHtml($block->getImageUploadMaxWidth()) . ", maxHeight: " - . $block->getImageUploadMaxHeight() + . $block->escapeHtml($block->getImageUploadMaxHeight()) . "}" : "{action: 'resize'}"; ?> @@ -153,7 +153,7 @@ require([ fileTypes: /^image\/(gif|jpeg|png)$/, maxFileSize: getFileSizeService()->getMaxFileSize() ?> * 10 }, - escapeHtml($resizeConfig) ?>, + , { action: 'save' }] From 07c2d7a3447e6c8079e02e331777e00ba835e6ed Mon Sep 17 00:00:00 2001 From: Dmytro Drozd Date: Wed, 31 Oct 2018 16:53:51 +0200 Subject: [PATCH 22/28] MAGETWO-96026: Create MFTF test for MAGETWO-93973 --- .../Test/Mftf/Page/AdminProductCreatePage.xml | 1 + ...minProductFormAdvancedInventorySection.xml | 37 +++++++++ .../Mftf/Section/AdminProductFormSection.xml | 1 + ...IncrementsWorkWithDecimalinventoryTest.xml | 75 +++++++++++++++++++ .../Section/StorefrontQuickSearchSection.xml | 2 +- 5 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormAdvancedInventorySection.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/TieredPricingAndQuantityIncrementsWorkWithDecimalinventoryTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Page/AdminProductCreatePage.xml b/app/code/Magento/Catalog/Test/Mftf/Page/AdminProductCreatePage.xml index fc776b49ba213..b3ed3f478f810 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Page/AdminProductCreatePage.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Page/AdminProductCreatePage.xml @@ -17,5 +17,6 @@
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormAdvancedInventorySection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormAdvancedInventorySection.xml new file mode 100644 index 0000000000000..e1272899b78ab --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormAdvancedInventorySection.xml @@ -0,0 +1,37 @@ + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml index 03df9d2a88107..9ec0dbf9f262c 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml @@ -28,6 +28,7 @@ + diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/TieredPricingAndQuantityIncrementsWorkWithDecimalinventoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/TieredPricingAndQuantityIncrementsWorkWithDecimalinventoryTest.xml new file mode 100644 index 0000000000000..7a774c585c9cd --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/TieredPricingAndQuantityIncrementsWorkWithDecimalinventoryTest.xml @@ -0,0 +1,75 @@ + + + + + + + <description value="Tiered pricing and quantity increments work with decimal inventory"/> + <severity value="CRITICAL"/> + <testCaseId value="MAGETWO-91178"/> + <group value="product"/> + </annotations> + <before> + <createData entity="_defaultCategory" stepKey="createPreReqCategory"/> + <createData entity="SimpleProduct" stepKey="createPreReqSimpleProduct"> + <requiredEntity createDataKey="createPreReqCategory"/> + </createData> + </before> + <after> + <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/> + <deleteData createDataKey="createPreReqSimpleProduct" stepKey="deletePreReqSimpleProduct"/> + </after> + <!--Step1. Login as admin. Go to Catalog > Products page. Filtering *prod1*. Open *prod1* to edit--> + <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin" /> + <actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="filterGroupedProductOptions"> + <argument name="product" value="SimpleProduct"/> + </actionGroup> + <click selector="{{AdminProductGridSection.productGridNameProduct('$$createPreReqSimpleProduct.name$$')}}" + stepKey="clickOpenProductForEdit"/> + <waitForPageLoad time="30" stepKey="waitForProductEditOpen"/> + <!--Step2. Open *Advanced Inventory* pop-up (Click on *Advanced Inventory* link). Set *Qty Uses Decimals* to *Yes*. Click on button *Done* --> + <click selector="{{AdminProductFormSection.advancedInventoryLink}}" stepKey="clickOnAdvancedInventoryLink"/> + <scrollTo selector="{{AdminProductFormAdvancedInventorySection.qtyUsesDecimals}}" stepKey="scrollToQtyUsesDecimalsDropBox"/> + <click selector="{{AdminProductFormAdvancedInventorySection.qtyUsesDecimals}}" stepKey="clickOnQtyUsesDecimalsDropBox"/> + <click selector="{{AdminProductFormAdvancedInventorySection.qtyUsesDecimalsOptions('1')}}" stepKey="chooseYesOnQtyUsesDecimalsDropBox"/> + <click selector="{{AdminProductFormAdvancedInventorySection.doneButton}}" stepKey="clickOnDoneButton"/> + <!--Step3. Open *Advanced Pricing* pop-up (Click on *Advanced Pricing* link). Click on *Add* button. Fill *0.5* in *Quantity*--> + <scrollTo selector="{{AdminProductFormSection.productName}}" stepKey="scrollToProductName"/> + <click selector="{{AdminProductFormSection.advancedPricingLink}}" stepKey="clickOnAdvancedPricingLink1"/> + <click selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceAddButton}}" stepKey="clickOnCustomerGroupPriceAddButton"/> + <fillField selector="{{AdminProductFormAdvancedPricingSection.productTierPriceQtyInput('0')}}" userInput="0.5" stepKey="fillProductTierPriceQty"/> + <!--Step4. Close *Advanced Pricing* (Click on button *Done*). Save *prod1* (Click on button *Save*)--> + <click selector="{{AdminProductFormAdvancedPricingSection.doneButton}}" stepKey="clickOnDoneButton2"/> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton"/> + + <!--The code should be uncommented after fix MAGETWO-96016--> + <!--<click selector="{{AdminProductFormSection.advancedPricingLink}}" stepKey="clickOnAdvancedPricingLink2"/>--> + <!--<seeInField userInput="0.5" selector="{{AdminProductFormAdvancedPricingSection.productTierPriceQtyInput('0')}}" stepKey="seeInField1"/>--> + <!--<click selector="{{AdminProductFormAdvancedPricingSection.advancedPricingCloseButton}}" stepKey="clickOnCloseButton"/>--> + + <!--Step5. Open *Advanced Inventory* pop-up. Set *Enable Qty Increments* to *Yes*. Fill *.5* in *Qty Increments*--> + <click selector="{{AdminProductFormSection.advancedInventoryLink}}" stepKey="clickOnAdvancedInventoryLink2"/> + <scrollTo selector="{{AdminProductFormAdvancedInventorySection.enableQtyIncrements}}" stepKey="scrollToEnableQtyIncrements"/> + <click selector="{{AdminProductFormAdvancedInventorySection.enableQtyIncrementsUseConfigSettings}}" stepKey="clickOnEnableQtyIncrementsUseConfigSettingsCheckbox"/> + <click selector="{{AdminProductFormAdvancedInventorySection.enableQtyIncrements}}" stepKey="clickOnEnableQtyIncrements"/> + <click selector="{{AdminProductFormAdvancedInventorySection.enableQtyIncrementsOptions(('1'))}}" stepKey="chooseYesOnEnableQtyIncrements"/> + <click selector="{{AdminProductFormAdvancedInventorySection.qtyIncrementsUseConfigSettings}}" stepKey="clickOnQtyIncrementsUseConfigSettings"/> + <fillField selector="{{AdminProductFormAdvancedInventorySection.qtyIncrements}}" userInput=".5" stepKey="fillQtyIncrements"/> + <!--Step6. Close *Advanced Inventory* (Click on button *Done*). Save *prod1* (Click on button *Save*) --> + <click selector="{{AdminProductFormAdvancedInventorySection.doneButton}}" stepKey="clickOnDoneButton3"/> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton2"/> + <!--Step7. Open *Customer view* (Go to *Store Front*). Open *prod1* page (Find via search and click on product name) --> + <amOnPage url="{{StorefrontHomePage.url}}$$createPreReqSimpleProduct.custom_attributes[url_key]$$.html" stepKey="amOnProductPage"/> + <!--Step8. Fill *1.5* in *Qty*. Click on button *Add to Cart*--> + <fillField selector="{{StorefrontProductPageSection.qtyInput}}" userInput="1.5" stepKey="fillQty"/> + <click selector="{{StorefrontProductPageSection.addToCartBtn}}" stepKey="clickOnAddToCart"/> + <waitForElementVisible selector="{{StorefrontProductPageSection.successMsg}}" time="30" stepKey="waitForProductAdded"/> + <see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You added $$createPreReqSimpleProduct.name$$ to your shopping cart." stepKey="seeAddedToCartMessage"/> + <!--Step9. Click on *Cart* icon. Click on *View and Edit Cart* link. Change *Qty* value to *5.5*--> + <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> + <fillField selector="{{CheckoutCartProductSection.ProductQuantityByName(('$$createPreReqSimpleProduct.name$$'))}}" userInput="5.5" stepKey="fillQty2"/> + <click selector="{{CheckoutCartProductSection.updateShoppingCartButton}}" stepKey="clickOnUpdateShoppingCartButton"/> + <seeInField userInput="5.5" selector="{{CheckoutCartProductSection.ProductQuantityByName(('$$createPreReqSimpleProduct.name$$'))}}" stepKey="seeInField2"/> + </test> +</tests> \ No newline at end of file diff --git a/app/code/Magento/Search/Test/Mftf/Section/StorefrontQuickSearchSection.xml b/app/code/Magento/Search/Test/Mftf/Section/StorefrontQuickSearchSection.xml index 2b08e9b4b85ec..6baa3ff54fca0 100644 --- a/app/code/Magento/Search/Test/Mftf/Section/StorefrontQuickSearchSection.xml +++ b/app/code/Magento/Search/Test/Mftf/Section/StorefrontQuickSearchSection.xml @@ -8,7 +8,7 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> - <section name="StorefrontQuickSearchSection"> + <section name="StorefrontQuickSearchSection">/ <element name="searchPhrase" type="input" selector="#search"/> <element name="searchButton" type="button" selector="button.action.search" timeout="30"/> </section> From 3e94424757aa1b8ad2febc89617f5b199057b8ec Mon Sep 17 00:00:00 2001 From: Dmytro Drozd <ddrozd@magento.com> Date: Wed, 31 Oct 2018 17:12:26 +0200 Subject: [PATCH 23/28] MAGETWO-96026: Create MFTF test for MAGETWO-93973 --- .../AdminProductFormAdvancedInventorySection.xml | 12 ------------ .../Mftf/Section/StorefrontQuickSearchSection.xml | 2 +- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormAdvancedInventorySection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormAdvancedInventorySection.xml index e1272899b78ab..0314534dcddfb 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormAdvancedInventorySection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormAdvancedInventorySection.xml @@ -9,17 +9,6 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminProductFormAdvancedInventorySection"> - <!--<element name="customerGroupPriceAddButton" type="button" selector="[data-action='add_new_row']" timeout="30"/>--> - <!--<element name="customerGroupPriceDeleteButton" type="button" selector="[data-action='remove_row']" timeout="30"/>--> - <!--<element name="advancedPricingCloseButton" type="button" selector=".product_form_product_form_advanced_pricing_modal button.action-close" timeout="30"/>--> - <!--<element name="productTierPriceWebsiteSelect" type="select" selector="[name='product[tier_price][{{var1}}][website_id]']" parameterized="true"/>--> - <!--<element name="productTierPriceCustGroupSelect" type="select" selector="[name='product[tier_price][{{var1}}][cust_group]']" parameterized="true"/>--> - <!--<element name="productTierPriceQtyInput" type="input" selector="[name='product[tier_price][{{var1}}][price_qty]']" parameterized="true"/>--> - <!--<element name="productTierPriceValueTypeSelect" type="select" selector="[name='product[tier_price][{{var1}}][value_type]']" parameterized="true"/>--> - <!--<element name="productTierPriceFixedPriceInput" type="input" selector="[name='product[tier_price][{{var1}}][price]']" parameterized="true"/>--> - <!--<element name="productTierPricePercentageValuePriceInput" type="input" selector="[name='product[tier_price][{{var1}}][percentage_value]']" parameterized="true"/>--> - <!--<element name="specialPrice" type="input" selector="input[name='product[special_price]']"/>--> - <element name="enableQtyIncrements" type="select" selector="//*[@name='product[stock_data][enable_qty_increments]']"/> <element name="enableQtyIncrementsOptions" type="select" selector="//*[@name='product[stock_data][enable_qty_increments]']//option[contains(@value, '{{var1}}')]" parameterized="true"/> <element name="enableQtyIncrementsUseConfigSettings" type="checkbox" selector="//input[@name='product[stock_data][use_config_enable_qty_inc]']"/> @@ -27,7 +16,6 @@ <element name="qtyUsesDecimalsOptions" type="select" selector="//*[@name='product[stock_data][is_qty_decimal]']//option[contains(@value, '{{var1}}')]" parameterized="true"/> <element name="qtyIncrements" type="input" selector="//input[@name='product[stock_data][qty_increments]']"/> <element name="qtyIncrementsUseConfigSettings" type="checkbox" selector="//input[@name='product[stock_data][use_config_qty_increments]']"/> - <element name="doneButton" type="button" selector="//aside[contains(@class,'product_form_product_form_advanced_inventory_modal')]//button[contains(@data-role,'action')]" timeout="5"/> </section> </sections> diff --git a/app/code/Magento/Search/Test/Mftf/Section/StorefrontQuickSearchSection.xml b/app/code/Magento/Search/Test/Mftf/Section/StorefrontQuickSearchSection.xml index 6baa3ff54fca0..2b08e9b4b85ec 100644 --- a/app/code/Magento/Search/Test/Mftf/Section/StorefrontQuickSearchSection.xml +++ b/app/code/Magento/Search/Test/Mftf/Section/StorefrontQuickSearchSection.xml @@ -8,7 +8,7 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> - <section name="StorefrontQuickSearchSection">/ + <section name="StorefrontQuickSearchSection"> <element name="searchPhrase" type="input" selector="#search"/> <element name="searchButton" type="button" selector="button.action.search" timeout="30"/> </section> From a537b009bbece04073700df55bbd1a0abaf31821 Mon Sep 17 00:00:00 2001 From: Dmytro Drozd <ddrozd@magento.com> Date: Thu, 1 Nov 2018 11:32:05 +0200 Subject: [PATCH 24/28] MAGETWO-96026: Create MFTF test for MAGETWO-93973 --- ...gAndQuantityIncrementsWorkWithDecimalinventoryTest.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/TieredPricingAndQuantityIncrementsWorkWithDecimalinventoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/TieredPricingAndQuantityIncrementsWorkWithDecimalinventoryTest.xml index 7a774c585c9cd..e9158e91432fa 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/TieredPricingAndQuantityIncrementsWorkWithDecimalinventoryTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/TieredPricingAndQuantityIncrementsWorkWithDecimalinventoryTest.xml @@ -1,3 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="TieredPricingAndQuantityIncrementsWorkWithDecimalinventoryTest"> From 0ae58d9b877fffedee4ba7eeb40331c63dfcc7a3 Mon Sep 17 00:00:00 2001 From: Dmytro Drozd <ddrozd@magento.com> Date: Thu, 1 Nov 2018 17:10:46 +0200 Subject: [PATCH 25/28] MAGETWO-96026: Create MFTF test for MAGETWO-93973 --- .../Catalog/Test/Mftf/Section/AdminProductFormSection.xml | 2 +- ...PricingAndQuantityIncrementsWorkWithDecimalinventoryTest.xml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml index 9ec0dbf9f262c..249610568aec7 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml @@ -28,7 +28,7 @@ <element name="advancedPricingLink" type="button" selector="button[data-index='advanced_pricing_button']"/> <element name="categoriesDropdown" type="multiselect" selector="div[data-index='category_ids']"/> <element name="productQuantity" type="input" selector=".admin__field[data-index=qty] input"/> - <element name="advancedInventoryLink" type="input" selector="//button[contains(@data-index, 'advanced_inventory_button')]"/> + <element name="advancedInventoryLink" type="button" selector="//button[contains(@data-index, 'advanced_inventory_button')]"/> <element name="productStockStatus" type="select" selector="select[name='product[quantity_and_stock_status][is_in_stock]']"/> <element name="productWeight" type="input" selector=".admin__field[data-index=weight] input"/> <element name="productWeightSelect" type="select" selector="select[name='product[product_has_weight]']"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/TieredPricingAndQuantityIncrementsWorkWithDecimalinventoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/TieredPricingAndQuantityIncrementsWorkWithDecimalinventoryTest.xml index e9158e91432fa..9dbd2eb0c1fae 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/TieredPricingAndQuantityIncrementsWorkWithDecimalinventoryTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/TieredPricingAndQuantityIncrementsWorkWithDecimalinventoryTest.xml @@ -45,6 +45,7 @@ <!--Step3. Open *Advanced Pricing* pop-up (Click on *Advanced Pricing* link). Click on *Add* button. Fill *0.5* in *Quantity*--> <scrollTo selector="{{AdminProductFormSection.productName}}" stepKey="scrollToProductName"/> <click selector="{{AdminProductFormSection.advancedPricingLink}}" stepKey="clickOnAdvancedPricingLink1"/> + <waitForElement selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceAddButton}}" stepKey="waitForAddButton"/> <click selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceAddButton}}" stepKey="clickOnCustomerGroupPriceAddButton"/> <fillField selector="{{AdminProductFormAdvancedPricingSection.productTierPriceQtyInput('0')}}" userInput="0.5" stepKey="fillProductTierPriceQty"/> <!--Step4. Close *Advanced Pricing* (Click on button *Done*). Save *prod1* (Click on button *Save*)--> From a0fddaa2777641013b57a62eac9649efc8d79fe8 Mon Sep 17 00:00:00 2001 From: Dmytro Drozd <ddrozd@magento.com> Date: Thu, 1 Nov 2018 18:45:27 +0200 Subject: [PATCH 26/28] MAGETWO-96026: Create MFTF test for MAGETWO-93973 --- ...ingAndQuantityIncrementsWorkWithDecimalinventoryTest.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/TieredPricingAndQuantityIncrementsWorkWithDecimalinventoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/TieredPricingAndQuantityIncrementsWorkWithDecimalinventoryTest.xml index 9dbd2eb0c1fae..6eb78809b187d 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/TieredPricingAndQuantityIncrementsWorkWithDecimalinventoryTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/TieredPricingAndQuantityIncrementsWorkWithDecimalinventoryTest.xml @@ -10,13 +10,13 @@ xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="TieredPricingAndQuantityIncrementsWorkWithDecimalinventoryTest"> <annotations> - <features value="Tiered pricing and quantity increments work with decimal inventory"/> + <features value="Catalog"/> <stories value="Tiered pricing and quantity increments work with decimal inventory"/> <title value="Tiered pricing and quantity increments work with decimal inventory"/> <description value="Tiered pricing and quantity increments work with decimal inventory"/> <severity value="CRITICAL"/> - <testCaseId value="MAGETWO-91178"/> - <group value="product"/> + <testCaseId value="MAGETWO-93973"/> + <group value="Catalog"/> </annotations> <before> <createData entity="_defaultCategory" stepKey="createPreReqCategory"/> From 3343ad61aa8ac0d596f5b6783b25852d8589f966 Mon Sep 17 00:00:00 2001 From: Dmytro Drozd <ddrozd@magento.com> Date: Mon, 5 Nov 2018 20:41:11 +0200 Subject: [PATCH 27/28] MAGETWO-96026: Create MFTF test for MAGETWO-93973. Add more stability --- ...PricingAndQuantityIncrementsWorkWithDecimalinventoryTest.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/TieredPricingAndQuantityIncrementsWorkWithDecimalinventoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/TieredPricingAndQuantityIncrementsWorkWithDecimalinventoryTest.xml index 6eb78809b187d..a8b2df1fcfa67 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/TieredPricingAndQuantityIncrementsWorkWithDecimalinventoryTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/TieredPricingAndQuantityIncrementsWorkWithDecimalinventoryTest.xml @@ -63,7 +63,9 @@ <click selector="{{AdminProductFormAdvancedInventorySection.enableQtyIncrementsUseConfigSettings}}" stepKey="clickOnEnableQtyIncrementsUseConfigSettingsCheckbox"/> <click selector="{{AdminProductFormAdvancedInventorySection.enableQtyIncrements}}" stepKey="clickOnEnableQtyIncrements"/> <click selector="{{AdminProductFormAdvancedInventorySection.enableQtyIncrementsOptions(('1'))}}" stepKey="chooseYesOnEnableQtyIncrements"/> + <scrollTo selector="{{AdminProductFormAdvancedInventorySection.qtyIncrementsUseConfigSettings}}" stepKey="scrollToQtyIncrementsUseConfigSettings"/> <click selector="{{AdminProductFormAdvancedInventorySection.qtyIncrementsUseConfigSettings}}" stepKey="clickOnQtyIncrementsUseConfigSettings"/> + <scrollTo selector="{{AdminProductFormAdvancedInventorySection.qtyIncrements}}" stepKey="scrollToQtyIncrements"/> <fillField selector="{{AdminProductFormAdvancedInventorySection.qtyIncrements}}" userInput=".5" stepKey="fillQtyIncrements"/> <!--Step6. Close *Advanced Inventory* (Click on button *Done*). Save *prod1* (Click on button *Save*) --> <click selector="{{AdminProductFormAdvancedInventorySection.doneButton}}" stepKey="clickOnDoneButton3"/> From 6d26686321561fb0460f8024d89af2483a2dfda9 Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov <oiegorov@magento.com> Date: Mon, 19 Nov 2018 17:35:28 +0200 Subject: [PATCH 28/28] MAGETWO-94424: Wrong product and shipping prices are applying on admin orders --- app/code/Magento/Store/Model/Store.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Store/Model/Store.php b/app/code/Magento/Store/Model/Store.php index 32c9a78448428..c92d62cd0bbe3 100644 --- a/app/code/Magento/Store/Model/Store.php +++ b/app/code/Magento/Store/Model/Store.php @@ -412,7 +412,7 @@ public function __construct( } /** - * @return string[] + * @inheritdoc */ public function __sleep() { @@ -786,7 +786,7 @@ public function isFrontUrlSecure() } /** - * @return bool + * @inheritdoc */ public function isUrlSecure() { @@ -1338,6 +1338,8 @@ public function getIdentities() } /** + * Get store path + * * @return string */ public function getStorePath() @@ -1347,8 +1349,7 @@ public function getStorePath() } /** - * {@inheritdoc} - * @since 100.1.0 + * @inheritdoc */ public function getScopeType() { @@ -1356,8 +1357,7 @@ public function getScopeType() } /** - * {@inheritdoc} - * @since 100.1.0 + * @inheritdoc */ public function getScopeTypeName() { @@ -1365,7 +1365,7 @@ public function getScopeTypeName() } /** - * {@inheritdoc} + * @inheritdoc */ public function getExtensionAttributes() { @@ -1373,8 +1373,7 @@ public function getExtensionAttributes() } /** - * @param \Magento\Store\Api\Data\StoreExtensionInterface $extensionAttributes - * @return $this + * @inheritdoc */ public function setExtensionAttributes( \Magento\Store\Api\Data\StoreExtensionInterface $extensionAttributes