NivoSlider

11 месяцев назад
Hello everyone. I know this is not new and there are a few posts about this subject on the forum. I have read them all. Unfortunately, they are all outdated. I am using nopCommerce 4.60.3. And I have updated nivoSlider from 5 images to 15 images according to the outdated posts by using Visual Studio 2022 on Windows 11 Pro. Voila! Of course, it does not work :))).  The error message is :
'PublicInfoModel' does not contain a definition of 'Picture6Url' and no accessible extension method 'Picture6Url' was found that accepts an initial argument of type 'PublicInfoModel' (could you be missing an instruction directive or assembly reference?)
However, I did what prabirchoudhury said on this post. Also, I was careful & followed the references that write on VS. Besides, VS cannot find any issue or warning. I believe this happened because of something beyond the source code. But what?
PS: bolds are folder names, italics are file names.
I added the required changes "PublicInfoModel" in the folder Plugins/Nop.Plugin.Widgets.NivoSlider
Components
WidgetsNivoSliderViewComponent.cs
The changes I have made are:
var model = new PublicInfoModel
            {
                Picture1Url = await GetPictureUrlAsync(nivoSliderSettings.Picture1Id),
                Text1 = nivoSliderSettings.Text1,
                Link1 = nivoSliderSettings.Link1,
                AltText1 = nivoSliderSettings.AltText1,
                .
                .
                .
                Picture5Url = await GetPictureUrlAsync(nivoSliderSettings.Picture5Id),
                Text5 = nivoSliderSettings.Text5,
                Link5 = nivoSliderSettings.Link5,
                AltText5 = nivoSliderSettings.AltText5,

                Picture6Url = await GetPictureUrlAsync(nivoSliderSettings.Picture6Id),
                Text6 = nivoSliderSettings.Text6,
                Link6 = nivoSliderSettings.Link6,
                AltText6 = nivoSliderSettings.AltText6,
                .
                .
                .
                Picture15Url = await GetPictureUrlAsync(nivoSliderSettings.Picture15Id),
                Text15 = nivoSliderSettings.Text15,
                Link15 = nivoSliderSettings.Link15,
                AltText15 = nivoSliderSettings.AltText15

                if (string.IsNullOrEmpty(model.Picture1Url) && string.IsNullOrEmpty(model.Picture2Url) &&
                string.IsNullOrEmpty(model.Picture3Url) && string.IsNullOrEmpty(model.Picture4Url) &&
                string.IsNullOrEmpty(model.Picture5Url) && string.IsNullOrEmpty(model.Picture6Url) &&
                string.IsNullOrEmpty(model.Picture7Url) && string.IsNullOrEmpty(model.Picture8Url) &&
                string.IsNullOrEmpty(model.Picture9Url) && string.IsNullOrEmpty(model.Picture10Url) &&
                string.IsNullOrEmpty(model.Picture11Url) && string.IsNullOrEmpty(model.Picture12Url) &&
                string.IsNullOrEmpty(model.Picture13Url) && string.IsNullOrEmpty(model.Picture14Url) &&
                string.IsNullOrEmpty(model.Picture15Url))

Also, I've made the necessary changes to some files like that which are :
Controllers
WidgetsNivoSliderController.cs
Models
ConfigurationModel.cs
PublicInfoModel.cs
Views
Configure.cshtml
PublicInfo.cshtml
Plugins/Nop.Plugin.Widgets.NivoSlider
NivoSliderPlugin.cs
NivoSliderSettings.cs
Presentation\Nop.Web\Plugins\Widgets.NivoSlider\Views
Configure.cshtml
PublicInfo.cshtml

It was working fine before these changes. Any suggestion would be appreciated. Thanks
11 месяцев назад
sercim wrote:
this post.
This post looks to have a different model for the current version requirements

So you need to edited the PublicInfoModel and added something like the following for each new image ?

        public string Picture6Url { get; set; }
        public string Text6 { get; set; }
        public string Link6 { get; set; }
        public string AltText6 { get; set; }
11 месяцев назад
Yidna wrote:
So you need to edit the PublicInfoModel and added something like the following for each new image?
        public string Picture6Url { get; set; }
        public string Text6 { get; set; }
        public string Link6 { get; set; }
        public string AltText6 { get; set; }

You are talking about PublicInfoModel.cs in the Models folder. Yes, I added every single one of the new images.