Hi, I am writing again to maybe get an answer on how to send a custom model from my custom section in Product edit page when the page is saved. Basically, with the help of this community I have been able to create my custom section on the Product and Category edit pages. But I want to now capture the saving (or delete) event, and get the model (data from my inputs) back, so I can save it to the database. How can I achieve this? Using version: 4.60.3
But do I get the whole model through or just the Id?? Because in the example it searches by ID every time. And I don't have an id, as the model will create new items in the database.
Also now that I have tried it, it doesn't work. I set a breakpoint just under the if, and it didn't got hit when saving the product or category. Below is my code:
public async Task HandleEventAsync(ModelReceivedEvent<BaseNopModel> eventMessage) { var httpRequest = _httpContextAccessor.HttpContext.Request;
if (_settings.Enabled && eventMessage?.Model is DetailViewExtensionModel model && !string.IsNullOrWhiteSpace(httpRequest.Path) && httpRequest.Method == "POST" && (httpRequest.Path.StartsWithSegments("/Admin/Product") || httpRequest.Path.StartsWithSegments("/Admin/Category"))) {