Skip to content

Commit

Permalink
Merge pull request #4941 from magento-tsg/2.3-develop-pr78
Browse files Browse the repository at this point in the history
[TSG] Fixes for 2.3 (pr78) (2.3-develop)
  • Loading branch information
zakdma authored Oct 30, 2019
2 parents 23bd4d6 + 0d6b2a0 commit 6f1c7e3
Show file tree
Hide file tree
Showing 16 changed files with 102 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ public function modifyMeta(array $meta)

$this->specialPriceDataToInline();
$this->customizeTierPrice();
$this->customizePrice();

if (isset($this->meta['advanced-pricing'])) {
$this->addAdvancedPriceLink();
Expand Down Expand Up @@ -197,6 +198,29 @@ protected function preparePriceFields($fieldCode)
return $this;
}

/**
* Customize price field.
*
* @return $this
*/
private function customizePrice(): AdvancedPricing
{
$pathFrom = $this->arrayManager->findPath('price', $this->meta, null, 'children');

if ($pathFrom) {
$this->meta = $this->arrayManager->merge(
$this->arrayManager->slicePath($pathFrom, 0, -2) . '/arguments/data/config',
$this->meta,
[
'label' => false,
'required' => false,
]
);
}

return $this;
}

/**
* Customize tier price field
*
Expand Down Expand Up @@ -573,21 +597,21 @@ private function specialPriceDataToInline()
$this->arrayManager->slicePath($pathFrom, 0, -2) . '/arguments/data/config',
$this->meta,
[
'label' => __('Special Price From'),
'label' => false,
'required' => false,
'additionalClasses' => 'admin__control-grouped-date',
'breakLine' => false,
'component' => 'Magento_Ui/js/form/components/group',
'scopeLabel' =>
$this->arrayManager->get($pathFrom . '/arguments/data/config/scopeLabel', $this->meta),
]
);
$this->meta = $this->arrayManager->merge(
$pathFrom . '/arguments/data/config',
$this->meta,
[
'label' => __('Special Price From'),
'scopeLabel' => null,
'additionalClasses' => 'admin__field-date'
'scopeLabel' =>
$this->arrayManager->get($pathFrom . '/arguments/data/config/scopeLabel', $this->meta),
'additionalClasses' => 'admin__field-date',
]
);
$this->meta = $this->arrayManager->merge(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,14 @@ protected function customizeCategoriesField(array $meta)
'arguments' => [
'data' => [
'config' => [
'label' => __('Categories'),
'label' => false,
'required' => false,
'dataScope' => '',
'breakLine' => false,
'formElement' => 'container',
'componentType' => 'container',
'component' => 'Magento_Ui/js/form/components/group',
'scopeLabel' => __('[GLOBAL]'),
'disabled' => $this->locator->getProduct()->isLockedAttribute($fieldCode),
],
],
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,9 @@ public function setupAttributeContainerMeta(ProductAttributeInterface $attribute
'arguments/data/config',
$containerMeta,
[
'component' => 'Magento_Ui/js/form/components/group'
'component' => 'Magento_Ui/js/form/components/group',
'label' => false,
'required' => false,
]
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ protected function customizeWeightField(array $meta)
'validate-zero-or-greater' => true
],
'additionalClasses' => 'admin__field-small',
'sortOrder' => 0,
'addafter' => $this->locator->getStore()->getConfig('general/locale/weight_unit'),
'imports' => $disabled ? [] : [
'disabled' => '!${$.provider}:' . self::DATA_SCOPE_PRODUCT
Expand All @@ -242,6 +243,8 @@ protected function customizeWeightField(array $meta)
$containerPath . static::META_CONFIG_PATH,
$meta,
[
'label' => false,
'required' => false,
'component' => 'Magento_Ui/js/form/components/group',
]
);
Expand Down Expand Up @@ -269,6 +272,7 @@ protected function customizeWeightField(array $meta)
],
],
'value' => (int)$this->locator->getProduct()->getTypeInstance()->hasWeight(),
'sortOrder' => 10,
'disabled' => $disabled,
]
);
Expand Down Expand Up @@ -317,7 +321,8 @@ protected function customizeNewDateRangeField(array $meta)
$fromContainerPath . self::META_CONFIG_PATH,
$meta,
[
'label' => __('Set Product as New From'),
'label' => false,
'required' => false,
'additionalClasses' => 'admin__control-grouped-date',
'breakLine' => false,
'component' => 'Magento_Ui/js/form/components/group',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public function __construct(ArrayManager $arrayManager)
}

/**
* {@inheritdoc}
* @inheritdoc
*
* @since 101.0.0
*/
public function modifyMeta(array $meta)
Expand All @@ -47,7 +48,8 @@ public function modifyMeta(array $meta)
}

