Hi Dynamicweb,
I am getting the error from the attached screenshot when trying to use a CartViewModel.
I am on Dynamicweb 9.3.5.
Is there something I am missing?
Best regards,
Rasmus
Developer forum
E-mail notifications
Cart view model not set
Replies
Hi Rasmus,
Cart templates do not support view models (yet), but you can use the Cart property when rendering a page like this...
@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> <!DOCTYPE html> <html> <head> <title>@Model.Title</title> </head> <body> <div> @if (Model.Cart != null) { <h2>Cart</h2> <p>@Model.Cart.TotalProductsCount</p> } <div> @Model.Placeholder("content") </div> </div> </body> </html>
See https://doc.dynamicweb.com/template-tags/introduction/concept/viewmodels
Best regards,
Morten
Hi Morten,
We are using view models just like you describe.
Thanks for the explanation.
Best regards,
Rasmus Westfall Andersen
Hi Morten,
When I click this link http://doc.dynamicweb.com/template-tags/introduction/concept/razor-templates-viewmodels, it shows 404 page.
May I know where can I find the Cart View Models.
Regards,
Tin Ma Ma
You can find it under template tags documentation.
See ViewModels.
Too see details about individual view models you can perform a search in the API section for "ViewModel".
Best regards,
Morten
You must be logged in to post in the forum