Closed samex closed 3 weeks ago
You cannot override controllers using app/code/local
, because they are not autoloaded.
This behaviour is inherited from Magento 1. See https://community.magento.com/t5/Magento-1-x-Technical-Issues/Local-folder-content-not-working-in-Magento-1-9-3-2/td-p/62267
Description: I encountered an issue while trying to override the GroupController in OpenMage. It seems that the file located at /app/code/core/Mage/Adminhtml/controllers/Customer/GroupController.php cannot be overridden by placing the modified file in /app/code/local/Mage/Adminhtml/controllers/Customer/GroupController.php.
Steps to Reproduce:
Place the overridden GroupController.php in /app/code/local/Mage/Adminhtml/controllers/Customer/GroupController.php. Clear the cache and refresh the page. Observe that the override does not take effect. Expected Behavior: The controller should be overridden by the file placed in the /app/code/local/ directory.
Current Behavior: The override does not take effect, and the core controller continues to be used.
Environment:
OpenMage: 20.9.0 PHP: 8.2 Apache Webserver
Temporary Solution: As a workaround, I created a custom module that extends the GroupController class instead of using the override technique. This approach not only resolves the immediate issue but is also more robust and future-proof compared to using /local overrides, which can lead to errors in future updates.
Additional Notes: I'm not sure if this behavior is intended. If it is not, then this might be a bug.