-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSI: 654: Exception when trying to create Grouped or Bundle product in admin #656
Changes from 3 commits
f8ae8e2
dafba75
cd486b5
408a3fa
164ba27
77ff4b2
e48b08f
707d1f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -16,8 +18,27 @@ | |
*/ | ||
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 +76,13 @@ 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())) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to use this code for products different from configurable? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because simple, virtual and downloadable product can be converted to configurable. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After moving |
||
$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; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,9 @@ | |
</argument> | ||
</arguments> | ||
</virtualType> | ||
<type name="Magento\InventoryConfigurableProduct\Ui\DataProvider\Product\Form\Modifier\InventoryConfigurablePanel"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After moving |
||
<arguments> | ||
<argument name="allowedProductTypes" xsi:type="object">Magento\Catalog\Ui\BaseAllowedProductTypes</argument> | ||
</arguments> | ||
</type> | ||
</config> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we need to move this to modifier
<type name="Magento\ConfigurableProduct\Ui\DataProvider\Product\Form\Modifier\Composite">
And remove
AllowedProductTypes
checkThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@naydav done