Skip to content

Commit

Permalink
Merge pull request #6 from JoostWan/master
Browse files Browse the repository at this point in the history
Fixed issue with product edit in backend and wrong config path
  • Loading branch information
peterjaap authored Oct 5, 2021
2 parents d78247a + 53fc2f8 commit fb13158
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper
const NEW_PRODUCT = "new_product";
const MOVEMENT_DATA = "movement_data";
const RESOURCE_ID = "Elgentos_InventoryLog::config";
const CONFIG_ENABLE_PATH = 'inventory_log/general/inventory_enabled';
const CONFIG_ENABLE_PATH = 'cataloginventory/options/inventory_enabled';
/**
* @var string $randomString
*/
Expand Down
29 changes: 15 additions & 14 deletions Ui/DataProvider/Product/Form/Modifier/Editproduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,7 @@ private function prepareMeta()
$pathField = $this->arrayManager->findPath($fieldCode, $this->meta, null, 'children');

if ($pathField) {
$labelField = $this->arrayManager->get(
$this->arrayManager->slicePath($pathField, 0, -2) . '/arguments/data/config/label',
$this->meta
);
$fieldSetPath = $this->arrayManager->slicePath($pathField, 0, -4);

$fieldsetPath = $this->arrayManager->slicePath($pathField, 0, -4);
$this->meta = $this->arrayManager->merge(
$pathField . '/arguments/data/config',
$this->meta,
Expand All @@ -181,6 +176,7 @@ private function prepareMeta()
'scopeLabel' => '[GLOBAL]',
'imports' => [
'visible' => '${$.provider}:data.product.stock_data.manage_stock',
'__disableTmpl' => ['visible' => false],
],
]
);
Expand All @@ -192,23 +188,23 @@ private function prepareMeta()
'scopeLabel' => '[GLOBAL]',
]
);

$container['arguments']['data']['config'] = [
'formElement' => 'container',
'componentType' => 'container',
'component' => "Magento_Ui/js/form/components/group",
'label' => $labelField,
'label' => false,
'breakLine' => false,
'dataScope' => $fieldCode,
'scopeLabel' => '[GLOBAL]',
'source' => 'product_details',
'sortOrder' => (int) $this->arrayManager->get(
$this->arrayManager->slicePath($pathField, 0, -2) . '/arguments/data/config/sortOrder',
$this->meta
) - 1,
$this->arrayManager->slicePath($pathField, 0, -2) . '/arguments/data/config/sortOrder',
$this->meta
) - 1,
'disabled' => $this->locator->getProduct()->isLockedAttribute($fieldCode),
];
$qty['arguments']['data']['config'] = [
'component' => 'Magento_CatalogInventory/js/components/qty-validator-changer',
'group' => 'quantity_and_stock_status_qty',
'dataType' => 'number',
'formElement' => 'input',
'componentType' => 'field',
Expand All @@ -224,8 +220,10 @@ private function prepareMeta()
],
'imports' => [
'handleChanges' => '${$.provider}:data.product.stock_data.is_qty_decimal',
'__disableTmpl' => ['handleChanges' => false],
],
'sortOrder' => 10,
'disabled' => $this->locator->getProduct()->isLockedAttribute($fieldCode),
];
$advancedInventoryButton['arguments']['data']['config'] = [
'displayAsLink' => true,
Expand All @@ -239,13 +237,16 @@ private function prepareMeta()
'actionName' => 'toggleModal',
],
],
'imports' => [
'childError' => 'product_form.product_form.advanced_inventory_modal.stock_data:error',
],
'title' => __('Advanced Inventory'),
'provider' => false,
'additionalForGroup' => true,
'source' => 'product_details',
'sortOrder' => 20,
];

$targetName = 'product_form.product_form.product-details.stockmovementmodel.stock_movement_listing';

if ($this->helper->isModuleEnabled() && $this->helper->isOutputEnabled() && $this->helper->isAllowed()) {
Expand Down Expand Up @@ -305,7 +306,7 @@ private function prepareMeta()
}

$this->meta = $this->arrayManager->merge(
$fieldSetPath . '/children',
$fieldsetPath . '/children',
$this->meta,
['quantity_and_stock_status_qty' => $container]
);
Expand Down

0 comments on commit fb13158

Please sign in to comment.