error: The parameters dictionary contains a null entry for parameter 'categoryId' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult GetFilters(

Posted: 2 years ago Quote #330
Hi,

After some issues using AjaxFilters on a customized Nopcommerce version, I narrowed down my issue.

I downloaded a new 2.3 Nopcommerce, generated the database, installed nSpikes.Core SevenSpikes.Nop.AjaxFilters and added;

if(IsSectionDefined("nopAjaxFilters"))
{
@RenderSection("nopAjaxFilters")
}

to Views\Shared\_ColumnsThree.cshtml

and

@section nopAjaxFilters
{
         @Html.Action("GetFilters","NopAjaxFilters")
}

to CategoryTemplate.ProductsInGridOrLines.cshtml and ManufacturerTemplate.ProductsInGridOrLines.cshtml


Result:
- Ajaxfilters working at categories.
- Ajafilters giving error (complete error below).

Any ideas how to fix this?

Kind regards, thanks in advanced!

----

Server Error in '/' Application.
--------------------------------------------------------------------------------

The parameters dictionary contains a null entry for parameter 'categoryId' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult GetFilters(Int32, Nop.Web.Models.Catalog.CatalogPagingFilteringModel)' in 'SevenSpikes.Nop.AjaxFilters.Controllers.NopAjaxFiltersController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
Parameter name: parameters
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: The parameters dictionary contains a null entry for parameter 'categoryId' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult GetFilters(Int32, Nop.Web.Models.Catalog.CatalogPagingFilteringModel)' in 'SevenSpikes.Nop.AjaxFilters.Controllers.NopAjaxFiltersController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
Parameter name: parameters

Source Error:


Line 28: @section nopAjaxFilters
Line 29:  {
Line 30:          @Html.Action("GetFilters","NopAjaxFilters")
Line 31:  }
Line 32:     <div class="page-title">


Source File: c:\NopCommerce_test\Presentation\Nop.Web\Views\Catalog\ManufacturerTemplate.ProductsInGridOrLines.cshtml    Line: 30

Stack Trace:


[ArgumentException: The parameters dictionary contains a null entry for parameter 'categoryId' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult GetFilters(Int32, Nop.Web.Models.Catalog.CatalogPagingFilteringModel)' in 'SevenSpikes.Nop.AjaxFilters.Controllers.NopAjaxFiltersController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
Parameter name: parameters]
   System.Web.Mvc.ActionDescriptor.ExtractParameterFromDictionary(ParameterInfo parameterInfo, IDictionary`2 parameters, MethodInfo methodInfo) +485363
   System.Web.Mvc.<>c__DisplayClass1.<Execute>b__0(ParameterInfo parameterInfo) +18
   System.Linq.WhereSelectArrayIterator`2.MoveNext() +85
   System.Linq.Buffer`1..ctor(IEnumerable`1 source) +217
   System.Linq.Enumerable.ToArray(IEnumerable`1 source) +78
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +133
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
   System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +55
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +263
   System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +19
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +263
   System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +19
Posted: 2 years ago Quote #331
Hi,

Thank you for using our products!

You are trying to integrate the filters on the Manufacturer page, but unfortunately they work only for categories.
The Filters do have a manufacturer Filter Group, if this could be a work around for your project.
We would bear this in mind however and if we find out that it is a popular demand we can look into the filters to implement them to work for the manufacturer view.

Thanks
Posted: 2 years ago Quote #335
thank you very much !!

big oops...
Find us on Facebook