Registry Mirror
Skip to content

Conversation

@grandnode-dev

Copy link
Copy Markdown
Member

Type: bugfix

Issue

Saving the product attribute mapping popup (product → Product attributes → Add new) without an attribute, or with one deleted while the popup was open, answers 500. Inserting the mapping copies the attribute's predefined values, and GetProductAttributeById returned null for the missing attribute. Admin, store and vendor panels share the action.

Solution

ProductAttributeMappingPopup (POST) adds a model error ("Please select an attribute.") when the attribute is empty or does not exist, and the popup shows it. The check lives in the action, not in ProductAttributeMappingModelValidator, because the validation rules popup posts the same model without an attribute and would then fail to save.

New resource Admin.Catalog.Products.ProductAttributes.Attributes.Fields.Attribute.Required, in DefaultLanguage.xml and Upgrade/en_250.xml.

Breaking changes

None. The action has a new [FromServices] IProductAttributeService parameter; the panel controllers do not override it.

Testing

  1. Admin → Catalog → Products → a product → Product attributes → Add new.
  2. Delete the chosen product attribute in another tab (or post an empty ProductAttributeId), save: the popup stays open with "Please select an attribute." instead of a 500.
  3. Add a mapping with an existing attribute, then edit its validation rules: both save as before.

Test: BaseProductAttributeMappingControllerTests.ProductAttributeMappingPopup_Post_NoSuchAttribute_ReturnsView_DoesNotInsert.

Saving the popup without an attribute, or with one deleted meanwhile,
answered 500: inserting copies the attribute's predefined values and the
attribute was null. The popup now shows a validation message instead. The
check lives in the action because the validation rules popup posts the
same model without an attribute.
Copilot AI balanced review requested due to automatic review settings November 27, 2026 15:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

support added 2 commits November 27, 2026 20:33
…ute-mapping-required

# Conflicts:
#	src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml
#	src/Web/Grand.Web/App_Data/Resources/Upgrade/en_250.xml
@grandnode-dev
grandnode-dev merged commit 15e38d0 into develop Nov 27, 2026
7 of 8 checks passed
@grandnode-dev
grandnode-dev deleted the fix/product-attribute-mapping-required branch November 27, 2026 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants