From 715d31e4e0507c34fcf91a2c64d9d306e76f070d Mon Sep 17 00:00:00 2001 From: Tommy Quissens Date: Thu, 5 Apr 2018 11:31:02 +0200 Subject: [PATCH 1/3] made attributes nillable so we can reset parent settings --- lib/internal/Magento/Framework/Config/etc/view.xsd | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/internal/Magento/Framework/Config/etc/view.xsd b/lib/internal/Magento/Framework/Config/etc/view.xsd index ed62520b86caf..0e3e3b5f32808 100644 --- a/lib/internal/Magento/Framework/Config/etc/view.xsd +++ b/lib/internal/Magento/Framework/Config/etc/view.xsd @@ -49,12 +49,12 @@ - - - - - - + + + + + + From 9c0d84f3819dbbd2d5669abb4477b52feb2b52ec Mon Sep 17 00:00:00 2001 From: Tommy Quissens Date: Thu, 5 Apr 2018 12:45:28 +0200 Subject: [PATCH 2/3] parse nil values correctly --- app/code/Magento/Catalog/Model/ImageExtractor.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/ImageExtractor.php b/app/code/Magento/Catalog/Model/ImageExtractor.php index 7888d8de1c2ff..07a4a8fe9f700 100644 --- a/app/code/Magento/Catalog/Model/ImageExtractor.php +++ b/app/code/Magento/Catalog/Model/ImageExtractor.php @@ -35,7 +35,11 @@ public function process(\DOMElement $mediaNode, $mediaParentTag) if ($attributeTagName === 'background') { $nodeValue = $this->processImageBackground($attribute->nodeValue); } elseif ($attributeTagName === 'width' || $attributeTagName === 'height') { - $nodeValue = intval($attribute->nodeValue); + if ((bool)$attribute->getAttribute('xsi:nil') !== true) { + $nodeValue = intval($attribute->nodeValue); + } else { + $nodeValue = null; + } } else { $nodeValue = $attribute->nodeValue; } From fa03c607d4465d75f814da04dc688873d5319de5 Mon Sep 17 00:00:00 2001 From: Tommy Quissens Date: Tue, 19 Jun 2018 15:23:15 +0200 Subject: [PATCH 3/3] made more attributes nillable --- app/code/Magento/Catalog/Model/ImageExtractor.php | 14 +++++++------- lib/internal/Magento/Framework/Config/etc/view.xsd | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ImageExtractor.php b/app/code/Magento/Catalog/Model/ImageExtractor.php index 07a4a8fe9f700..1c20608670672 100644 --- a/app/code/Magento/Catalog/Model/ImageExtractor.php +++ b/app/code/Magento/Catalog/Model/ImageExtractor.php @@ -32,16 +32,16 @@ public function process(\DOMElement $mediaNode, $mediaParentTag) continue; } $attributeTagName = $attribute->tagName; - if ($attributeTagName === 'background') { - $nodeValue = $this->processImageBackground($attribute->nodeValue); - } elseif ($attributeTagName === 'width' || $attributeTagName === 'height') { - if ((bool)$attribute->getAttribute('xsi:nil') !== true) { - $nodeValue = intval($attribute->nodeValue); + if ((bool)$attribute->getAttribute('xsi:nil') !== true) { + if ($attributeTagName === 'background') { + $nodeValue = $this->processImageBackground($attribute->nodeValue); + } elseif ($attributeTagName === 'width' || $attributeTagName === 'height') { + $nodeValue = intval($attribute->nodeValue); } else { - $nodeValue = null; + $nodeValue = $attribute->nodeValue; } } else { - $nodeValue = $attribute->nodeValue; + $nodeValue = null; } $result[$mediaParentTag][$moduleNameImage][Image::MEDIA_TYPE_CONFIG_NODE][$imageId][$attribute->tagName] = $nodeValue; diff --git a/lib/internal/Magento/Framework/Config/etc/view.xsd b/lib/internal/Magento/Framework/Config/etc/view.xsd index 0e3e3b5f32808..b8d685ac11acd 100644 --- a/lib/internal/Magento/Framework/Config/etc/view.xsd +++ b/lib/internal/Magento/Framework/Config/etc/view.xsd @@ -55,7 +55,7 @@ - +