Today I had some trouble with removing a module on Magento2 and its custom product attributes. After removing the code of Mageplaza_Seo I was not able to edit products, categories or even checkout anymore.
1 2 3 4 5 6 |
Fatal error: Uncaught Error: Class 'Mageplaza\Seo\Model\Source\Robots' not found in /home/www/client/src/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:93 Stack trace: #0 /home/www/client/src/vendor/magento/framework/ObjectManager/Factory/Compiled.php(88): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Mageplaza\\Seo\\M...', Array) #1 /home/www/client/src/vendor/magento/framework/ObjectManager/ObjectManager.php(57): Magento\Framework\ObjectManager\Factory\Compiled->create('Mageplaza\\Seo\\M...', Array) #2 /home/www/client/src/vendor/magento/framework/Validator/UniversalFactory.php(36): Magento\Framework\ObjectManager\ObjectManager->create('Mageplaza\\Seo\\M...', Array) #3 /home/www/client/src/vendor/magento/module-eav/Model/Entity/Attribute/AbstractAttribute.php(551): Magento\Framework\Validator\UniversalFactory->create('\\Mageplaza\\Seo\\...') #4 /home/www/client/src/vendor/magento/module-catalog/Mode in /home/www/client/src/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 93 |
The reason was an attribute called mp_meta_robots which was still pointing to the class \Mageplaza\Seo\Model\Source\Robots. I found the attribute by checking the table eav_attribute as follows.
1 2 3 4 5 6 7 8 |
mysql> SELECT * FROM eav_attribute WHERE source_model LIKE '%Mageplaza%'; +--------------+----------------+----------------+-----------------+---------------+--------------+---------------+----------------+----------------+----------------+----------------+------------------------------------+-------------+-----------------+---------------+-----------+------------------------+ | attribute_id | entity_type_id | attribute_code | attribute_model | backend_model | backend_type | backend_table | frontend_model | frontend_input | frontend_label | frontend_class | source_model | is_required | is_user_defined | default_value | is_unique | note | +--------------+----------------+----------------+-----------------+---------------+--------------+---------------+----------------+----------------+----------------+----------------+------------------------------------+-------------+-----------------+---------------+-----------+------------------------+ | 222 | 4 | mp_meta_robots | NULL | NULL | varchar | NULL | NULL | select | Meta Robots | NULL | \Mageplaza\Seo\Model\Source\Robots | 0 | 0 | NULL | 0 | Added by Mageplaza.com | | 223 | 3 | mp_meta_robots | NULL | NULL | varchar | NULL | NULL | select | Meta Robots | NULL | \Mageplaza\Seo\Model\Source\Robots | 0 | 0 | NULL | 0 | Added by Mageplaza.com | +--------------+----------------+----------------+-----------------+---------------+--------------+---------------+----------------+----------------+----------------+----------------+------------------------------------+-------------+-----------------+---------------+-----------+------------------------+ 2 rows in set (0.00 sec) |
Removing this via backend or MySQL has fixed the problem.
1 2 |
mysql> delete from eav_attribute where attribute_code = 'mp_meta_robots'; Query OK, 2 rows affected (0.01 sec) |