Generic routing

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
1 年間の 前
In nopcommerce 4.6 I need to implement slug in a new plugin. I implemented slug when created new items but when I am trying to access the item using slug it is not working. how can I implement it((generic route event) in nopcomnmerce plugin?
1 年間の 前
using this event subscriber admin site slug working

public class RoutingEventConsumer : IConsumer<GenericRoutingEvent>
    {
        public Task HandleEventAsync(GenericRoutingEvent eventMessage)
        {
            var values = eventMessage.RouteValues;
            var urlRecord = eventMessage.UrlRecord;
            if (urlRecord.EntityName.Equals(nameof(Person), StringComparison.InvariantCultureIgnoreCase))
            {
                values[NopRoutingDefaults.RouteValue.Controller] = "Person";
                values[NopRoutingDefaults.RouteValue.Action] = "PersonDetails";
                values[NopRoutingDefaults.RouteValue.SeName] = urlRecord.Slug;
                values["area"] = "Admin";
                values["id"] = urlRecord.EntityId;
            }
            /*eventMessage.Handled = true;*/
            return Task.CompletedTask;
        }
    }
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.