Skip to content

Commit 1ce1279

Browse files
isxamnikshostko
authored andcommitted
MAGETWO-63054: [Catalog] MSRP field is not displayed for bundle products with fixed price
1 parent d7c7b6b commit 1ce1279

File tree

1 file changed

+57
-2
lines changed

1 file changed

+57
-2
lines changed

app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundleAdvancedPricing.php

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,32 @@
77

88
use Magento\Catalog\Api\Data\ProductAttributeInterface;
99
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier;
10+
use Magento\Framework\Stdlib\ArrayManager;
1011

1112
/**
1213
* Customize Advanced Pricing modal panel
1314
*/
1415
class BundleAdvancedPricing extends AbstractModifier
1516
{
17+
const CODE_PRICE_TYPE = 'price_type';
1618
const CODE_MSRP = 'msrp';
1719
const CODE_MSRP_DISPLAY_ACTUAL_PRICE_TYPE = 'msrp_display_actual_price_type';
1820
const CODE_ADVANCED_PRICING = 'advanced-pricing';
1921
const CODE_RECORD = 'record';
2022

23+
/**
24+
* @var ArrayManager
25+
*/
26+
private $arrayManager;
27+
28+
/**
29+
* @param ArrayManager $arrayManager
30+
*/
31+
public function __construct(ArrayManager $arrayManager)
32+
{
33+
$this->arrayManager = $arrayManager;
34+
}
35+
2136
/**
2237
* {@inheritdoc}
2338
*/
@@ -29,8 +44,7 @@ public function modifyMeta(array $meta)
2944
if (isset($parentNode['container_' . self::CODE_MSRP])
3045
&& isset($parentNode['container_' . self::CODE_MSRP_DISPLAY_ACTUAL_PRICE_TYPE])
3146
) {
32-
unset($parentNode['container_' . self::CODE_MSRP]);
33-
unset($parentNode['container_' . self::CODE_MSRP_DISPLAY_ACTUAL_PRICE_TYPE]);
47+
$parentNode = $this->modifyMsrpMeta($parentNode);
3448
}
3549
if (isset($parentNode['container_' . ProductAttributeInterface::CODE_SPECIAL_PRICE])) {
3650
$currentNode = &$parentNode['container_' . ProductAttributeInterface::CODE_SPECIAL_PRICE]['children'];
@@ -55,4 +69,45 @@ public function modifyData(array $data)
5569
{
5670
return $data;
5771
}
72+
73+
/**
74+
* Modify meta for MSRP fields.
75+
*
76+
* @param array $meta
77+
* @return array
78+
*/
79+
private function modifyMsrpMeta(array $meta)
80+
{
81+
$meta = $this->arrayManager->merge(
82+
$this->arrayManager->findPath(
83+
static::CODE_MSRP,
84+
$meta,
85+
null,
86+
'children'
87+
) . static::META_CONFIG_PATH,
88+
$meta,
89+
[
90+
'imports' => [
91+
'disabled' => 'ns = ${ $.ns }, index = ' . static::CODE_PRICE_TYPE . ':checked'
92+
]
93+
]
94+
);
95+
96+
$meta = $this->arrayManager->merge(
97+
$this->arrayManager->findPath(
98+
static::CODE_MSRP_DISPLAY_ACTUAL_PRICE_TYPE,
99+
$meta,
100+
null,
101+
'children'
102+
) . static::META_CONFIG_PATH,
103+
$meta,
104+
[
105+
'imports' => [
106+
'disabled' => 'ns = ${ $.ns }, index = ' . static::CODE_PRICE_TYPE . ':checked'
107+
]
108+
]
109+
);
110+
111+
return $meta;
112+
}
58113
}

0 commit comments

Comments
 (0)