Developer forum

Forum » Dynamicweb 9.0 Upgrade issues » DW9 E-commerce razor approach - ProductViewModel vs RazorTemplateBase

DW9 E-commerce razor approach - ProductViewModel vs RazorTemplateBase

Kevin Steffer
Kevin Steffer
Reply

In our transformation to Dynamicweb 9.x we are investigation how we can optimize our Razor templates using models instead of template tags for the Ecommerce module.

In the documentation we've found ProductViewModel, is that "Production Ready"?

Is ProductViewModel only for the "Product Details View" since it doesn't provide a collection of Product?

Is your recommendation to use ViewModels or the RazorTemplateBase?


Replies

 
Nicolai Pedersen
Reply

Hi Kevin

Not quite.

Viewmodels are currently available for Layouts and Paragraphs only. If you have a page or paragraph with an item on it, it can have a field of type product. The ProductViewModel is currently only available in the context of an item.

Giving you a view model for the product catalog is on the todo, but also a very comprehensive task - probably in combination with a new frontend module for the product catalog.

Hope this clarifies.

BR Nicolai

 
Kevin Steffer
Kevin Steffer
Reply

I can see your DW9 API documentation is ahead of the real world :)

https://doc.dynamicweb.com/PageURL#article=e4c41c6a-e817-6aed-1db9-5c9f9b0c8e06

When is Ecommerce 1.7.0 released?

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

Hi Kevin,

The new ecommerce view models are also included in the 9.5 and 9.6 release (Dynamicweb.Ecommerce 1.5.*, Dynamicweb.Ecommerce 1.6.*)
You can use these view models with the new paragraph app called "Product catalog for ViewModel" instead of the older catalog.

In your razor templates you can use one of the following @inherits declarations:

Product list template

@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Ecomerce.ProductCatalog.ProductListViewModel>

Product details template

@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Ecomerce.ProductCatalog.ProductViewModel>

Best regards,
Morten

 

You must be logged in to post in the forum