bug crashes in all stores for a category to "be shown on home page" in multistore

4 mesi tempo fa
hi

nopcommerce version 4.40.3

in a multistore, when you define a category to be shown on home page "Show on home page" but forget to put anything in "Limited to stores",
the category appears correctly on the main shop,
but all other multistores crashes on their homepage

best regards
Mehdi
4 mesi tempo fa
It works fine on a clean installation.
Could you please provide a full list of steps to reproduce?
Do you use any third-party plugins/themes or customizations?
4 mesi tempo fa
I am using sing nopcommerce 4.40.3 with nop-template Pacific (from Seven Spikes)

1. under category on backend i open one category (under Display)
2. i set it to "Show on home page"
3. i leave empty the "Limited to stores"

On the main shop everything is still fine, but on all other stores (multistore) it crashes only on their home pages, the rest of their pages are still ok.

When i put something in the "Limited to stores" then it doesn't crash any more.
4 mesi tempo fa
Check the log for errors when it crashes.
Also, I suggest contacting the theme developer, perhaps this bug is related to it.
4 mesi tempo fa
from the logs...
yes, it is related to the pacific template of 7Spikes:


fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1]
      An unhandled exception has occurred while executing the request.
      System.InvalidOperationException: Sequence contains no elements
         at System.Linq.ThrowHelper.ThrowNoElementsException()
         at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
         at Nop.Web.Factories.CatalogModelFactory.PrepareSubCategoriesAsync(Int32 id) in ....\Nop.Web\Factories\CatalogModelFactory.cs:line 673
         at SevenSpikes.Nop.Framework.Components.Base7SpikesThemeComponent.PrepareCategorySimpleModelAsync(Int32 categoryId)
         at SevenSpikes.Theme.Pacific.Components.PacificThemeComponent.ShowSubCategoriesInCategoryItemBoxAsync(Object additionalData)
         at SevenSpikes.Theme.Pacific.Components.PacificThemeComponent.InvokeAsync(String widgetZone, Object additionalData)
         at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentInvoker.InvokeAsyncCore(ObjectMethodExecutor executor, ViewComponentContext context)
         at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentInvoker.InvokeAsync(ViewComponentContext context)
         at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentHelper.InvokeCoreAsync(ViewComponentDescriptor descriptor, Object arguments)