C# nopCommerce 2.3上的路由问题

C# nopCommerce 2.3上的路由问题,c#,asp.net-mvc,asp.net-mvc-routing,nopcommerce,C#,Asp.net Mvc,Asp.net Mvc Routing,Nopcommerce,我在调试nopCommerce 2.3上的路由问题时遇到问题 站点地图和搜索页面都重定向到主页,而不是各自的页面。这是RouteProvider.cs中的代码: //product search routes.MapLocalizedRoute("ProductSearch", "search/", new { controller = "Catalog", action = "Search" }, new[] { "Nop.Web.Controllers" }); 这是Cat

我在调试nopCommerce 2.3上的路由问题时遇到问题

站点地图和搜索页面都重定向到主页,而不是各自的页面。这是RouteProvider.cs中的代码:

    //product search
    routes.MapLocalizedRoute("ProductSearch", "search/", new { controller = "Catalog", action = "Search" }, new[] { "Nop.Web.Controllers" });
这是CatalogController.cs代码:

    public ActionResult Search(SearchModel model, SearchPagingFilteringModel command)
    {
        if (model == null)
            model = new SearchModel();

        if (command.PageSize <= 0) command.PageSize = _catalogSettings.SearchPageProductsPerPage;
        if (command.PageNumber <= 0) command.PageNumber = 1;
        if (model.Q == null)
            model.Q = "";
        model.Q = model.Q.Trim();

        var categories = _categoryService.GetAllCategories();
        if (categories.Count > 0)
        {
            model.AvailableCategories.Add(new SelectListItem()
                {
                     Value = "0",
                     Text = _localizationService.GetResource("Common.All")
                });
            foreach(var c in categories)
                model.AvailableCategories.Add(new SelectListItem()
                    {
                        Value = c.Id.ToString(),
                        Text = c.GetCategoryBreadCrumb(_categoryService),
                        Selected = model.Cid == c.Id
                    });
        }

        var manufacturers = _manufacturerService.GetAllManufacturers();
        if (manufacturers.Count > 0)
        {
            model.AvailableManufacturers.Add(new SelectListItem()
            {
                Value = "0",
                Text = _localizationService.GetResource("Common.All")
            });
            foreach (var m in manufacturers)
                model.AvailableManufacturers.Add(new SelectListItem()
                {
                    Value = m.Id.ToString(),
                    Text = m.Name,
                    Selected = model.Mid == m.Id
                });
        }

        IPagedList<Product> products = new PagedList<Product>(new List<Product>(), 0, 1);
        // only search if query string search keyword is set (used to avoid searching or displaying search term min length error message on /search page load)
        if (Request.Params["Q"] != null)
        {
            if (model.Q.Length < _catalogSettings.ProductSearchTermMinimumLength)
            {
                model.Warning = string.Format(_localizationService.GetResource("Search.SearchTermMinimumLengthIsNCharacters"), _catalogSettings.ProductSearchTermMinimumLength);
            }
            else
            {
                int categoryId = 0;
                int manufacturerId = 0;
                decimal? minPriceConverted = null;
                decimal? maxPriceConverted = null;
                bool searchInDescriptions = false;
                if (model.As)
                {
                    //advanced search
                    categoryId = model.Cid;
                    manufacturerId = model.Mid;

                    //min price
                    if (!string.IsNullOrEmpty(model.Pf))
                    {
                        decimal minPrice = decimal.Zero;
                        if (decimal.TryParse(model.Pf, out minPrice))
                            minPriceConverted = _currencyService.ConvertToPrimaryStoreCurrency(minPrice, _workContext.WorkingCurrency);
                    }
                    //max price
                    if (!string.IsNullOrEmpty(model.Pt))
                    {
                        decimal maxPrice = decimal.Zero;
                        if (decimal.TryParse(model.Pt, out maxPrice))
                            maxPriceConverted = _currencyService.ConvertToPrimaryStoreCurrency(maxPrice, _workContext.WorkingCurrency);
                    }

                    searchInDescriptions = model.Sid;
                }

                //products

                // RedMorello 170212 - Change from .Position to .Price
                products = _productService.SearchProducts(categoryId, manufacturerId, null,
                    minPriceConverted, maxPriceConverted, 0,
                    model.Q, searchInDescriptions, _workContext.WorkingLanguage.Id, null,
                ProductSortingEnum.Price, command.PageNumber - 1, command.PageSize);
                model.Products = products.Select(x => PrepareProductOverviewModel(x)).ToList();

                model.NoResults = !model.Products.Any();                    
            }
        }

        model.PagingFilteringContext.LoadPagedList(products);
        return View(model);
    }

    [ChildActionOnly]
    public ActionResult SearchBox()
    {
        return PartialView();
    }
public ActionResult搜索(SearchModel模型,SearchPagingFilteringModel命令)
{
if(model==null)
model=新的SearchModel();
if(command.PageSize 0)
{
model.AvailableManufacturers.Add(新建SelectListItem()
{
Value=“0”,
Text=\u localizationService.GetResource(“Common.All”)
});
foreach(制造商的var m)
model.AvailableManufacturers.Add(新建SelectListItem()
{
Value=m.Id.ToString(),
Text=m.名称,
所选=模型.Mid==m.Id
});
}
IPagedList products=新页面列表(新列表(),0,1);
//仅在设置了查询字符串搜索关键字时进行搜索(用于避免在/search page load上搜索或显示搜索词最小长度错误消息)
if(Request.Params[“Q”!=null)
{
if(model.Q.Length<_catalogSettings.productSearchTerm最小长度)
{
model.Warning=string.Format(_localizationService.GetResource(“Search.searchTermMinimumLength ThisNCharacters”),_catalogSettings.ProductSearchTermMinimumLength);
}
其他的
{
int categoryId=0;
int-manufacturerId=0;
十进制?minPriceConverted=null;
十进制?maxPriceConverted=null;
bool searchInDescriptions=false;
if(型号As)
{
//高级搜索
categoryId=model.Cid;
manufacturerId=model.Mid;
//最低价格
如果(!string.IsNullOrEmpty(model.Pf))
{
十进制最小价格=十进制。零;
if(十进制色数(model.Pf,out minPrice))
minPrice Converted=\u currencyService.ConvertToPrimaryStoreCurrency(minPrice,\u workContext.WorkingCurrency);
}
//最高价格
如果(!string.IsNullOrEmpty(model.Pt))
{
十进制maxPrice=十进制.0;
if(十进制色数(model.Pt,out maxPrice))
maxPriceConverted=\u currencyService.ConvertToPrimaryStoreCurrency(maxPrice,\u workContext.WorkingCurrency);
}
searchInDescriptions=model.Sid;
}
//产品
//RedMorello 170212-从.位置更改为.价格
products=\u productService.SearchProducts(categoryId、ManufactureId、null、,
minPriceConverted,maxPriceConverted,0,
model.Q,searchInDescriptions,_workContext.WorkingLanguage.Id,null,
ProductSortingEnum.Price,command.PageNumber-1,command.PageSize);
model.Products=Products.Select(x=>prepareProductOverview模型(x)).ToList();
model.NoResults=!model.Products.Any();
}
}
model.PagingFilteringContext.LoadPagedList(产品);
返回视图(模型);
}
[仅限儿童]
公共行动结果搜索框()
{
返回PartialView();
}

您是否查看了nopCommerce日志以查看是否记录了任何错误?另外,您是使用标准的nopCommerce安装,还是自定义了代码?