41127 payment method sort order - #41144
Open
aasim110 wants to merge 5 commits into
Open
Conversation
…ith diagnostic message When a module's menu.xml contains invalid declarations (e.g. a missing 'parent' attribute referencing a non-existent item, or missing required params), the menu builder throws raw PHP exceptions (OutOfRangeException, BadMethodCallException, InvalidArgumentException). These propagated uncaught through the admin auth/redirect flow, causing ERR_TOO_MANY_REDIRECTS with no visible error message and no log entry for the generic case. Fix: All exception types caught in Menu\Config::getMenu() are now re-thrown as LocalizedException with a developer-friendly diagnostic message that includes the original error text and hints at the file/attribute to fix. The original exception is preserved as getPrevious() for full stack traces. The generic \Exception catch block now also logs via logger->critical(). Covered by updated unit tests in ConfigTest.
|
Hi @aasim110. Thank you for your contribution!
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
Contributor
Author
|
@magento run all tests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When a payment method becomes newly applicable during checkout (e.g. after the shipping country changes), its renderer was always appended to the end of the payment method list in the DOM — regardless of its configured
sort_order. This caused payment methods to display out of order whenever the applicable list changed after the initial page render.Root cause: the backend (
Magento\Payment\Model\MethodList,Magento\Quote\Model\PaymentMethodManagement::getList) already returns payment methods correctly sorted bysort_order. The bug was in the frontend componentMagento_Checkout/js/view/payment/list.js: whencreateRenderer()builds a renderer node for a newly-added payment method, it never set asortOrderon the node.Magento_Ui's layout/collection insertion logic treats a missingsortOrderas "append to the end", so any method that became available after the initial render was always placed last, even if itssort_orderwas lower than methods already rendered.Fix:
createRenderer()now computes the method's current index within the already correctly-sortedpaymentMethods()list and passes it through as the renderer node'ssortOrder. This reuses the existingsortOrder-aware insertion mechanism already present inMagento_Ui/js/core/renderer/layout.js/collection.js, so a newly-added renderer is spliced into its correct position instead of always being appended. No backend/API changes are required.Related Pull Requests
N/A
Fixed Issues (if relevant)
Fixes #41127
Manual testing scenarios
10, Payment from Applicable Countries = All Allowed Countries.5, Payment from Applicable Countries = Specific Countries → Germany only.After fix: Cash On Delivery (sort order 5) renders above Check/Money Order (sort order 10), matching their configured sort order.
Questions or comments
N/A