nopCommerce 4.0 - Bug fixes and improvements

2 years ago
Hi nopCommerce team/community,

We started playing with the latest development version of nopCommerce 4.0 and I must say that you have done a great job as usual!
In my opinion the new nopCommerce 4.0 version will be much faster and will consume less resources, which is what the whole nopCommerce community expects from it.

We would like to open this thread to keep all our feedback in one place as there will be quite a lot of things that will still need to be done for 4.0 to be as extendable as 3.90 was. So we will post anything we find that is still missing in 4.0 in this thread in a separate post.

Keep up the good work guys!

Thanks,
Boyko
2 years ago
So let's start with the first issue we found:


Bug - Admin view locations should be added first


Currently when you open the public area the view locations are properly ordered from the ThemeableViewLocationExpander as the themeable locations are added first.

"/Themes/DefaultClean/Views/{1}/{0}.cshtml"
"/Themes/DefaultClean/Views/Shared/{0}.cshtml"
"/Views/{1}/{0}.cshtml"
"/Views/Shared/{0}.cshtml"


But in the Admin are this is a problem as the Admin area locations should be first instead.
Now in the Admin are the locations are like this:

"/Themes/DefaultClean/Views/{1}/{0}.cshtml"
"/Themes/DefaultClean/Views/Shared/{0}.cshtml"
"/Areas/{2}/Views/{1}/{0}.cshtml"
"/Areas/{2}/Views/Shared/{0}.cshtml"
"/Views/Shared/{0}.cshtml"


This way if you override the Home/Index view in the DefaultClean theme and try to visit the administration, you will end up with the Home page in the public area.

You can easily check if the AreaName is "Admin" and in this case add the Admin view locations first and also there is no need to add the Themeable view locations at all as the administration should not be themeable anyway (at least in 3.9 it wasn't).

Please note that almost every theme (except DefaultClean) overrides the Home/Index view.

Thanks,
Boyko
2 years ago
Hey Boyko,

Thanks a lot! Although we plan to release BETA version in a couple of weeks, it's great you've already started testing and playing with the new version. We hope the community will like it.

And here is a work item - https://github.com/nopSolutions/nopCommerce/issues/2557
2 years ago
Hi Andrei,

Thank you for creating the work item!

Here is the next one :)

The widget zone should be passed to the widget component's Invoke method.

public IViewComponentResult Invoke(string widgetZone)


There are many plugins that could be integrated in multiple widget zones and provide different functionality depending on the widget zone. For example in our Anywhere Sliders plugin you can have many Sliders and have each Slider added to a different widget zone. So without knowing the current widget zone in the Invoke method we will not be able to determine which Sliders to show (we can't show each Slider in every supported widget zone).

Thank you in advance!
Boyko
2 years ago
Hi Boyko,

Thanks. Here it is https://github.com/nopSolutions/nopCommerce/issues/2575
2 years ago
Hi there,

I've tried to run the 4.0 version on local machine, but during build it gives an error:

Error    Duplicate 'Content' items were included. The .NET SDK includes 'Content' items from your project directory by default. You can either remove these items from your project file, or set the 'EnableDefaultContentItems' property to 'false' if you want to explicitly include them in your project file. For more information, see https://aka.ms/sdkimplicititems. The duplicate items were: 'Themes\DefaultClean\theme.config'  Nop.Web  C:\Program Files\dotnet\sdk\2.0.0\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.DefaultItems.targets  286


Inspect that Nop.Web.csproj copy themes directories, after commenting that line, its working fine.  

<Content Include="Themes\**" CopyToPublishDirectory="PreserveNewest" Exclude="Themes\**\*.cshtml" />  


I'm running on VS2017(community), .NET Core SDK -2.0.0(X64) and .NET Core 1.1.4 -Runtime(X64)

Not sure if need to change anything from user end!
2 years ago
Divyang wrote:
I've tried to run the 4.0 version on local machine, but during build it gives an error

I presume you've using some old development branch. Please try the latest one where it was fixed
2 years ago
Done. You can see changes in this and this commits
Thanks for the suggestion and contribution.
2 years ago
Anyone else experiences a very slow building process with VS2017?

Sometimes it takes 1-3 minutes to rebuild NopCommerce.
2 years ago
RomanovM wrote:
Done. You can see changes in this and this commits
Thanks for the suggestion and contribution.


Hi RomanovM,

Thank you for doing this!

Everything works fine except an issue with the additionalData not being present (it is null) in the Invoke method of the components:

Invoke(string widgetZone, object additionalData).


Please see my comment for more information and possible fix in GitHub
https://github.com/nopSolutions/nopCommerce/issues/2575#issuecomment-332494843

Thanks,
Boyko