Skip to content

Commit c5966c4

Browse files
committed
MC-17824: MAP and MSRP are being used interchangeably when they are different
1 parent 099c639 commit c5966c4

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Msrp\Setup\Patch\Data;
9+
10+
use Magento\Catalog\Model\Product;
11+
use Magento\Catalog\Setup\CategorySetupFactory;
12+
use Magento\Framework\Setup\Patch\DataPatchInterface;
13+
14+
/**
15+
* Change label for MSRP attribute.
16+
*/
17+
class ChangeMsrpAttributeLabel implements DataPatchInterface
18+
{
19+
/**
20+
* @var CategorySetupFactory
21+
*/
22+
private $categorySetupFactory;
23+
24+
/**
25+
* @param CategorySetupFactory $categorySetupFactory
26+
*/
27+
public function __construct(CategorySetupFactory $categorySetupFactory)
28+
{
29+
$this->categorySetupFactory = $categorySetupFactory;
30+
}
31+
32+
/**
33+
* @inheritdoc
34+
*/
35+
public function apply()
36+
{
37+
/** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */
38+
$categorySetup = $this->categorySetupFactory->create();
39+
$entityTypeId = $categorySetup->getEntityTypeId(Product::ENTITY);
40+
$msrpAttribute = $categorySetup->getAttribute($entityTypeId, 'msrp');
41+
$categorySetup->updateAttribute(
42+
$entityTypeId,
43+
$msrpAttribute['attribute_id'],
44+
'frontend_label',
45+
'Minimum Advertised Price'
46+
);
47+
}
48+
49+
/**
50+
* @inheritdoc
51+
*/
52+
public static function getDependencies()
53+
{
54+
return [
55+
InitializeMsrpAttributes::class,
56+
];
57+
}
58+
59+
/**
60+
* @inheritdoc
61+
*/
62+
public function getAliases()
63+
{
64+
return [];
65+
}
66+
}

0 commit comments

Comments
 (0)