-
-
Notifications
You must be signed in to change notification settings - Fork 449
Improved error message for CMS page delete #4974
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- group by Mage_Core and Mage_Cms
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR improves error messaging when attempting to delete or disable CMS pages that are used in configuration, and includes related improvements to the admin interface.
- Enhanced error messages to provide clearer context about which configurations are preventing page deletion/disabling
- Fixed sort order in admin config system.xml for CMS pages
- Added comprehensive test coverage for new functionality
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
app/code/core/Mage/Cms/Helper/Page.php | Added helper methods to generate user-friendly error messages with configuration labels and scope information |
app/code/core/Mage/Cms/Model/Resource/Page.php | Updated error message formatting and fixed store ID handling logic |
app/locale/en_US/Mage_Cms.csv | Improved error message templates for better readability |
app/code/core/Mage/Cms/etc/system.xml | Fixed sort order values for CMS page configuration options |
tests/unit/Mage/Cms/Helper/PageTest.php | Added unit tests for new helper methods |
tests/unit/Traits/DataProvider/Mage/Cms/CmsTrait.php | Added test data providers for the new functionality |
cypress/e2e/openmage/backend/cms/page.cy.js | Added end-to-end tests for page deletion and disabling scenarios |
cypress/support/openmage/config/paths.js | Added UI selectors for CMS page management |
cypress/support/openmage.js | Fixed save action behavior to prevent multiple clicks |
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
@sreichel -Thank you for your work on this PR and for your kind words. However, I have some concerns and suggestions based on our previous implementations (PR #4239 and #4969) and on practical usability:
For the info message displaying where the page is used, I can drop the attempt to build a grammatically correct English sentence (method _joinWithCommaAnd in PR #4969). I believe these adjustments are crucial for a better user experience, especially in multi-store setups but this PR forces me to close my previous work, even though it could be easily adapted to incorporate these suggestions and best practices. |
All is done here, can you make suggestions to the code? public static function getScopeInfoFromConfigScope(string $scope, string $scopeId): string
{
return match ($scope) {
Mage_Adminhtml_Block_System_Config_Form::SCOPE_DEFAULT => Mage::helper('cms')->__('Default Config'),
Mage_Adminhtml_Block_System_Config_Form::SCOPE_WEBSITES => sprintf(
'%s "%s"',
Mage::helper('cms')->__('Website'),
Mage::app()->getWebsite($scopeId)->getName(),
),
Mage_Adminhtml_Block_System_Config_Form::SCOPE_STORES => sprintf(
'%s "%s"',
Mage::helper('cms')->__('Store View'),
Mage::app()->getStore($scopeId)->getName(),
),
};
}
This PR is ONLY for the message :P Changes in logic please in another PR. |
|
Description (*)
@addison74 thanks for working on all the CMS page related issue, but we should do it step by step ....
What are the issues we have?
This PR ...
Related Pull Requests
Manual testing scenarios (*)
Delete

Disable

Note
To run cypress ... use DDEV, install cypress plugin, run
ddev cypress-open -C .cypress.config.js