Alter returned customer list

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
2 anni tempo fa
I would like to intercept the customer list coming back in the Admin area and, in some situations, modify that list either by changing individual field values that are displayed or eliminating the display of an entire row.

I can add an Action Filter to override OnResultExecuting.  That will give me a context.Result that is a JsonResult.  Its Value is an anonymous object that ultimately contains the data (in Data, but not directly accessible).  I'm not quite sure what is the best way to access and modify that data from there -- or indeed if there is a better approach I should be taking.

Any suggestions would be appreciated.
2 anni tempo fa
You can make one consumer of ModelPrepared Event facility of nopcommerce. It's called when model is prepared before controller action return.
public class YourConsumer: IConsumer<ModelPrepared<ControllerActionReturnedModel>>
    {
        public void HandleEvent (ModelPrepared <ControllerActionReturnedModel> eventMessage)
        {
            //modify model info
        }
    }


*Another way is Overwrite Controller action. But it's create problem if two class overwrite same action, only one will work. So i think event consumer is the best way to modify value
2 anni tempo fa
The model route didn't seem to work for me.  The model prepared didn't necessarily kick off every time I would need to intercept the results.

Is there really no good way to intercept and modify results?  The JsonResult seems to be impossible to work with.
2 anni tempo fa
ModelPrepare Event not call for only for RenderPartialViewToStringAsync method as per our last findings. We have to add one line code of publish event of ModelPrepared inside it.
Are you facing problem for return html from controller method or for all?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.