2

While installing database from cmd I am getting below error.

Unable to apply data patch Magento\Msrp\Setup\Patch\Data\ChangeMsrpAttributeLabel for module Magento_Msrp. Original exception message: Notice: Undefined index: attribute_id in D:\wamp64\www\magento2\vendor
\magento\module-msrp\Setup\Patch\Data\ChangeMsrpAttributeLabel.php on line 43

In ErrorHandler.php line 61:

Notice: Undefined index: attribute_id in D:\wamp64\www\magento2\vendor\magento\module-msrp\Setup\Patch\Data\ChangeMsrpAttributeLabel.php on line 43

I am also attaching screenshot of error. Can anyone please help me on that?

enter image description here

1
  • Hi, did you get the solution for the above problem? i am also facing this on windows system. Oct 6, 2020 at 11:41

2 Answers 2

2

Go to vendor\magento\module-msrp\Setup\Patch\Data\ChangePriceAttributeDefaultScope.php

comment line no 89 to 94

$categorySetup->updateAttribute(
            $entityTypeId,
            $attribute['attribute_id'],
            'is_global',
            \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL
        );

and in the file vendor\magento\module-msrp\Setup\Patch\Data\ChangeMsrpAttributeLabel.php comment out line no 41 to 46.

$categorySetup->updateAttribute(
            $entityTypeId,
            $msrpAttribute['attribute_id'],
            'frontend_label',
            'Minimum Advertised Price'
        );

Run the setup command again to start installation.

php -dmemory_limit=-1 bin/magento setup:install --base-url=http://127.0.0.1/magento-24/ --db-host=127.0.0.1 --db-name=magento-24 --db-user=root --db-password='' --admin-firstname=test --admin-lastname=test [email protected] --admin-user=admin --admin-password=admin@123 --language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1 --search-engine=elasticsearch7 --elasticsearch-host=127.0.0.1 --elasticsearch-port=9200

After installation uncomment the above files. Above solution worked fine.

0

I faced such error, and having investigated this question it was found out that the problem was that in the third-party module (which place in app/code or vendor/) which uses a patch to add attributes with method $eavSetup->addAttribute(), uses for class the interface \Magento\Framework\Setup\Patch\SchemaPatchInterface instead \Magento\Framework\Setup\Patch\DataPatchInterface and set that patch class to folder .../Setup/Patch/Schema/AddCustomAttirbute.php It means that when we use patch to add attribute we need use interface \Magento\Framework\Setup\Patch\DataPatchInterface to create patch class.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.