fix(catalog): guard empty website_id in tier price validation (#40799)#40830
Open
lbajsarowicz wants to merge 1 commit into
Open
fix(catalog): guard empty website_id in tier price validation (#40799)#40830lbajsarowicz wants to merge 1 commit into
lbajsarowicz wants to merge 1 commit into
Conversation
When a website is unassigned from a product in admin, the tier_price
form may post rows with an empty website_id. AbstractGroupPrice::validate
then evaluates \$rates[\$priceRow['website_id']]['code'] which raises
"Warning: Undefined array key \"\"" and short-circuits the save
("Product is not saved", validate endpoint returns error: true).
Skip rows whose website_id is missing or empty (already skipped when
=== 0 / global scope), and skip rows whose website_id has no entry in
the rates map.
Fixes magento#40799
|
Hi @lbajsarowicz. 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 website is unassigned from a product in admin, the tier_price form
may post rows with an empty
website_id.AbstractGroupPrice::validatethen evaluates
$rates[$priceRow['website_id']]['code']which raisesWarning: Undefined array key ""and short-circuits the save —Product is not saved, the validate endpoint returnserror: true.Skip rows whose
website_idis missing or empty (already skipped when=== 0/ global scope), and skip rows whosewebsite_idhas no entry inthe rates map.
Fixes #40799
Fixed Issues
Manual testing scenarios
Undefined array key ""warning and product is not saved).Contribution checklist