During your Magento 2 admin tasks, have you ever encountered an error message like this on product page “1 exception(s): Exception #0 (ReflectionException): Class ‘
Learningmagento\NewConcept\Model\Config\Source\MakeOptions‘ does not exist”?
Table of Contents
How it may arrived
The error message indicates that the requested class is missing from the project. This request can originate within the same module or from a different module that depends on it. Several possibilities could account for this issue, such as the file being deleted, a change in the module’s name or the company name associated with it, the file being relocated, or even the complete deletion of the module.
Purpose of the class
Examining the class
Learningmagento\NewConcept\Model\Config\Source\MakeOptions and observing this error exclusively on the product edit page suggests that it likely pertains to a product attribute. The attribute in question is likely a dropdown attribute, as only attributes generated by the module code exhibit this behaviour of populating options in a dropdown. These attributes are typically unmodifiable in terms of their values.
Solving product page error
To solve this product page error you will need to check the database.
- Open the database using any tools you want to open it. Preferly use Phpmyadmin
- Go to
- Search for the value
Learningmagento\NewConcept\Model\Config\Source\MakeOptionsinside the column
- Or you can execute the sql query
SELECT * FROM eav_attribute WHERE source_model = 'Learningmagento\NewConcept\Model\Config\Source\MakeOptions'
- If you find the the row then delete the row or simply excute the sql query as
DELETE FROM eav_attribute WHERE source_model = 'Learningmagento\NewConcept\Model\Config\Source\MakeOptions'
- Now go back to product page and reload the page. It should now show you the Product or New product page depending upon your request.
In Magento 2, a Reflection Exception is an exception that occurs when there’s a problem with the system’s ability to reflectively inspect or interact with classes and methods during runtime. Reflection is a mechanism that allows Magento to analyze and manipulate the structure of classes, interfaces, properties, and methods dynamically. When a
ReflectionException is raised, it often indicates that the system is encountering issues like incorrect class names, missing or inaccessible classes, or issues with autoloading.
These exceptions can have a wide-ranging impact on the functionality of a Magento store, leading to various errors and potential site failures. To resolve a
ReflectionException, developers typically need to trace the issue back to its source, which may involve debugging, checking namespaces, ensuring the presence of class files, and verifying that classes and methods are correctly defined and accessible within the code. Addressing
ReflectionException errors is crucial for maintaining the integrity and proper operation of a Magento 2 store.
Always write an uninstall script so that this kinds of problems doesn’t occur in the production environment. To know how to create an attribute programmatically check this article Create product attribute programmatically in Magento 2.3 and above