From f8ae8e24df096a17a3aa86667b163c8f4689a4d7 Mon Sep 17 00:00:00 2001 From: RomanKis Date: Tue, 13 Mar 2018 11:44:35 +0200 Subject: [PATCH 1/5] MSI: 654: Exception when trying to create Grouped or Bundle product in admin --- .../Modifier/InventoryConfigurablePanel.php | 36 ++++++++++++++++--- .../etc/adminhtml/di.xml | 5 +++ .../InventoryConfigurableProduct/etc/di.xml | 2 +- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/InventoryConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/InventoryConfigurablePanel.php b/app/code/Magento/InventoryConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/InventoryConfigurablePanel.php index 09de0cdf805d..2f5d9e12b481 100644 --- a/app/code/Magento/InventoryConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/InventoryConfigurablePanel.php +++ b/app/code/Magento/InventoryConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/InventoryConfigurablePanel.php @@ -7,6 +7,8 @@ namespace Magento\InventoryConfigurableProduct\Ui\DataProvider\Product\Form\Modifier; +use Magento\Catalog\Model\Locator\LocatorInterface; +use Magento\Catalog\Ui\AllowedProductTypes; use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier; use Magento\ConfigurableProduct\Ui\DataProvider\Product\Form\Modifier\ConfigurablePanel; use Magento\Ui\Component\Form; @@ -19,6 +21,28 @@ class InventoryConfigurablePanel extends AbstractModifier const RECORD = 'record'; const QUANTITY_CONTAINER = 'quantity_container'; + /** + * @var LocatorInterface + */ + private $locator; + + /** + * @var AllowedProductTypes + */ + private $allowedProductTypes; + + /** + * @param LocatorInterface $locator + * @param AllowedProductTypes $allowedProductTypes + */ + public function __construct( + LocatorInterface $locator, + AllowedProductTypes $allowedProductTypes + ) { + $this->locator = $locator; + $this->allowedProductTypes = $allowedProductTypes; + } + /** * @inheritdoc */ @@ -55,10 +79,14 @@ private function getQuantityContainerConfig(): array */ public function modifyMeta(array $meta) { - $children = 'children'; - $meta[ConfigurablePanel::GROUP_CONFIGURABLE][$children] - [ConfigurablePanel::CONFIGURABLE_MATRIX][$children] - [static::RECORD][$children][static::QUANTITY_CONTAINER] = $this->getQuantityContainerConfig(); + if ($this->allowedProductTypes->isAllowedProductType($this->locator->getProduct())) { + $matrix = $meta[ConfigurablePanel::GROUP_CONFIGURABLE]['children'][ConfigurablePanel::CONFIGURABLE_MATRIX]; + + $matrix['children'][static::RECORD]['children'][static::QUANTITY_CONTAINER] + = $this->getQuantityContainerConfig(); + + $meta[ConfigurablePanel::GROUP_CONFIGURABLE]['children'][ConfigurablePanel::CONFIGURABLE_MATRIX] = $matrix; + } return $meta; } diff --git a/app/code/Magento/InventoryConfigurableProduct/etc/adminhtml/di.xml b/app/code/Magento/InventoryConfigurableProduct/etc/adminhtml/di.xml index ad8566fc1f18..3a3f6a926f7a 100644 --- a/app/code/Magento/InventoryConfigurableProduct/etc/adminhtml/di.xml +++ b/app/code/Magento/InventoryConfigurableProduct/etc/adminhtml/di.xml @@ -16,4 +16,9 @@ + + + Magento\Catalog\Ui\BaseAllowedProductTypes + + diff --git a/app/code/Magento/InventoryConfigurableProduct/etc/di.xml b/app/code/Magento/InventoryConfigurableProduct/etc/di.xml index abcce17e5cca..2d993cf4d0fd 100644 --- a/app/code/Magento/InventoryConfigurableProduct/etc/di.xml +++ b/app/code/Magento/InventoryConfigurableProduct/etc/di.xml @@ -13,4 +13,4 @@ - \ No newline at end of file + From dafba752513c35779ca53d769342d19b67c0d742 Mon Sep 17 00:00:00 2001 From: RomanKis Date: Wed, 14 Mar 2018 12:10:10 +0200 Subject: [PATCH 2/5] MSI: 654: Exception when trying to create Grouped or Bundle product in admin --- .../Product/Form/Modifier/InventoryConfigurablePanel.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/code/Magento/InventoryConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/InventoryConfigurablePanel.php b/app/code/Magento/InventoryConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/InventoryConfigurablePanel.php index 2f5d9e12b481..1b26f90e22a3 100644 --- a/app/code/Magento/InventoryConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/InventoryConfigurablePanel.php +++ b/app/code/Magento/InventoryConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/InventoryConfigurablePanel.php @@ -18,9 +18,6 @@ */ class InventoryConfigurablePanel extends AbstractModifier { - const RECORD = 'record'; - const QUANTITY_CONTAINER = 'quantity_container'; - /** * @var LocatorInterface */ @@ -82,8 +79,7 @@ public function modifyMeta(array $meta) if ($this->allowedProductTypes->isAllowedProductType($this->locator->getProduct())) { $matrix = $meta[ConfigurablePanel::GROUP_CONFIGURABLE]['children'][ConfigurablePanel::CONFIGURABLE_MATRIX]; - $matrix['children'][static::RECORD]['children'][static::QUANTITY_CONTAINER] - = $this->getQuantityContainerConfig(); + $matrix['children']['record']['children']['quantity_container'] = $this->getQuantityContainerConfig(); $meta[ConfigurablePanel::GROUP_CONFIGURABLE]['children'][ConfigurablePanel::CONFIGURABLE_MATRIX] = $matrix; } From 164ba27ceb6c78d9d95723beef816b1e3baec8ec Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky Date: Wed, 14 Mar 2018 17:13:55 +0200 Subject: [PATCH 3/5] MSI: 654: Exception when trying to create Grouped or Bundle product in admin --- .../Modifier/InventoryConfigurablePanel.php | 34 ++----------------- .../etc/adminhtml/di.xml | 12 ++----- 2 files changed, 5 insertions(+), 41 deletions(-) diff --git a/app/code/Magento/InventoryConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/InventoryConfigurablePanel.php b/app/code/Magento/InventoryConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/InventoryConfigurablePanel.php index 1b26f90e22a3..edff0d47aecc 100644 --- a/app/code/Magento/InventoryConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/InventoryConfigurablePanel.php +++ b/app/code/Magento/InventoryConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/InventoryConfigurablePanel.php @@ -7,8 +7,6 @@ namespace Magento\InventoryConfigurableProduct\Ui\DataProvider\Product\Form\Modifier; -use Magento\Catalog\Model\Locator\LocatorInterface; -use Magento\Catalog\Ui\AllowedProductTypes; use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier; use Magento\ConfigurableProduct\Ui\DataProvider\Product\Form\Modifier\ConfigurablePanel; use Magento\Ui\Component\Form; @@ -18,28 +16,6 @@ */ class InventoryConfigurablePanel extends AbstractModifier { - /** - * @var LocatorInterface - */ - private $locator; - - /** - * @var AllowedProductTypes - */ - private $allowedProductTypes; - - /** - * @param LocatorInterface $locator - * @param AllowedProductTypes $allowedProductTypes - */ - public function __construct( - LocatorInterface $locator, - AllowedProductTypes $allowedProductTypes - ) { - $this->locator = $locator; - $this->allowedProductTypes = $allowedProductTypes; - } - /** * @inheritdoc */ @@ -76,13 +52,9 @@ private function getQuantityContainerConfig(): array */ public function modifyMeta(array $meta) { - if ($this->allowedProductTypes->isAllowedProductType($this->locator->getProduct())) { - $matrix = $meta[ConfigurablePanel::GROUP_CONFIGURABLE]['children'][ConfigurablePanel::CONFIGURABLE_MATRIX]; - - $matrix['children']['record']['children']['quantity_container'] = $this->getQuantityContainerConfig(); - - $meta[ConfigurablePanel::GROUP_CONFIGURABLE]['children'][ConfigurablePanel::CONFIGURABLE_MATRIX] = $matrix; - } + $matrix = $meta[ConfigurablePanel::GROUP_CONFIGURABLE]['children'][ConfigurablePanel::CONFIGURABLE_MATRIX]; + $matrix['children']['record']['children']['quantity_container'] = $this->getQuantityContainerConfig(); + $meta[ConfigurablePanel::GROUP_CONFIGURABLE]['children'][ConfigurablePanel::CONFIGURABLE_MATRIX] = $matrix; return $meta; } diff --git a/app/code/Magento/InventoryConfigurableProduct/etc/adminhtml/di.xml b/app/code/Magento/InventoryConfigurableProduct/etc/adminhtml/di.xml index 3a3f6a926f7a..21dc1bca1640 100644 --- a/app/code/Magento/InventoryConfigurableProduct/etc/adminhtml/di.xml +++ b/app/code/Magento/InventoryConfigurableProduct/etc/adminhtml/di.xml @@ -6,19 +6,11 @@ */ --> - + - - Magento\InventoryConfigurableProduct\Ui\DataProvider\Product\Form\Modifier\InventoryConfigurablePanel - 200 - + Magento\InventoryConfigurableProduct\Ui\DataProvider\Product\Form\Modifier\InventoryConfigurablePanel - - - - Magento\Catalog\Ui\BaseAllowedProductTypes - From 77ff4b2b833bbc68a79dc49fa7cfa819f95b095b Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky Date: Thu, 15 Mar 2018 13:13:08 +0200 Subject: [PATCH 4/5] MSI: 654: Exception when trying to create Grouped or Bundle product in admin --- app/code/Magento/InventoryConfigurableProduct/etc/module.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/InventoryConfigurableProduct/etc/module.xml b/app/code/Magento/InventoryConfigurableProduct/etc/module.xml index e87b1b1c932b..676939d699fc 100644 --- a/app/code/Magento/InventoryConfigurableProduct/etc/module.xml +++ b/app/code/Magento/InventoryConfigurableProduct/etc/module.xml @@ -7,4 +7,7 @@ --> + + + From 707d1f9ba57a32e7d926218f93e800c2afd50262 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Thu, 15 Mar 2018 15:18:48 +0200 Subject: [PATCH 5/5] MSI-654: Exception when trying to create Grouped or Bundle product in admin --- app/code/Magento/InventoryConfigurableProduct/etc/di.xml | 1 - .../Magento/InventoryConfigurableProduct/etc/module.xml | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/InventoryConfigurableProduct/etc/di.xml b/app/code/Magento/InventoryConfigurableProduct/etc/di.xml index f77c7e46dafb..e7fd2eace039 100644 --- a/app/code/Magento/InventoryConfigurableProduct/etc/di.xml +++ b/app/code/Magento/InventoryConfigurableProduct/etc/di.xml @@ -13,7 +13,6 @@ - diff --git a/app/code/Magento/InventoryConfigurableProduct/etc/module.xml b/app/code/Magento/InventoryConfigurableProduct/etc/module.xml index 676939d699fc..f0a724e9d271 100644 --- a/app/code/Magento/InventoryConfigurableProduct/etc/module.xml +++ b/app/code/Magento/InventoryConfigurableProduct/etc/module.xml @@ -6,8 +6,9 @@ */ --> - - - - + + + + +