Close

Customdatasource

hanz
11 years ago
#1551 Quote
Avatar
  • 19
Hi,

How can I define certain products to make use of the Customdatasource in the SevenSpikes.JCarousel.Admin.Settings.DataSourceType section ?

Thanks in advance!
IvanStoyanov
11 years ago
#1556 Quote
Avatar
  • 269
hanz wrote:
Hi,

How can I define certain products to make use of the Customdatasource in the SevenSpikes.JCarousel.Admin.Settings.DataSourceType section ?

Thanks in advance!


Hi hanz,

Please refer to our online documentation section 2.1 http://www.nop-templates.com/Help/NopJCarousel/Version_2_6/lessons/Integration.html

You need to pass IEnumerable<ProductOverviewModel> as a data source.

Thank you for choosing our products! Your feedback is important to us!
hanz
11 years ago
#1704 Quote
Avatar
  • 19
Hi,

How and where exactly do I pass " IEnumerable<ProductOverviewModel> "  

I tried to add:

@Html.Action("JCarousel", "JCarousel", new {carouselName = "Custom Data Source", productModels = Model.CustomProductModels})*@

to index.cshtml in electr/views/home/ but receive an error.

I changed the name Custom Data Source to the system name I gave in admin, but I gues that's not the way to do it.

Thanks for any help!
Hans

Boyko
11 years ago
#1712 Quote
Avatar
  • 1570
hanz wrote:
Hi,

How and where exactly do I pass " IEnumerable<ProductOverviewModel> "  

I tried to add:

@Html.Action("JCarousel", "JCarousel", new {carouselName = "Custom Data Source", productModels = Model.CustomProductModels})*@

to index.cshtml in electr/views/home/ but receive an error.

I changed the name Custom Data Source to the system name I gave in admin, but I gues that's not the way to do it.

Thanks for any help!
Hans



Hi hanz,

Probably it is not very well explained in the documentation of the plugin.
The data that you pass to the productModels argument should be of type IEnumerable<ProductOverviewModel>. The code above is a sample code that gives you an example. Basically to the custom datasource is intended for more advanced scenarios and you need to be familiar with MVC and how nopCommerce works. A sample scenario is to show a set of products that you have in a custom view in a nice carousel and take advantage of the JCarousel plugin visualization.

Please let us know if you want us to elaborate more on this!

Best Regards,
Nop-Templates Support Team
Regards,
Nop-Templates.com Team
hanz
11 years ago
#1713 Quote
Avatar
  • 19
Hi, Thanks for your reply. If I understand well, I need to pass the id's of the products I'd like to show in the JCaroussel to the ProductOverviewModel.

So I tried:

@Html.Action("JCarousel", "JCarousel", new {carouselName = "Winter 2012", productModels = "1667,1668,1669"})

where `Winter 2012` is the caroussel name and the id`s are the product is`s I`d like to show in the caroussel. This gives no errors, but nothing happens.

I also tried like:  productModels = 1667,1668,1669 and 1667;1668;1669 etc but receive errors then.

Can you please tell me in detail what to do when I want to show the product id's 1667,1668,1669 in the custom data source caroussel ?

Thanks!
IvanStoyanov
11 years ago
#1715 Quote
Avatar
  • 269
hanz wrote:
Hi, Thanks for your reply. If I understand well, I need to pass the id's of the products I'd like to show in the JCaroussel to the ProductOverviewModel.

So I tried:

@Html.Action("JCarousel", "JCarousel", new {carouselName = "Winter 2012", productModels = "1667,1668,1669"})

where `Winter 2012` is the caroussel name and the id`s are the product is`s I`d like to show in the caroussel. This gives no errors, but nothing happens.

I also tried like:  productModels = 1667,1668,1669 and 1667;1668;1669 etc but receive errors then.

Can you please tell me in detail what to do when I want to show the product id's 1667,1668,1669 in the custom data source caroussel ?

Thanks!


IvanStoyanov wrote:

You need to pass IEnumerable<ProductOverviewModel> as a data source.


Thank you for choosing our products! Your feedback is important to us!
Boyko
11 years ago
#1717 Quote
Avatar
  • 1570
hanz wrote:
Hi, Thanks for your reply. If I understand well, I need to pass the id's of the products I'd like to show in the JCaroussel to the ProductOverviewModel.

So I tried:

@Html.Action("JCarousel", "JCarousel", new {carouselName = "Winter 2012", productModels = "1667,1668,1669"})

where `Winter 2012` is the caroussel name and the id`s are the product is`s I`d like to show in the caroussel. This gives no errors, but nothing happens.

I also tried like:  productModels = 1667,1668,1669 and 1667;1668;1669 etc but receive errors then.

Can you please tell me in detail what to do when I want to show the product id's 1667,1668,1669 in the custom data source caroussel ?

Thanks!


Hi hanz,

The JCarousel custom data source is a source of products and the data for this products should be of type ProductOverviewModel. So it is not enough to pass the id of the product. You have to create a controller that builds and returns a list(IEnumerable) of ProductOverviewModel objects. Then in this controller you can use the IDs of your products to get them and build the list of ProductOverviewModel objects just like it is done in the CatalogController. To create your own controller you need to be familiar with MVC and nopCommerce and use the CatalogController as an example or simply add a new Action to the CatalogController class i.e Winter2012Products and use it to return a view that have IEnumerable<ProductOverviewModel> as a model and then pass this model to the JCarousel as a custom data source.

Hope this is more clear now how the custom data source is intended to be used.

Best Regards,
Nop-Templates Support Team
Regards,
Nop-Templates.com Team
dincaykirtasiye
10 years ago
#3853 Quote
Avatar
  • 4
Hi to everyone;
I have created custom action in Catalogcontroller..Action name ise "MyHomePageProducts"

Now how this line should be for my case?

Should  it be something like that:
@Html.Action("JCarousel", "JCarousel", new {carouselName = "JCarousel Name", productModels = Catalog.MyHomePageProducts})

Boyko
10 years ago
#3860 Quote
Avatar
  • 1570
dincaykirtasiye wrote:
Hi to everyone;
I have created custom action in Catalogcontroller..Action name ise "MyHomePageProducts"

Now how this line should be for my case?

Should  it be something like that:
@Html.Action("JCarousel", "JCarousel", new {carouselName = "JCarousel Name", productModels = Catalog.MyHomePageProducts})



Hi dincaykirtasiye,

If you have created a new action then this action should return a view i.e MyHomePageProducts.cshtml and the model that is passed to this view should be of type IEnumerable<ProductOverviewModel>. You can refer to the HomepageProducts action in the Catalog controller and the Views\Catalog\HomepageProducts.cshtml view. What you should do is basically the same.
Then in the MyHomePageProducts.cshtml view you can add this line:

@Html.Action("JCarousel", "JCarousel", new {carouselName = "JCarousel Name", productModels = Model})

Hope this helps!

Best Regards,
Nop-Templates.com Team
Regards,
Nop-Templates.com Team
dincaykirtasiye
10 years ago
#3864 Quote
Avatar
  • 4
thank you very much !