magento / meta-for-magento2

33 stars 19 forks source link

Uninstall not removing attribute #24

Open p24-max opened 9 months ago

p24-max commented 9 months ago

Preconditions (*)

  1. Version 1.2.0
  2. Magento 2.4.5

Steps to reproduce (*)

  1. Install the extension with composer
  2. Run setup upgrade
  3. (Verify: Attribute google_product_category is created)
  4. Uninstall the module: bin/magento module:uninstall --remove-data --non-composer -v Meta_Catalog -> Attribute is still remaining
  5. Remove the module with composer remove
  6. Open a product in edit mode in catalog admin, will result in error
    Type Error occurred when creating object: Meta\Catalog\Model\Config\Source\Product\GoogleProductCategory, Meta\Catalog\Model\Config\Source\Product\GoogleProductCategory::__construct(): Argument #1 ($sourceData) must be of type array, null given, called in ...

Expected result (*)

  1. That it can be safely uninstalled

Actual result (*)

  1. Removing the module causes errors in the magento admin (edit product page):
    Type Error occurred when creating object: Meta\Catalog\Model\Config\Source\Product\GoogleProductCategory, Meta\Catalog\Model\Config\Source\Product\GoogleProductCategory::__construct(): Argument #1 ($sourceData) must be of type array, null given, called in ...
willfreeze commented 3 months ago

Got the same issue on Magento 2.4.6 Can I manually remove the google_product_category to resolve the problem?

PhiIipp commented 2 months ago

@willfreeze did you find a way ?

ChatGPT propose the following, and i see the record in the db.

SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'google_product_category'; DELETE FROM catalog_productentity* WHERE attribute_id = [attribute_id]; DELETE FROM eav_attribute WHERE attribute_id = [attribute_id];

but i dont want to crash my DB schema , or run in problems when I install a new versions once meta plugin compatible with magento 2.4.7 and php 8.3

mediaweb03 commented 6 days ago

I was successful getting rid of this error... I ran the above recommended mySQL commands: SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'google_product_category'; It found the attribute_code.

Then I ran... DELETE FROM eav_attribute WHERE attribute_id = [attribute_id]; I did not run the other mysql query since it seemed harder to add back

Logged in my admin panel, and my error was gone.