/**
* {@inheritdoc}
* @inheritdoc
*
* @since 101.0.0
*/
public function modifyData(array $data)
Expand Down Expand Up @@ -96,7 +98,8 @@ protected function customizeDateRangeField(array $meta)
$fromContainerPath . self::META_CONFIG_PATH,
$meta,
[
'label' => __('Schedule Update From'),
'label' => false,
'required' => false,
'additionalClasses' => 'admin__control-grouped-date',
'breakLine' => false,
'component' => 'Magento_Ui/js/form/components/group',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ private function getUpdatedTierPriceStructure(array $priceMeta)
'dataType' => Price::NAME,
'component' => 'Magento_Ui/js/form/components/group',
'label' => __('Price'),
'enableLabel' => true,
'showLabel' => false,
'dataScope' => '',
'additionalClasses' => 'control-grouped',
'sortOrder' => isset($priceMeta['arguments']['data']['config']['sortOrder'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -528,10 +528,7 @@
<item name="type" xsi:type="string">group</item>
<item name="config" xsi:type="array">
<item name="additionalClasses" xsi:type="string">admin__control-grouped-date</item>
<item name="label" xsi:type="string" translate="true">Schedule Update From</item>
<item name="required" xsi:type="boolean">false</item>
<item name="breakLine" xsi:type="boolean">false</item>
<item name="scopeLabel" xsi:type="string">[STORE VIEW]</item>
</item>
</argument>
<field name="custom_design_from" sortOrder="230" formElement="date">
Expand All @@ -541,6 +538,7 @@
</additionalClasses>
<dataType>string</dataType>
<label translate="true">Schedule Update From</label>
<scopeLabel>[STORE VIEW]</scopeLabel>
</settings>
</field>
<field name="custom_design_to" sortOrder="240" formElement="date">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public function modifyMeta(array $meta)
}

/**
* Prepare Meta
* Modify UI Quantity and Stock status attribute meta.
*
* @return void
*/
Expand All @@ -187,10 +187,6 @@ 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);

$this->meta = $this->arrayManager->merge(
Expand Down Expand Up @@ -218,10 +214,9 @@ private function prepareMeta()
'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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="formElement" xsi:type="string">container</item>
<item name="label" xsi:type="string" translate="true">Manage Stock</item>
<item name="dataScope" xsi:type="string">stock_data</item>
<item name="scopeLabel" xsi:type="string">[GLOBAL]</item>
</item>
</argument>
<field name="manage_stock" formElement="select">
Expand Down Expand Up @@ -117,9 +115,7 @@
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="formElement" xsi:type="string">container</item>
<item name="label" xsi:type="string" translate="true">Out-of-Stock Threshold</item>
<item name="dataScope" xsi:type="string">stock_data</item>
<item name="scopeLabel" xsi:type="string">[GLOBAL]</item>
<item name="imports" xsi:type="array">
<item name="visible" xsi:type="string">${$.provider}:data.product.stock_data.manage_stock</item>
</item>
Expand Down Expand Up @@ -290,9 +286,7 @@
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="formElement" xsi:type="string">container</item>
<item name="label" xsi:type="string" translate="true">Maximum Qty Allowed in Shopping Cart</item>
<item name="dataScope" xsi:type="string">stock_data</item>
<item name="scopeLabel" xsi:type="string">[GLOBAL]</item>
</item>
</argument>
<field name="max_sale_qty" formElement="input">
Expand Down Expand Up @@ -396,9 +390,7 @@
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="formElement" xsi:type="string">container</item>
<item name="label" xsi:type="string" translate="true">Backorders</item>
<item name="dataScope" xsi:type="string">stock_data</item>
<item name="scopeLabel" xsi:type="string">[GLOBAL]</item>
<item name="imports" xsi:type="array">
<item name="visible" xsi:type="string">${$.provider}:data.product.stock_data.manage_stock</item>
</item>
Expand Down Expand Up @@ -465,9 +457,7 @@
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="formElement" xsi:type="string">container</item>
<item name="label" xsi:type="string" translate="true">Notify for Quantity Below</item>
<item name="dataScope" xsi:type="string">stock_data</item>
<item name="scopeLabel" xsi:type="string">[GLOBAL]</item>
<item name="imports" xsi:type="array">
<item name="visible" xsi:type="string">${$.provider}:data.product.stock_data.manage_stock</item>
</item>
Expand Down Expand Up @@ -526,9 +516,7 @@
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="formElement" xsi:type="string">container</item>
<item name="label" xsi:type="string" translate="true">Enable Qty Increments</item>
<item name="dataScope" xsi:type="string">stock_data</item>
<item name="scopeLabel" xsi:type="string">[GLOBAL]</item>
</item>
</argument>
<field name="enable_qty_increments" formElement="select">
Expand Down Expand Up @@ -589,9 +577,7 @@
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="formElement" xsi:type="string">container</item>
<item name="label" xsi:type="string" translate="true">Qty Increments</item>
<item name="dataScope" xsi:type="string">stock_data</item>
<item name="scopeLabel" xsi:type="string">[GLOBAL]</item>
<item name="imports" xsi:type="array">
<item name="visible" xsi:type="string">${$.provider}:data.product.stock_data.enable_qty_increments</item>
</item>
Expand Down Expand Up @@ -654,9 +640,7 @@
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="formElement" xsi:type="string">container</item>
<item name="label" xsi:type="string" translate="true">Stock Status</item>
<item name="dataScope" xsi:type="string">quantity_and_stock_status</item>
<item name="scopeLabel" xsi:type="string">[GLOBAL]</item>
<item name="imports" xsi:type="array">
<item name="visible" xsi:type="string">${$.provider}:data.product.stock_data.manage_stock</item>
</item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function __construct(
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function modifyMeta(array $meta)
{
Expand All @@ -65,7 +65,7 @@ public function modifyMeta(array $meta)
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function modifyData(array $data)
{
Expand Down Expand Up @@ -95,16 +95,21 @@ protected function addUrlRewriteCheckbox(array $meta)
ScopeInterface::SCOPE_STORE,
$this->locator->getProduct()->getStoreId()
);

$meta = $this->arrayManager->merge($containerPath, $meta, [
'arguments' => [
'data' => [
'config' => [
'component' => 'Magento_Ui/js/form/components/group',
$meta = $this->arrayManager->merge(
$containerPath,
$meta,
[
'arguments' => [
'data' => [
'config' => [
'component' => 'Magento_Ui/js/form/components/group',
'label' => false,
'required' => false,
],
],
],
],
]);
]
);

$checkbox['arguments']['data']['config'] = [
'componentType' => Field::NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,6 @@
<argument name="data" xsi:type="array">
<item name="type" xsi:type="string">group</item>
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Group</item>
<item name="required" xsi:type="boolean">true</item>
<item name="dataScope" xsi:type="boolean">false</item>
<item name="validateWholeGroup" xsi:type="boolean">true</item>
</item>
Expand All @@ -166,6 +164,7 @@
</item>
</argument>
<settings>
<required>true</required>
<dataType>number</dataType>
</settings>
</field>
Expand Down
Loading

0 comments on commit 6f1c7e3

Please sign in to comment.