From 04c80077030307b57aa7c1bfb7959f14a2441097 Mon Sep 17 00:00:00 2001 From: Yaroslav Onischenko Date: Mon, 2 Nov 2015 20:23:35 +0200 Subject: [PATCH 01/18] MAGETWO-44145: Read and Edit Permissions does not work --- .../Block/Adminhtml/Product/Helper/Form/Price.php | 8 +++++--- .../view/adminhtml/web/js/advanced-pricing-handler.js | 11 ++++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Price.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Price.php index f1251b95f9923..a5ff7b48d949c 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Price.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Price.php @@ -71,9 +71,11 @@ public function getAfterElementHtml() $addJsObserver = false; if ($attribute = $this->getEntityAttribute()) { $store = $this->getStore($attribute); - $html .= '' . $this->_localeCurrency->getCurrency( - $store->getBaseCurrencyCode() - )->getSymbol() . ''; + if ($this->getType() !== 'hidden') { + $html .= '' + . $this->_localeCurrency->getCurrency($store->getBaseCurrencyCode())->getSymbol() + . ''; + } if ($this->_taxData->priceIncludesTax($store)) { if ($attribute->getAttributeCode() !== 'cost') { $addJsObserver = true; diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/advanced-pricing-handler.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/advanced-pricing-handler.js index 99544c0e29bc2..1f04719da9954 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/advanced-pricing-handler.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/advanced-pricing-handler.js @@ -10,17 +10,26 @@ define([ 'use strict'; return { + $initiallyDisabledAttributes: [], $links: $('[data-ui-id=product-tabs-tab-link-advanced-pricing]'), $tab: $('[data-tab-panel=advanced-pricing]'), toggleDisabledAttribute: function (disabled) { $('input,select', this.$tab).each(function (index, element) { - $(element).attr('disabled', disabled); + if (!$.inArray(element, this.$initiallyDisabledAttributes)) { + $(element).attr('disabled', disabled); + } }); }, init: function () { $(document).on('changeTypeProduct', this._initType.bind(this)); + this._setInitialState(); this._initType(); }, + _setInitialState: function () { + if (this.$initiallyDisabledAttributes.length == 0) { + this.$initiallyDisabledAttributes = $('input:disabled,select:disabled', this.$tab).toArray(); + } + }, _initType: function () { var isConfigurable = productType.type.current === 'configurable'; From 0e2a8d2dd5bc1385739d7ecaaa5a7f57b2c8d613 Mon Sep 17 00:00:00 2001 From: Michail Slabko Date: Tue, 3 Nov 2015 10:14:01 +0200 Subject: [PATCH 02/18] MAGETWO-44868: Swatches thumbnails aren't shown on frontend --- app/code/Magento/Catalog/Helper/Image.php | 4 +-- .../Block/Product/Renderer/Configurable.php | 36 +++++++++++-------- .../Magento/Swatches/Model/Plugin/Product.php | 7 +--- app/code/Magento/Swatches/Model/Swatch.php | 10 ++++++ .../Product/Renderer/ConfigurableTest.php | 8 ++--- 5 files changed, 38 insertions(+), 27 deletions(-) diff --git a/app/code/Magento/Catalog/Helper/Image.php b/app/code/Magento/Catalog/Helper/Image.php index a847e8c42454a..834134d8719cb 100644 --- a/app/code/Magento/Catalog/Helper/Image.php +++ b/app/code/Magento/Catalog/Helper/Image.php @@ -176,8 +176,8 @@ public function init($product, $imageId, $attributes = []) $this->_reset(); $this->attributes = array_merge( - $attributes, - $this->getConfigView()->getMediaAttributes('Magento_Catalog', self::MEDIA_TYPE_CONFIG_NODE, $imageId) + $this->getConfigView()->getMediaAttributes('Magento_Catalog', self::MEDIA_TYPE_CONFIG_NODE, $imageId), + $attributes ); $this->setProduct($product); diff --git a/app/code/Magento/Swatches/Block/Product/Renderer/Configurable.php b/app/code/Magento/Swatches/Block/Product/Renderer/Configurable.php index ded4d146c12d2..339ba7dc43419 100644 --- a/app/code/Magento/Swatches/Block/Product/Renderer/Configurable.php +++ b/app/code/Magento/Swatches/Block/Product/Renderer/Configurable.php @@ -253,11 +253,11 @@ protected function extractNecessarySwatchData(array $swatchDataArray) if ($result['type'] == Swatch::SWATCH_TYPE_VISUAL_IMAGE && !empty($swatchDataArray['value'])) { $result['value'] = $this->swatchMediaHelper->getSwatchAttributeImage( - 'swatch_image', + Swatch::SWATCH_IMAGE_NAME, $swatchDataArray['value'] ); $result['thumb'] = $this->swatchMediaHelper->getSwatchAttributeImage( - 'swatch_thumb', + Swatch::SWATCH_THUMBNAIL_NAME, $swatchDataArray['value'] ); } else { @@ -284,8 +284,8 @@ protected function getVariationMedia($attributeCode, $optionId) $variationMediaArray = []; if ($variationProduct) { $variationMediaArray = [ - 'value' => $this->getSwatchProductImage($variationProduct, 'swatch_image'), - 'thumb' => $this->getSwatchProductImage($variationProduct, 'swatch_thumb'), + 'value' => $this->getSwatchProductImage($variationProduct, Swatch::SWATCH_IMAGE_NAME), + 'thumb' => $this->getSwatchProductImage($variationProduct, Swatch::SWATCH_THUMBNAIL_NAME), ]; } @@ -299,22 +299,28 @@ protected function getVariationMedia($attributeCode, $optionId) */ protected function getSwatchProductImage(Product $childProduct, $imageType) { - if ( - $childProduct->getData('swatch_image') !== null - && $childProduct->getData('swatch_image') != self::EMPTY_IMAGE_VALUE - ) { - $swatchImageId = $imageType == 'swatch_image' ? 'swatch_image' : 'swatch_thumb'; - } elseif ( - $childProduct->getData('image') !== null - && $childProduct->getData('image') != self::EMPTY_IMAGE_VALUE - ) { - $swatchImageId = $imageType == 'swatch_image' ? 'swatch_image_base' : 'swatch_thumb_base'; + if ($this->isProductHasImage($childProduct, Swatch::SWATCH_IMAGE_NAME)) { + $swatchImageId = $imageType; + $imageAttributes = ['type' => Swatch::SWATCH_IMAGE_NAME]; + } elseif ($this->isProductHasImage($childProduct, 'image')) { + $swatchImageId = $imageType == Swatch::SWATCH_IMAGE_NAME ? 'swatch_image_base' : 'swatch_thumb_base'; + $imageAttributes = ['type' => 'image']; } if (isset($swatchImageId)) { - return $this->_imageHelper->init($childProduct, $swatchImageId)->getUrl(); + return $this->_imageHelper->init($childProduct, $swatchImageId, $imageAttributes)->getUrl(); } } + /** + * @param Product $product + * @param string $imageType + * @return bool + */ + protected function isProductHasImage(Product $product, $imageType) + { + return $product->getData($imageType) !== null && $product->getData($imageType) != self::EMPTY_IMAGE_VALUE; + } + /** * @param array $attributeData * @return array diff --git a/app/code/Magento/Swatches/Model/Plugin/Product.php b/app/code/Magento/Swatches/Model/Plugin/Product.php index b0ad0fd021322..8d731a4b7a5f3 100644 --- a/app/code/Magento/Swatches/Model/Plugin/Product.php +++ b/app/code/Magento/Swatches/Model/Plugin/Product.php @@ -10,11 +10,6 @@ */ class Product { - /** - * Name of swatch image role - */ - const ROLE_SWATCH_IMAGE_NAME = 'swatch_image'; - /** * Unset swatch image role if product is not simple * @@ -28,7 +23,7 @@ public function afterGetMediaAttributes(\Magento\Catalog\Model\Product $product, && $product->getTypeId() !== \Magento\Catalog\Model\Product\Type::TYPE_VIRTUAL ) { if (is_array($imageRoles)) { - unset($imageRoles[self::ROLE_SWATCH_IMAGE_NAME]); + unset($imageRoles[\Magento\Swatches\Model\Swatch::SWATCH_IMAGE_NAME]); } } diff --git a/app/code/Magento/Swatches/Model/Swatch.php b/app/code/Magento/Swatches/Model/Swatch.php index cfb4d34e398dc..8a928c7bb95b1 100644 --- a/app/code/Magento/Swatches/Model/Swatch.php +++ b/app/code/Magento/Swatches/Model/Swatch.php @@ -40,6 +40,16 @@ class Swatch extends \Magento\Framework\Model\AbstractModel /** Constant for identifying empty swatch type */ const SWATCH_TYPE_EMPTY = 3; + /** + * Name of swatch image + */ + const SWATCH_IMAGE_NAME = 'swatch_image'; + + /** + * Name of swatch thumbnail + */ + const SWATCH_THUMBNAIL_NAME = 'swatch_thumb'; + /** * Initialize resource model * diff --git a/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/ConfigurableTest.php b/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/ConfigurableTest.php index e95c5dd2b32e7..2b3500f057f31 100644 --- a/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/ConfigurableTest.php +++ b/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/ConfigurableTest.php @@ -176,8 +176,8 @@ public function testGetJsonSwatchConfigNotVisualImageType() $this->imageHelper->expects($this->exactly(2))->method('init') ->willReturnMap([ - [$this->product, 'swatch_image', [], $this->imageHelper], - [$this->product, 'swatch_thumb', [], $this->imageHelper], + [$this->product, 'swatch_image', ['type' => 'swatch_image'], $this->imageHelper], + [$this->product, 'swatch_thumb', ['type' => 'swatch_image'], $this->imageHelper], ]); $this->jsonEncoder->expects($this->once())->method('encode'); @@ -222,8 +222,8 @@ public function testGetJsonSwatchConfigVisualImageType() $this->imageHelper->expects($this->exactly(2))->method('init') ->willReturnMap([ - [$this->product, 'swatch_image_base', [], $this->imageHelper], - [$this->product, 'swatch_thumb_base', [], $this->imageHelper], + [$this->product, 'swatch_image_base', ['type' => 'image'], $this->imageHelper], + [$this->product, 'swatch_thumb_base', ['type' => 'image'], $this->imageHelper], ]); $this->jsonEncoder->expects($this->once())->method('encode'); From 5e98e6a739c8d2522dd424e99d46c1443df2a173 Mon Sep 17 00:00:00 2001 From: Andrii Lugovyi Date: Tue, 3 Nov 2015 15:22:53 +0200 Subject: [PATCH 03/18] MAGETWO-44825: Swatches does not update configurable product price - refactoring, add undescorejs --- .../view/frontend/web/js/SwatchRenderer.js | 29 +++++++------------ 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/app/code/Magento/Swatches/view/frontend/web/js/SwatchRenderer.js b/app/code/Magento/Swatches/view/frontend/web/js/SwatchRenderer.js index 0baa01cffda9c..b2b20e8a47497 100644 --- a/app/code/Magento/Swatches/view/frontend/web/js/SwatchRenderer.js +++ b/app/code/Magento/Swatches/view/frontend/web/js/SwatchRenderer.js @@ -2,24 +2,15 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -Number.prototype.formatMoney = function (c, d, t) { //this function helps format price - var n = this, - c = isNaN(c = Math.abs(c)) ? 2 : c, - d = d == undefined ? "." : d, - t = t == undefined ? "," : t, - s = n < 0 ? "-" : "", - i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", - j = (j = i.length) > 3 ? j % 3 : 0; - return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : ""); -}; - -Array.prototype.intersection = function (a) { - return this.filter(function (i) { - return a.indexOf(i) >= 0; - }); -}; -define(["jquery", "jquery/ui"], function ($) { +define(['jquery', 'underscore', 'jquery/ui'], function ($, _) { + 'use strict'; + + /** + * Parse params + * @param {String} query + * @returns {{}} + */ $.parseParams = function (query) { var re = /([^&=]+)=?([^&]*)/g, decodeRE = /\+/g, // Regex for replacing addition symbol with a space @@ -564,7 +555,7 @@ define(["jquery", "jquery/ui"], function ($) { return; } - if (products.intersection($widget.optionsMap[id][option].products).length <= 0) { + if (_.intersection(products, $widget.optionsMap[id][option].products).length <= 0) { $this.attr('disabled', true).addClass('disabled'); } }); @@ -597,7 +588,7 @@ define(["jquery", "jquery/ui"], function ($) { if (products.length == 0) { products = $widget.optionsMap[id][option].products; } else { - products = products.intersection($widget.optionsMap[id][option].products); + products = _.intersection(products, $widget.optionsMap[id][option].products); } }); From d076c0ab014f032d49bb9150c8b3e2cfdfca378c Mon Sep 17 00:00:00 2001 From: Andrii Lugovyi Date: Tue, 3 Nov 2015 15:25:11 +0200 Subject: [PATCH 04/18] MAGETWO-44825: Swatches does not update configurable product price - function _UpdatePrice used price-box component --- .../view/frontend/web/js/SwatchRenderer.js | 49 ++++++++++++++----- 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/Swatches/view/frontend/web/js/SwatchRenderer.js b/app/code/Magento/Swatches/view/frontend/web/js/SwatchRenderer.js index b2b20e8a47497..b40f13fe31c8a 100644 --- a/app/code/Magento/Swatches/view/frontend/web/js/SwatchRenderer.js +++ b/app/code/Magento/Swatches/view/frontend/web/js/SwatchRenderer.js @@ -167,7 +167,7 @@ define(['jquery', 'underscore', 'jquery/ui'], function ($, _) { jsonConfig: {}, // option's json config jsonSwatchConfig: {}, // swatch's json config selectorProduct: '.product-info-main', // selector of parental block of prices and swatches (need to know where to seek for price block) - selectorProductPrice: '.price-final-price .price', // selector of price wrapper (need to know where set price) + selectorProductPrice: '[data-role=priceBox]', // selector of price wrapper (need to know where set price) numberToShow: false, // number of controls to show (false or zero = show all) onlySwatches: false, // show only swatch controls enableControlLabel: true, // enable label for control @@ -603,21 +603,48 @@ define(['jquery', 'underscore', 'jquery/ui'], function ($, _) { _UpdatePrice: function () { var $widget = this, $product = $widget.element.parents($widget.options.selectorProduct), - price = $product.find('[data-price-amount]').data('price-amount'); + $productPrice = $product.find(this.options.selectorProductPrice), + options = _.object(_.keys($widget.optionsMap), {}), + result; $widget.element.find('.' + $widget.options.classes.attributeClass + '[option-selected]').each(function () { - var id = $(this).attr('attribute-id'); - var option = $(this).attr('option-selected'); + var attributeId = $(this).attr('attribute-id'), + selectedOptionId = $(this).attr('option-selected'); + + options[attributeId] = selectedOptionId; + }); + + result = $widget.options.jsonConfig.optionPrices[_.findKey($widget.options.jsonConfig.index, options)]; + + $productPrice.trigger( + 'updatePrice', + { + 'prices': $widget._getPrices(result, $productPrice.priceBox('option').prices) + } + ); + + }, - price = $widget.optionsMap[id][option].price; + /** + * Get prices + * @param {Object} newPrices + * @returns {Object} + * @private + */ + _getPrices: function (newPrices, displayPrices) { + var $widget = this; + + if (_.isEmpty(newPrices)) { + newPrices = $widget.options.jsonConfig.prices; + } + + _.each(displayPrices, function (price, code) { + if (newPrices[code]) { + displayPrices[code].amount = newPrices[code].amount - displayPrices[code].amount; + } }); - $product - .find($widget.options.selectorProductPrice) - .text($widget.options.jsonConfig.template.replace( - '<%- data.price %>', - price.formatMoney(2) - )); + return displayPrices; }, /** From b35b3b274f4f7b77f2198b2b7b36bd1135a88c78 Mon Sep 17 00:00:00 2001 From: Andrii Lugovyi Date: Tue, 3 Nov 2015 16:59:58 +0200 Subject: [PATCH 05/18] MAGETWO-44825: Swatches does not update configurable product price - not call _UpdatePrice in catalog area --- .../Swatches/view/frontend/web/js/SwatchRenderer.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Swatches/view/frontend/web/js/SwatchRenderer.js b/app/code/Magento/Swatches/view/frontend/web/js/SwatchRenderer.js index b40f13fe31c8a..6a0070d570cc8 100644 --- a/app/code/Magento/Swatches/view/frontend/web/js/SwatchRenderer.js +++ b/app/code/Magento/Swatches/view/frontend/web/js/SwatchRenderer.js @@ -467,7 +467,13 @@ define(['jquery', 'underscore', 'jquery/ui'], function ($, _) { } $widget._Rebuild(); - $widget._UpdatePrice(); + + if ($widget.element.parents($widget.options.selectorProduct) + .find(this.options.selectorProductPrice).is(':data(mage-priceBox)') + ) { + $widget._UpdatePrice(); + } + $widget._LoadProductMedia(); }, From 331a74bc3d86fe5e5e73499798eaa8fc19326520 Mon Sep 17 00:00:00 2001 From: Michail Slabko Date: Tue, 3 Nov 2015 17:41:20 +0200 Subject: [PATCH 06/18] MAGETWO-44927: Two products are added to shopping cart when MAP is enabled + Production mode --- app/code/Magento/Msrp/view/base/web/js/msrp.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/code/Magento/Msrp/view/base/web/js/msrp.js b/app/code/Magento/Msrp/view/base/web/js/msrp.js index a63001b5bc842..fe5643d5b2baa 100644 --- a/app/code/Magento/Msrp/view/base/web/js/msrp.js +++ b/app/code/Magento/Msrp/view/base/web/js/msrp.js @@ -210,11 +210,6 @@ define([ this.$popup.find(this.options.msrpLabelId).html(this.options.msrpPrice); this.$popup.find(this.options.priceLabelId).html(this.options.realPrice); this.$popup.dropdownDialog(this.popUpOptions).dropdownDialog('open'); - this.$popup.find('button').on('click', function () { - if (this.options.addToCartButton) { - $(this.options.addToCartButton).click(); - } - }.bind(this)); this._toggle(this.$popup); if (!this.options.isSaleable) { From a6317f41209a14ff72160be62dda36a3e87ddd9e Mon Sep 17 00:00:00 2001 From: Mikalai Shostka Date: Tue, 3 Nov 2015 20:40:27 +0300 Subject: [PATCH 07/18] Default autoplay if base off --- app/code/Magento/ProductVideo/etc/config.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/ProductVideo/etc/config.xml b/app/code/Magento/ProductVideo/etc/config.xml index 127ba79e77d60..248336315db32 100644 --- a/app/code/Magento/ProductVideo/etc/config.xml +++ b/app/code/Magento/ProductVideo/etc/config.xml @@ -9,7 +9,7 @@ - 1 + 0 0 0 From df9ced93af7dbe5a61d8520a09ff1ac194319b90 Mon Sep 17 00:00:00 2001 From: Dmitry Kologrivov Date: Tue, 3 Nov 2015 20:56:20 +0300 Subject: [PATCH 08/18] MAGETWO-44227: fix config data --- .../Magento/Framework/Config/FileResolver.php | 29 ++++++++++--------- .../Magento/Framework/Config/View.php | 23 ++++++++++++++- 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/lib/internal/Magento/Framework/Config/FileResolver.php b/lib/internal/Magento/Framework/Config/FileResolver.php index 0af746da34d3d..78d81073c100e 100644 --- a/lib/internal/Magento/Framework/Config/FileResolver.php +++ b/lib/internal/Magento/Framework/Config/FileResolver.php @@ -11,7 +11,7 @@ use Magento\Framework\Filesystem; use Magento\Framework\View\DesignInterface; use Magento\Framework\App\Filesystem\DirectoryList; -use Symfony\Component\Config\Definition\Exception\Exception; +use Magento\Framework\Component\ComponentRegistrar; class FileResolver implements \Magento\Framework\Config\FileResolverInterface { @@ -43,25 +43,30 @@ class FileResolver implements \Magento\Framework\Config\FileResolverInterface protected $area; /** - * Root directory - * - * @var ReadInterface + * @var Filesystem\Directory\ReadInterface */ protected $rootDirectory; + /** + * @var \Magento\Framework\Component\ComponentRegistrar + */ + protected $componentRegistrar; + /** * @param Reader $moduleReader * @param FileIteratorFactory $iteratorFactory * @param DesignInterface $designInterface * @param DirectoryList $directoryList * @param Filesystem $filesystem + * @param ComponentRegistrar $componentRegistrar */ public function __construct( Reader $moduleReader, FileIteratorFactory $iteratorFactory, DesignInterface $designInterface, DirectoryList $directoryList, - Filesystem $filesystem + Filesystem $filesystem, + ComponentRegistrar $componentRegistrar ) { $this->directoryList = $directoryList; $this->iteratorFactory = $iteratorFactory; @@ -70,6 +75,7 @@ public function __construct( $this->themePath = $designInterface->getThemePath($this->currentTheme); $this->area = $designInterface->getArea(); $this->rootDirectory = $filesystem->getDirectoryRead(DirectoryList::ROOT); + $this->componentRegistrar = $componentRegistrar; } /** @@ -80,7 +86,6 @@ public function get($filename, $scope) switch ($scope) { case 'global': $iterator = $this->moduleReader->getConfigurationFiles($filename)->toArray(); - $themeConfigFile = $this->currentTheme->getCustomization()->getCustomViewConfigPath(); if ($themeConfigFile && $this->rootDirectory->isExist($this->rootDirectory->getRelativePath($themeConfigFile)) @@ -89,20 +94,18 @@ public function get($filename, $scope) $this->rootDirectory->getRelativePath($themeConfigFile) ); } - $designPath = - $this->directoryList->getPath(DirectoryList::APP) - . '/design/' - . $this->area - . '/' - . $this->themePath + $this->componentRegistrar->getPath(ComponentRegistrar::THEME, $this->area . '/' . $this->themePath) . '/etc/view.xml'; if (file_exists($designPath)) { try { $designDom = new \DOMDocument; $designDom->load($designPath); $iterator[$designPath] = $designDom->saveXML(); - } catch (Exception $e) { + } catch (\Exception $e) { + throw new \Magento\Framework\Exception\LocalizedException( + __('Could not read config file') + ); } } break; diff --git a/lib/internal/Magento/Framework/Config/View.php b/lib/internal/Magento/Framework/Config/View.php index ac907e5e6dad6..c4e1aeb3477e6 100644 --- a/lib/internal/Magento/Framework/Config/View.php +++ b/lib/internal/Magento/Framework/Config/View.php @@ -18,6 +18,13 @@ class View extends \Magento\Framework\Config\Reader\Filesystem */ protected $xpath; + /** + * View config data + * + * @var array + */ + protected $data; + /** * @param FileResolverInterface $fileResolver * @param ConverterInterface $converter @@ -52,7 +59,6 @@ public function __construct( $domDocumentClass, $defaultScope ); - $this->data = $this->read(); } /** @@ -65,6 +71,9 @@ public function __construct( */ public function getVars($module) { + if ($this->data === null) { + $this->data = $this->read(); + } return isset($this->data['vars'][$module]) ? $this->data['vars'][$module] : []; } @@ -77,6 +86,9 @@ public function getVars($module) */ public function getVarValue($module, $var) { + if ($this->data === null) { + $this->data = $this->read(); + } if (!isset($this->data['vars'][$module])) { return false; } @@ -102,6 +114,9 @@ public function getVarValue($module, $var) */ public function getMediaEntities($module, $mediaType) { + if ($this->data === null) { + $this->data = $this->read(); + } return isset($this->data['media'][$module][$mediaType]) ? $this->data['media'][$module][$mediaType] : []; } @@ -115,6 +130,9 @@ public function getMediaEntities($module, $mediaType) */ public function getMediaAttributes($module, $mediaType, $mediaId) { + if ($this->data === null) { + $this->data = $this->read(); + } return isset($this->data['media'][$module][$mediaType][$mediaId]) ? $this->data['media'][$module][$mediaType][$mediaId] : []; @@ -185,6 +203,9 @@ public function getExcludedDir() */ protected function getItems() { + if ($this->data === null) { + $this->data = $this->read(); + } return isset($this->data['exclude']) ? $this->data['exclude'] : []; } } From 17f41066a7905fccd29525bf34684d4db5c04adf Mon Sep 17 00:00:00 2001 From: Dmitry Kologrivov Date: Tue, 3 Nov 2015 21:06:42 +0300 Subject: [PATCH 09/18] MAGETWO-44227: add method setData --- .../Magento/Framework/Config/View.php | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/lib/internal/Magento/Framework/Config/View.php b/lib/internal/Magento/Framework/Config/View.php index c4e1aeb3477e6..57144dd2ec6bf 100644 --- a/lib/internal/Magento/Framework/Config/View.php +++ b/lib/internal/Magento/Framework/Config/View.php @@ -71,9 +71,7 @@ public function __construct( */ public function getVars($module) { - if ($this->data === null) { - $this->data = $this->read(); - } + $this->setData(); return isset($this->data['vars'][$module]) ? $this->data['vars'][$module] : []; } @@ -86,9 +84,7 @@ public function getVars($module) */ public function getVarValue($module, $var) { - if ($this->data === null) { - $this->data = $this->read(); - } + $this->setData(); if (!isset($this->data['vars'][$module])) { return false; } @@ -114,9 +110,7 @@ public function getVarValue($module, $var) */ public function getMediaEntities($module, $mediaType) { - if ($this->data === null) { - $this->data = $this->read(); - } + $this->setData(); return isset($this->data['media'][$module][$mediaType]) ? $this->data['media'][$module][$mediaType] : []; } @@ -130,9 +124,7 @@ public function getMediaEntities($module, $mediaType) */ public function getMediaAttributes($module, $mediaType, $mediaId) { - if ($this->data === null) { - $this->data = $this->read(); - } + $this->setData(); return isset($this->data['media'][$module][$mediaType][$mediaId]) ? $this->data['media'][$module][$mediaType][$mediaId] : []; @@ -202,10 +194,15 @@ public function getExcludedDir() * @return array */ protected function getItems() + { + $this->setData(); + return isset($this->data['exclude']) ? $this->data['exclude'] : []; + } + + protected function setData() { if ($this->data === null) { $this->data = $this->read(); } - return isset($this->data['exclude']) ? $this->data['exclude'] : []; } } From 3269108f000701ebd14989722a5a1e8547c836f4 Mon Sep 17 00:00:00 2001 From: Dmitry Kologrivov Date: Tue, 3 Nov 2015 21:12:48 +0300 Subject: [PATCH 10/18] MAGETWO-44227: changes for statics --- .../Magento/Framework/Config/FileResolver.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/internal/Magento/Framework/Config/FileResolver.php b/lib/internal/Magento/Framework/Config/FileResolver.php index 78d81073c100e..25d2e494d803b 100644 --- a/lib/internal/Magento/Framework/Config/FileResolver.php +++ b/lib/internal/Magento/Framework/Config/FileResolver.php @@ -90,13 +90,18 @@ public function get($filename, $scope) if ($themeConfigFile && $this->rootDirectory->isExist($this->rootDirectory->getRelativePath($themeConfigFile)) ) { - $iterator[$this->rootDirectory->getRelativePath($themeConfigFile)] = $this->rootDirectory->readFile( - $this->rootDirectory->getRelativePath($themeConfigFile) - ); + $iterator[$this->rootDirectory->getRelativePath($themeConfigFile)] = + $this->rootDirectory->readFile( + $this->rootDirectory->getRelativePath( + $themeConfigFile + ) + ); } $designPath = - $this->componentRegistrar->getPath(ComponentRegistrar::THEME, $this->area . '/' . $this->themePath) - . '/etc/view.xml'; + $this->componentRegistrar->getPath( + ComponentRegistrar::THEME, + $this->area . '/' . $this->themePath + ) . '/etc/view.xml'; if (file_exists($designPath)) { try { $designDom = new \DOMDocument; From ebc410f9beeca6ddcdfcd79ce4d0f9d571a12072 Mon Sep 17 00:00:00 2001 From: Igor Miniailo Date: Tue, 3 Nov 2015 20:42:07 +0200 Subject: [PATCH 11/18] Fixed MAGETWO-44938: Products aren't shown on frontend --- lib/internal/Magento/Framework/Config/View.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/internal/Magento/Framework/Config/View.php b/lib/internal/Magento/Framework/Config/View.php index 57144dd2ec6bf..09bf95ca4d4c3 100644 --- a/lib/internal/Magento/Framework/Config/View.php +++ b/lib/internal/Magento/Framework/Config/View.php @@ -71,7 +71,7 @@ public function __construct( */ public function getVars($module) { - $this->setData(); + $this->initData(); return isset($this->data['vars'][$module]) ? $this->data['vars'][$module] : []; } @@ -84,7 +84,7 @@ public function getVars($module) */ public function getVarValue($module, $var) { - $this->setData(); + $this->initData(); if (!isset($this->data['vars'][$module])) { return false; } @@ -110,7 +110,7 @@ public function getVarValue($module, $var) */ public function getMediaEntities($module, $mediaType) { - $this->setData(); + $this->initData(); return isset($this->data['media'][$module][$mediaType]) ? $this->data['media'][$module][$mediaType] : []; } @@ -124,7 +124,7 @@ public function getMediaEntities($module, $mediaType) */ public function getMediaAttributes($module, $mediaType, $mediaId) { - $this->setData(); + $this->initData(); return isset($this->data['media'][$module][$mediaType][$mediaId]) ? $this->data['media'][$module][$mediaType][$mediaId] : []; @@ -195,11 +195,16 @@ public function getExcludedDir() */ protected function getItems() { - $this->setData(); + $this->initData(); return isset($this->data['exclude']) ? $this->data['exclude'] : []; } - protected function setData() + /** + * Initialize data array + * + * @return void + */ + protected function initData() { if ($this->data === null) { $this->data = $this->read(); From c0fdc2e30dee9fb8caa790ebc739cba810dcdf30 Mon Sep 17 00:00:00 2001 From: Igor Miniailo Date: Tue, 3 Nov 2015 21:07:51 +0200 Subject: [PATCH 12/18] Fixed MAGETWO-44938: Products aren't shown on frontend --- lib/internal/Magento/Framework/Config/FileResolver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Config/FileResolver.php b/lib/internal/Magento/Framework/Config/FileResolver.php index 25d2e494d803b..a919ad5b5f406 100644 --- a/lib/internal/Magento/Framework/Config/FileResolver.php +++ b/lib/internal/Magento/Framework/Config/FileResolver.php @@ -109,7 +109,7 @@ public function get($filename, $scope) $iterator[$designPath] = $designDom->saveXML(); } catch (\Exception $e) { throw new \Magento\Framework\Exception\LocalizedException( - __('Could not read config file') + new \Magento\Framework\Phrase('Could not read config file') ); } } From b457988b708b278c1a18c61e48d1c334a977c024 Mon Sep 17 00:00:00 2001 From: Yaroslav Onischenko Date: Tue, 3 Nov 2015 22:05:41 +0200 Subject: [PATCH 13/18] MAGETWO-44953: Can't import configurable products MAGETWO-44941: Import History: impossible to download error files for unsuccessful product imports --- .../Model/Import/Product/Type/Bundle.php | 3 +++ .../Unit/Model/Import/Product/Type/BundleTest.php | 4 ++-- .../Model/Import/Product/Type/AbstractType.php | 11 ++++------- .../Model/Import/Product/Validator.php | 6 +++++- .../Test/Unit/Model/Import/Product/ValidatorTest.php | 7 +++++++ .../Model/Import/Product/Type/Configurable.php | 1 + .../Model/Product/Validator/Plugin.php | 3 +++ .../Model/Export/Adapter/AbstractAdapter.php | 4 ++-- 8 files changed, 27 insertions(+), 12 deletions(-) diff --git a/app/code/Magento/BundleImportExport/Model/Import/Product/Type/Bundle.php b/app/code/Magento/BundleImportExport/Model/Import/Product/Type/Bundle.php index 265a7df13725b..800b3e7e0ce16 100644 --- a/app/code/Magento/BundleImportExport/Model/Import/Product/Type/Bundle.php +++ b/app/code/Magento/BundleImportExport/Model/Import/Product/Type/Bundle.php @@ -384,6 +384,9 @@ public function saveData() public function isRowValid(array $rowData, $rowNum, $isNewProduct = true) { $rowData = array_merge($rowData, $this->transformBundleCustomAttributes($rowData)); + if (isset($rowData['bundle_price_type']) && $rowData['bundle_price_type'] == 'dynamic') { + $rowData['price'] = isset($rowData['price']) && $rowData['price'] ? $rowData['price'] : '0.00'; + } return parent::isRowValid($rowData, $rowNum, $isNewProduct); } diff --git a/app/code/Magento/BundleImportExport/Test/Unit/Model/Import/Product/Type/BundleTest.php b/app/code/Magento/BundleImportExport/Test/Unit/Model/Import/Product/Type/BundleTest.php index ac3ac5e92e00b..d9c0cf547368a 100644 --- a/app/code/Magento/BundleImportExport/Test/Unit/Model/Import/Product/Type/BundleTest.php +++ b/app/code/Magento/BundleImportExport/Test/Unit/Model/Import/Product/Type/BundleTest.php @@ -377,8 +377,8 @@ public function testIsRowValid() { $this->entityModel->expects($this->any())->method('getRowScope')->will($this->returnValue(-1)); $rowData = [ - 'price_type' => 'fixed', - 'price_view' => 'bundle_price_view' + 'bundle_price_type' => 'dynamic', + 'bundle_price_view' => 'bundle_price_view' ]; $this->assertEquals($this->bundle->isRowValid($rowData, 0), true); } diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product/Type/AbstractType.php b/app/code/Magento/CatalogImportExport/Model/Import/Product/Type/AbstractType.php index 927411629c942..3107396c561ad 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product/Type/AbstractType.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product/Type/AbstractType.php @@ -418,10 +418,9 @@ public function isRowValid(array $rowData, $rowNum, $isNewProduct = true) { $error = false; $rowScope = $this->_entityModel->getRowScope($rowData); - if ((\Magento\CatalogImportExport\Model\Import\Product::SCOPE_NULL != $rowScope) && - !empty($rowData[\Magento\CatalogImportExport\Model\Import\Product::COL_SKU])) { - - + if (\Magento\CatalogImportExport\Model\Import\Product::SCOPE_NULL != $rowScope + && !empty($rowData[\Magento\CatalogImportExport\Model\Import\Product::COL_SKU]) + ) { foreach ($this->_getProductAttributes($rowData) as $attrCode => $attrParams) { // check value for non-empty in the case of required attribute? if (isset($rowData[$attrCode]) && strlen($rowData[$attrCode])) { @@ -437,9 +436,7 @@ public function isRowValid(array $rowData, $rowNum, $isNewProduct = true) )) ) { $this->_entityModel->addRowError( - // @codingStandardsIgnoreStart - \Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface::ERROR_VALUE_IS_REQUIRED, - // @codingStandardsIgnoreEnd + RowValidatorInterface::ERROR_VALUE_IS_REQUIRED, $rowNum, $attrCode ); diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product/Validator.php b/app/code/Magento/CatalogImportExport/Model/Import/Product/Validator.php index cee5e53e97978..961e5c2d3a1ca 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product/Validator.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product/Validator.php @@ -104,6 +104,8 @@ public function isRequiredAttributeValid($attrCode, array $attributeParams, arra $doCheck = false; if ($attrCode == Product::COL_SKU) { $doCheck = true; + } elseif ($attrCode == 'price') { + $doCheck = false; } elseif ($attributeParams['is_required'] && $this->getRowScope($rowData) == Product::SCOPE_DEFAULT && $this->context->getBehavior() != \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE ) { @@ -124,7 +126,9 @@ public function isRequiredAttributeValid($attrCode, array $attributeParams, arra public function isAttributeValid($attrCode, array $attrParams, array $rowData) { $this->_rowData = $rowData; - if (!empty($attrParams['apply_to']) && !in_array($rowData['product_type'], $attrParams['apply_to'])) { + if (isset($rowData['product_type']) && !empty($attrParams['apply_to']) + && !in_array($rowData['product_type'], $attrParams['apply_to']) + ) { return true; } diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/ValidatorTest.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/ValidatorTest.php index b7fd1e3604b67..acbbfe7e37023 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/ValidatorTest.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/ValidatorTest.php @@ -147,6 +147,13 @@ public function attributeValidationProvider() ['product_type' => 'any', 'attribute_code' => '1'], true ], + [ + Import::BEHAVIOR_APPEND, + ['is_required' => true, 'type' => 'decimal'], + ['product_type' => 'any', 'price' => ''], + true, + 'price' + ], [ Import::BEHAVIOR_APPEND, ['is_required' => true, 'type' => 'boolean', 'options' => ['yes' => 0, 'no' => 1]], diff --git a/app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php b/app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php index 7ea2507330d85..097557ec11705 100644 --- a/app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php +++ b/app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php @@ -802,6 +802,7 @@ public function isRowValid(array $rowData, $rowNum, $isNewProduct = true) $error = false; $dataWithExtraVirtualRows = $this->_parseVariations($rowData); $skus = []; + $rowData['price'] = isset($rowData['price']) && $rowData['price'] ? $rowData['price'] : '0.00'; if (!empty($dataWithExtraVirtualRows)) { array_unshift($dataWithExtraVirtualRows, $rowData); } else { diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/Validator/Plugin.php b/app/code/Magento/ConfigurableProduct/Model/Product/Validator/Plugin.php index 784366aa2a299..6deefd22e723c 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Product/Validator/Plugin.php +++ b/app/code/Magento/ConfigurableProduct/Model/Product/Validator/Plugin.php @@ -65,6 +65,9 @@ public function aroundValidate( \Magento\Framework\App\RequestInterface $request, \Magento\Framework\DataObject $response ) { + if ($request->has('attributes')) { + $product->setTypeId(\Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE); + } $result = $proceed($product, $request, $response); $variationProducts = (array)$request->getPost('variations-matrix'); if ($variationProducts) { diff --git a/app/code/Magento/ImportExport/Model/Export/Adapter/AbstractAdapter.php b/app/code/Magento/ImportExport/Model/Export/Adapter/AbstractAdapter.php index 4e1087fb6aa9f..597f590db8562 100644 --- a/app/code/Magento/ImportExport/Model/Export/Adapter/AbstractAdapter.php +++ b/app/code/Magento/ImportExport/Model/Export/Adapter/AbstractAdapter.php @@ -6,7 +6,7 @@ namespace Magento\ImportExport\Model\Export\Adapter; use Magento\Framework\Filesystem; -use Magento\Framework\Filesystem\DirectoryList; +use Magento\Framework\App\Filesystem\DirectoryList; /** * Abstract adapter model @@ -45,7 +45,7 @@ abstract class AbstractAdapter public function __construct( \Magento\Framework\Filesystem $filesystem, $destination = null, - $destinationDirectoryCode = DirectoryList::SYS_TMP + $destinationDirectoryCode = DirectoryList::VAR_DIR ) { $this->_directoryHandle = $filesystem->getDirectoryWrite($destinationDirectoryCode); if (!$destination) { From 360a094a50d9f2f55ea2e0d4cec97c035ff740d0 Mon Sep 17 00:00:00 2001 From: Alex Bomko Date: Tue, 3 Nov 2015 22:12:49 +0200 Subject: [PATCH 14/18] MAGETWO-44959: Bundle product: Dynamic Weight is available for input --- .../catalog/product/edit/tab/attributes/extend.phtml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/catalog/product/edit/tab/attributes/extend.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/catalog/product/edit/tab/attributes/extend.phtml index 2e38aae3d998d..ca26cfb192d4a 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/catalog/product/edit/tab/attributes/extend.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/catalog/product/edit/tab/attributes/extend.phtml @@ -61,7 +61,9 @@ $isElementReadonly = $block->getElement() && !$block->getProduct()->isObjectNew())) { ?> $('').observe('change', _change); - _change(); + Event.observe(window, 'load', function(){ + _change(); + }); }); From 908a67cc574e669e301c78fa8bb966c2b6cc67e8 Mon Sep 17 00:00:00 2001 From: Igor Miniailo Date: Tue, 3 Nov 2015 22:15:13 +0200 Subject: [PATCH 15/18] Fixed MAGETWO-44938: Products aren't shown on frontend --- .../Magento/Framework/Config/FileResolver.php | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/lib/internal/Magento/Framework/Config/FileResolver.php b/lib/internal/Magento/Framework/Config/FileResolver.php index a919ad5b5f406..c758370ccb1d4 100644 --- a/lib/internal/Magento/Framework/Config/FileResolver.php +++ b/lib/internal/Magento/Framework/Config/FileResolver.php @@ -96,21 +96,22 @@ public function get($filename, $scope) $themeConfigFile ) ); - } - $designPath = - $this->componentRegistrar->getPath( - ComponentRegistrar::THEME, - $this->area . '/' . $this->themePath - ) . '/etc/view.xml'; - if (file_exists($designPath)) { - try { - $designDom = new \DOMDocument; - $designDom->load($designPath); - $iterator[$designPath] = $designDom->saveXML(); - } catch (\Exception $e) { - throw new \Magento\Framework\Exception\LocalizedException( - new \Magento\Framework\Phrase('Could not read config file') - ); + } else { + $designPath = + $this->componentRegistrar->getPath( + ComponentRegistrar::THEME, + $this->area . '/' . $this->themePath + ) . '/etc/view.xml'; + if (file_exists($designPath)) { + try { + $designDom = new \DOMDocument; + $designDom->load($designPath); + $iterator[$designPath] = $designDom->saveXML(); + } catch (\Exception $e) { + throw new \Magento\Framework\Exception\LocalizedException( + new \Magento\Framework\Phrase('Could not read config file') + ); + } } } break; From f402fd779ca5695ea12109af4bb1591621c23a70 Mon Sep 17 00:00:00 2001 From: Michail Slabko Date: Tue, 3 Nov 2015 22:22:00 +0200 Subject: [PATCH 16/18] MAGETWO-44964: 404 error for specific url --- lib/internal/Magento/Framework/App/Router/ActionList.php | 9 ++++++--- .../Framework/App/Test/Unit/Router/ActionListTest.php | 8 -------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/lib/internal/Magento/Framework/App/Router/ActionList.php b/lib/internal/Magento/Framework/App/Router/ActionList.php index dd561b99d7468..62354004853cd 100644 --- a/lib/internal/Magento/Framework/App/Router/ActionList.php +++ b/lib/internal/Magento/Framework/App/Router/ActionList.php @@ -80,9 +80,12 @@ public function get($module, $area, $namespace, $action) if (in_array(strtolower($action), $this->reservedWords)) { $action .= 'action'; } - $fullPath = strtolower( - str_replace('_', '\\', $module) . '\\controller' . $area - . '\\' . str_replace('_', '\\', $namespace) . '\\' . $action + $fullPath = str_replace( + '_', + '\\', + strtolower( + $module . '\\controller' . $area . '\\' . $namespace . '\\' . $action + ) ); if (isset($this->actions[$fullPath])) { return is_subclass_of($this->actions[$fullPath], $this->actionInterface) ? $this->actions[$fullPath] : null; diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Router/ActionListTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Router/ActionListTest.php index 3502e17fbe674..a286d0fc577b5 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Router/ActionListTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Router/ActionListTest.php @@ -142,14 +142,6 @@ public function getDataProvider() ['magento\module\controller\area\namespace\catchaction' => $mockClassName], $actionClass ], - [ - 'Magento_Module', - 'Area', - 'Namespace_A', - 'Index_edit', - ['magento\module\controller\area\namespace\a\index_edit' => $mockClassName], - $actionClass - ], [ 'Magento_Module', 'Area', From ebfec114323c3fc384f28337f00ee67fe87b9f90 Mon Sep 17 00:00:00 2001 From: Igor Miniailo Date: Tue, 3 Nov 2015 22:23:19 +0200 Subject: [PATCH 17/18] Fixed MAGETWO-44938: Products aren't shown on frontend --- .../Magento/Theme/Model/View/DesignTest.php | 28 ++----------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/View/DesignTest.php b/dev/tests/integration/testsuite/Magento/Theme/Model/View/DesignTest.php index 9341880ef175a..0f4262953b9ec 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/View/DesignTest.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/View/DesignTest.php @@ -174,31 +174,9 @@ public function getFilenameDataProvider() public function testGetViewConfig() { $this->_emulateFixtureTheme(); - /** @var $theme \Magento\Framework\View\Design\ThemeInterface */ - $theme = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Framework\View\DesignInterface' - )->getDesignTheme(); - $customConfigFile = $theme->getCustomization()->getCustomViewConfigPath(); - /** @var $filesystem \Magento\Framework\Filesystem */ - $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Framework\Filesystem'); - $directory = $filesystem->getDirectoryWrite(DirectoryList::ROOT); - $relativePath = $directory->getRelativePath($customConfigFile); - try { - $directory->writeFile( - $relativePath, - ' - var value' - ); - - $config = $this->_viewConfig->getViewConfig(); - $this->assertInstanceOf('Magento\Framework\Config\View', $config); - $this->assertEquals('var value', $config->getVarValue('Namespace_Module', 'var')); - } catch (\Exception $e) { - $directory->delete($relativePath); - throw $e; - } - $directory->delete($relativePath); + $config = $this->_viewConfig->getViewConfig(); + $this->assertInstanceOf('Magento\Framework\Config\View', $config); + $this->assertEquals(['var1' => 'value1', 'var2' => 'value2'], $config->getVars('Namespace_Module')); } /** From dddd5b1dda81f5efe36e6fd61243ee3f4079fbbc Mon Sep 17 00:00:00 2001 From: Alex Bomko Date: Wed, 4 Nov 2015 00:43:16 +0200 Subject: [PATCH 18/18] MAGETWO-44953: Can't import configurable products --- .../Test/Unit/Model/Import/Product/ValidatorTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/ValidatorTest.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/ValidatorTest.php index acbbfe7e37023..104db2207b139 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/ValidatorTest.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/ValidatorTest.php @@ -98,6 +98,7 @@ public function testAttributeValidation($behavior, $attrParams, $rowData, $isVal /** * @return array + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function attributeValidationProvider() {