Close

Error on filtering parentcategory with products from subcategories

mrbombay
11 years ago
#2066 Quote
Avatar
  • 10
Hi Nop-Templates,

I'm trying to configure the latest version of ajax filters on my website, but i get an error on the parent category page. I use the option - Include Products From Subcategories. On a child category it works fine. This is the error i'm getting:

POST http://localhost:60000/Catalog7Spikes/GetFilteredProducts 500 (Internal Server Error)


The parameters dictionary contains a null entry for parameter 'categoryId' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult GetFilteredProducts(Int32, SevenSpikes.Nop.AjaxFilters.Models.PriceRangeFilterSlider.PriceRangeFilterModel7Spikes, SevenSpikes.Nop.AjaxFilters.Models.SpecificationFilter.SpecificationFilterModel7Spikes, SevenSpikes.Nop.AjaxFilters.Models.AttributeFilter.AttributeFilterModel7Spikes, SevenSpikes.Nop.AjaxFilters.Models.ManufacturerFilter.ManufacturerFilterModel7Spikes, Nop.Web.Models.Catalog.CatalogPagingFilteringModel, System.String)' in 'SevenSpikes.Nop.AjaxFilters.Controllers.Catalog7SpikesController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
Parameternaam: parameters
IvanStoyanov
11 years ago
#2067 Quote
Avatar
  • Moderator
  • 269
mrbombay wrote:
Hi Nop-Templates,

I'm trying to configure the latest version of ajax filters on my website, but i get an error on the parent category page. I use the option - Include Products From Subcategories. On a child category it works fine. This is the error i'm getting:

POST http://localhost:60000/Catalog7Spikes/GetFilteredProducts 500 (Internal Server Error)


The parameters dictionary contains a null entry for parameter 'categoryId' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult GetFilteredProducts(Int32, SevenSpikes.Nop.AjaxFilters.Models.PriceRangeFilterSlider.PriceRangeFilterModel7Spikes, SevenSpikes.Nop.AjaxFilters.Models.SpecificationFilter.SpecificationFilterModel7Spikes, SevenSpikes.Nop.AjaxFilters.Models.AttributeFilter.AttributeFilterModel7Spikes, SevenSpikes.Nop.AjaxFilters.Models.ManufacturerFilter.ManufacturerFilterModel7Spikes, Nop.Web.Models.Catalog.CatalogPagingFilteringModel, System.String)' in 'SevenSpikes.Nop.AjaxFilters.Controllers.Catalog7SpikesController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
Parameternaam: parameters


Hi mrbombay

Thank you for choosing our products.
You can see that this feature of the Nop Ajax Filters plugin works fine on our demo website http://demos.nop-templates.com/computers
Can you tell us what version of nopCommerse you are using? Also can you try and restart the your application by changing the Global.asax file? What version of the Nop Ajax Filters plugin are you using (you can check this in the Description.txt file in the Nop Ajax Filters  folder)?

I will be waiting for your reply.

Ivan Stoyanov
Thank you for choosing our products! Your feedback is important to us!
mrbombay
11 years ago
#2068 Quote
Avatar
  • 10
I am using nopcommerce 2.80 and Nop Ajax Filters 2.81. I've changed the global.asax and the same error keep popping up. I've changed the view - CategoryTemplate.ProductsInGridOrLines -  a little bit. The category-navigation looks like this. Could i be this change?


@section left {

    @*--------------------------------------------------------------------*@
    @*subcategories*@
    @*--------------------------------------------------------------------*@
    @{
        //current category ID
        int currentCategoryId = 0;
        if (Url.RequestContext.RouteData.Values["controller"].ToString().Equals("catalog", StringComparison.InvariantCultureIgnoreCase) &&
            Url.RequestContext.RouteData.Values["action"].ToString().Equals("category", StringComparison.InvariantCultureIgnoreCase))
        {
            currentCategoryId = Convert.ToInt32(Url.RequestContext.RouteData.Values["categoryId"].ToString());
        }

    }

    @Html.Widget("categorydetails_before_subcategories")

    @if (Model.SubCategories.Count > 0)
    {
        <div class="sidebar-block">
            <h5>@T("Categories")</h5>

            <ul class="sidebar-navigation">
                @foreach (var item in Model.SubCategories)
                {
                    <li>
                        <a href="@Url.RouteUrl("Category", new { SeName = item.SeName })">@item.Name</a>
                    </li>

                }
            </ul>
        </div>

    }
    else
    {
        if (Model.ParentCategories.Count > 0)
        {

        <div class="sidebar-block">
            <h5>@T("Categories")</h5>

            <ul class="sidebar-navigation">
                @foreach (var item in Model.ParentCategories)
                {
                    <li>
                        @if (currentCategoryId == item.Id)
                        {
                            <a href="@Url.RouteUrl("Category", new { SeName = item.SeName })" class="active">@item.Name</a>
                        }
                        else
                        {
                            <a href="@Url.RouteUrl("Category", new { SeName = item.SeName })">@item.Name</a>
                        }
                    </li>

                }
            </ul>
        </div>

        }

    }
}

