OpenMage / magento-lts

Official OpenMage LTS codebase | Migrate easily from Magento Community Edition in minutes! Download the source code for free or contribute to OpenMage LTS | Security vulnerability patches, bug fixes, performance improvements and more.
https://www.openmage.org
Open Software License 3.0
863 stars 438 forks source link

Unable to Override GroupController in OpenMage #4033

Closed samex closed 3 weeks ago

samex commented 3 weeks ago

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.

F1Red5 commented 3 weeks ago

You cannot override controllers using app/code/local, because they are not autoloaded.

kiatng commented 3 weeks ago

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