Product route add the ID parameter problems

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 anni tempo fa
Original route


routes.MapLocalizedRoute("Product",
                                     "{SeName}",
                                     new {controller = "Catalog", action = "Product"},
                                     new[] {"Nop.Web.Controllers"});


Changed route

routes.MapLocalizedRoute("Product2",
                                     "{ID}-{SeName}",
                                     new {controller = "Catalog", action = "Product"},
                                     new {ID = @"\d+"},
                                     new[] {"Nop.Web.Controllers"});


The product route changes this

http://locathost/16-build-your-own-computer


There is a problem, is to click on the product to return to home page, do not open the product page.

How do I solve it,thanks!
11 anni tempo fa
_ProductBox.cshtml Code change as follows:


  <div class="picture">
        <a href="@Url.RouteUrl("Product2", new { [email protected], SeName = Model.SeName })" title="@Model.DefaultPictureModel.Title">
            <img alt="@Model.DefaultPictureModel.AlternateText" src="@Model.DefaultPictureModel.ImageUrl" title="@Model.DefaultPictureModel.Title" />
        </a>
    </div>
    <h2 class="product-title">
        <a href="@Url.RouteUrl("Product2", new {  [email protected], SeName = Model.SeName })">@Model.Name</a>
    </h2>
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.