IvanStoyanov
11 years ago
#2069 Quote
Avatar
  • Moderator
  • 269
mrbombay wrote:
I am using nopcommerce 2.80 and Nop Ajax Filters 2.81. I've changed the global.asax and the same error keep popping up. I've changed the view - CategoryTemplate.ProductsInGridOrLines -  a little bit. The category-navigation looks like this. Could i be this change?


@section left {

    @*--------------------------------------------------------------------*@
    @*subcategories*@
    @*--------------------------------------------------------------------*@
    @{
        //current category ID
        int currentCategoryId = 0;
        if (Url.RequestContext.RouteData.Values["controller"].ToString().Equals("catalog", StringComparison.InvariantCultureIgnoreCase) &&
            Url.RequestContext.RouteData.Values["action"].ToString().Equals("category", StringComparison.InvariantCultureIgnoreCase))
        {
            currentCategoryId = Convert.ToInt32(Url.RequestContext.RouteData.Values["categoryId"].ToString());
        }

    }

    @Html.Widget("categorydetails_before_subcategories")

    @if (Model.SubCategories.Count > 0)
    {
        <div class="sidebar-block">
            <h5>@T("Categories")</h5>

            <ul class="sidebar-navigation">
                @foreach (var item in Model.SubCategories)
                {
                    <li>
                        <a href="@Url.RouteUrl("Category", new { SeName = item.SeName })">@item.Name</a>
                    </li>

                }
            </ul>
        </div>

    }
    else
    {
        if (Model.ParentCategories.Count > 0)
        {

        <div class="sidebar-block">
            <h5>@T("Categories")</h5>

            <ul class="sidebar-navigation">
                @foreach (var item in Model.ParentCategories)
                {
                    <li>
                        @if (currentCategoryId == item.Id)
                        {
                            <a href="@Url.RouteUrl("Category", new { SeName = item.SeName })" class="active">@item.Name</a>
                        }
                        else
                        {
                            <a href="@Url.RouteUrl("Category", new { SeName = item.SeName })">@item.Name</a>
                        }
                    </li>

                }
            </ul>
        </div>

        }

    }
}



Hi

Can you send us FTP and admin credentials to your website at support (at) nop-templates.com, so that we can investigate your issue.
Thank you for choosing our products! Your feedback is important to us!
mrbombay
11 years ago
#2070 Quote
Avatar
  • 10
Thx for the fast reply, but my site is currently running on localhost. Going to investigate it a bit further and if i don't find a solution, i will put  the problem online.
mrbombay
11 years ago
#2071 Quote
Avatar
  • 10
I've found something more, but still not working:



   <body bgcolor="white">

            <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>

            <h2> <i>The JSON request was too large to be deserialized.</i> </h2></span>

            <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

            <b> Description: </b>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.

            <br><br>

            <b> Exception Details: </b>System.InvalidOperationException: The JSON request was too large to be deserialized.<br><br>

            <b>Source Error:</b> <br><br>

            <table width=100% bgcolor="#ffffcc">
               <tr>
                  <td>
                      <code>

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.</code>

                  </td>
               </tr>
            </table>

            <br>

            <b>Stack Trace:</b> <br><br>

    
            <br>

            <hr width=100% size=1 color=silver>

            <b>Version Information:</b>&nbsp;Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929

            </font>

    </body>


  
Boyko
11 years ago
#2072 Quote
Avatar
  • Moderator
  • 1570
mrbombay wrote:
I've found something more, but still not working:

 The JSON request was too large to be deserialized.

  


Hi mrbombay,

It looks like when you have enabled to show the products in the subcategories and you are on a main category there are too many available filtering options because you have much more products to be filtered. There is a limitation in the .NET Framework on the JSON request being sent to the server and as the Ajax Filters send the data to the server via Ajax and JSON that is why you get this error. You need to increase the limit via adding a setting in your Web.config file.
Into the <appSettings> section add the following line:
<add key="aspnet:MaxJsonDeserializerMembers" value="150000" />

Thanks!
Regards,
Nop-Templates.com Team
mrbombay
11 years ago
#2073 Quote
Avatar
  • 10
Thx, That did the trick.