Close

Support multiple rows

nopsww
6 years ago
#14347 Quote
Avatar
  • 4
[u][/u]Good evening, in a project I work we're using the nop jcarousel plugin and it works great for most of the thing that we wanna display, until now.

I'm using a carousel in the homepage in order to display selected categories, and also display them in 2 rows of 10 items. So that would be something like that.

itemsToDisplay:10
loopItems:false
dotsNav: false
arrowNav:false
row : 2


Unfortunately, the latest version of JCarousel doesn't support the rows option, I have tried editing the
\SevenSpikes.Nop.Plugins.JCarousel\Views\Components\JCarousel\JCarousel.cshtml
and add a rows property in the declaration of the jCarousel and it works.

I have thought of extending the JCarouselEntitySetting class in the respective .dll (as shows http://docs.nopcommerce.com/pages/viewpage.action?pageId=1442499) but is that possible or can you suggest another way to achieve what I'm looking for?

SDobrev
6 years ago
#14350 Quote
Avatar
  • 283
Hi,

Unfortunately, the source code of the JCarousel plugin is not open for modifications so you cannot modify the "JCarouselEntitySetting" class.

You can create a hidden setting from the All Settings page ("JCarouselCustomSettings.NumberOfRows" for example) and use it in the "\SevenSpikes.Nop.Plugins.JCarousel\Views\Components\JCarousel\JCarousel.cshtml" view.
Code example for nopCommerce 4.0:

@inject ISettingService settingService
@inject IStoreContext storeContext

@{
    var storeId = storeContext.CurrentStore.Id;
    var numberOfRows = settingService.GetSettingByKey("JCarouselCustomSettings.NumberOfRows", 1, storeId, true);
}


Best Regards,
Stoyan Dobrev
Nop-Templates.com
nopsww
6 years ago
#14362 Quote
Avatar
  • 4
Hi, thank toy for your response and your approach.

I will take a look at it.

Thank you!
nopsww
6 years ago
#14363 Quote
Avatar
  • 4
So I took a look at it and here is the thing,

IF
-I create this custom setting and
-then retrieve the value in the JCarousel.cshtml
-and add to the carousel initialization code

every JCarousel will have 2 rows, while I only need it for one specific.

This is why I was looking at the JCarouselEntitySetting.
SDobrev
6 years ago
#14364 Quote
Avatar
  • 283
Hi,

If you want a specific carousel to be in 2 rows you can set the raw parameter only if the carousel is with specific Id. In the JCarousel.cshtml view you will find the Id in the Model.Settings.Id
Best Regards,
Stoyan Dobrev
Nop-Templates.com
nopsww
6 years ago
#14373 Quote
Avatar
  • 4
SDobrev wrote:
Hi,

If you want a specific carousel to be in 2 rows you can set the raw parameter only if the carousel is with specific Id. In the JCarousel.cshtml view you will find the Id in the Model.Settings.Id


Once again thank you for your response, I'd like to use this as last resort since it's not really maintainable and can get lost in future updates. Or maybe the rows option is added to JCarousel.
SDobrev
6 years ago
#14375 Quote
Avatar
  • 283
Hi,

You can suggest your idea about adding the Rows settings in the JCarousel in our UserVoice portal. The main problem is that there will be styling issues on most of the pages if the carousel is in multiple rows.
Best Regards,
Stoyan Dobrev
Nop-Templates.com