Skip to content

Store filtering in "add product" popup not working #656

@TheFlo

Description

@TheFlo

Hi GrandNode team,

In admin, on branch 2.3.x, when adding products to blog post, or adding any type of linked products to a product, the store filter in the popup didn't seems to work, no product were filtered.

Looking at the code of the called controller methods, it showed a direct override of the store id filter value with the staff store id:

//limit for store manager
model.SearchStoreId = contextAccessor.WorkContext.CurrentCustomer.StaffStoreId;

This issue seems to be présent in the following files:

  • Grand.Web.Admin/Services/ProductViewModelService.cs, method PrepareProducts, line 654
  • Grand.Web.Admin/Services/ProductViewModelService.cs, method PrepareProductModel, line 853
  • Grand.Web.Admin/Services/BlogViewModelService.cs, method PrepareProductModel, line 209

Adding conditionnal code to check if the user is a staff member, like in other methods in ProductViewModelService.cs seems to have solved this issue:

//limit for store manager
if (!string.IsNullOrEmpty(contextAccessor.WorkContext.CurrentCustomer.StaffStoreId))
    model.SearchStoreId = contextAccessor.WorkContext.CurrentCustomer.StaffStoreId;

Do you see a better solution in order to fix this issue ?

Kind regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions