Skip to content

Add store-scoped contact attribute management to Grand.Web.Store#710

Merged
KrzysztofPajak merged 5 commits into
developfrom
feature/store-contact-attributes
Jun 8, 2026
Merged

Add store-scoped contact attribute management to Grand.Web.Store#710
KrzysztofPajak merged 5 commits into
developfrom
feature/store-contact-attributes

Conversation

@KrzysztofPajak

Copy link
Copy Markdown
Member

Store owners can create, edit and delete their own contact attributes. Global/shared attributes are visible in read-only preview mode (values visible, no add/edit/delete). Access to attributes from other stores is blocked at the controller level.

Resolves #issueNumber
Type: feature|bugfix|

Issue

Description of the issue this PR is solving, why it's happening, and how to reproduce it.

Solution

Summarize your solution to the problem. Please include short description.

Breaking changes

If you have a breaking changes, list them here, otherwise list none.

Testing

  1. List the steps needed for testing your PR.
  2. Assume that everyone already know how to run the GrandNode, and do the basic configuration.
  3. Be detailed enough that someone can work through it easily.

Store owners can create, edit and delete their own contact attributes.
Global/shared attributes are visible in read-only preview mode (values
visible, no add/edit/delete). Access to attributes from other stores
is blocked at the controller level.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
KrzysztofPajak and others added 4 commits June 7, 2026 20:34
…ontactAttribute views

- Add ContactAttributeStoreProfile (Grand.Web.Store) to map ContactAttribute → ContactAttributeStoreModel via Grand.Mapping infrastructure
- Add ContactAttributeStoreModel inheriting ContactAttributeModel with IsReadOnly property
- Controller Edit GET now uses MapTo<ContactAttribute, ContactAttributeStoreModel>() instead of non-existent ToModel(model) overload
- Controller Edit POST returns ContactAttributeStoreModel on validation failure (drops ViewBag.IsReadOnly)
- Update Edit.cshtml, CreateOrUpdate.cshtml, TabInfo.cshtml, TabValues.cshtml to @model ContactAttributeStoreModel and Model.IsReadOnly
- Add Grand.Web.Store.Models.Messages using to _ViewImports.cshtml

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…wBag.Title ternary

- Add admin.catalog.attributes.contactattributes.globalreadonly to DefaultLanguage.xml
- Simplify ViewBag.Title in Edit.cshtml (both ternary branches were identical)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Switch Create GET/POST to use ContactAttributeStoreModel so partial views render correctly
- Update Create.cshtml to @model ContactAttributeStoreModel
- Add ContactAttributeStoreValidator that reuses ContactAttributeValidator rules via FluentValidation Include + IValidator<in T> contravariance

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@KrzysztofPajak KrzysztofPajak merged commit 47c9ef2 into develop Jun 8, 2026
6 checks passed
@KrzysztofPajak KrzysztofPajak deleted the feature/store-contact-attributes branch June 8, 2026 17:03
KrzysztofPajak added a commit that referenced this pull request Jul 4, 2026
….Store (#722)

* Add store-scoped customer & address attribute management to Grand.Web.Store

Store owners can create, edit and delete their own customer attributes
and address attributes. Global attributes are visible in read-only
preview mode; attributes limited to other stores are hidden and access
is blocked at the controller level.

- CustomerAttribute and AddressAttribute implement IStoreLinkEntity
  (LimitedToStores + Stores)
- GetAllCustomerAttributes(storeId) / GetAllAddressAttributes(storeId)
  service overloads with per-store cache keys
- Storefront handlers and validators filter attributes by current store;
  GetAttributeWarnings(attrs, storeId) parser overloads so required
  attributes of other stores do not block registration/checkout
- Admin: Stores selector on customer/address attribute forms
- Grand.Web.Store: CustomerAttributeController + AddressAttributeController
  with views following the ContactAttribute pattern (PR #710); Stores field
  hidden and auto-set to the staff store
- New translation resources (limitedtostores, globalreadonly)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Address Copilot review feedback on PR #722

- RegisterValidator/CustomerInfoValidator: always scope attribute
  validation to the current store instead of the per-store-identity
  storeId, which is empty when RegisterCustomersPerStore is disabled
- Store CustomerAttribute/AddressAttribute Edit POST: repopulate
  Locales when redisplaying the form after a validation failure
- Store ValueDelete endpoints: return a structured DataSourceResult
  error instead of throwing (500) when the value id is not found

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant