Developer forum

Forum » Ecommerce - Standard features » Product Catalogue for ViewModel app

Product Catalogue for ViewModel app

Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi,

 

I love the concept of the new App, only "paying" for the data we need. I was trying to apply it to a customer, where in the Product list I want a very basic piece of data, which is very different than the product detail page (with a bit more information) and I struggled to set it up accurately.

 

Product data for Product List

  • Name
  • Id
  • Number Image
  • 2 or 3 custom fields
  • No variant combinations, no related product, no pricing

 

Product data for Product Detail template

  • A different list of fields

 

There seems to not be a way to have "None" as some of the options, is that accurate? Unless nothing is processed if we don't choose Related Products from the Product properties list.

https://www.screencast.com/t/eTdeT3AqGu

 

I did not see BOM items listed etiher. Are they not developed yet?

 

Best Regards,

Nuno Aguiar


Replies

 
Martin Vang
Martin Vang
Reply

Hi Nuno,

Sorry about the delay - I missed your question in all the others, but luckily somebody told med to recheck. (Y)

I think your question is an important and very interesting one, because of the way viewmodels work. So I'll have to explain some details in depth a bit more thourghly than what is probably needed to explain the whole toolset. In general we have 2 different ways of rendering data from a viewmodel:

1. Viewmodels in webservices

2. Viewmodels in templates (razor)

For #1, we need to specify which properties to fill, to make sure that we only get exactly the needed data. This is because, we use a json-serializer, which accesses all properties and writes json to match the viewmldels and their proerties. Here all properties are accessed.

For #2, we have a different setup. When use a viewmodel in a razor-template, we have an object with a number of properties, and only the needed properties are accessed. Since all the expensive ones are lazy-loaded, this means, that you only pay for the properties you use. So in general, you can leave all properties "active" in the viewmodel catalog without having to pay the price for them! They only "cost" something, if you access them in the template.

The reason why you get to choose to toggle the properties from backend is, that our own templatesets will probably be written in such a way, that they change the way the page is rendered, based upon what information is available. This scenario is a bit more difficult than what I would suspect a typical customer requires, so it can probably be ignored unless a specifc need arises.

 

Hope this explaination helps.

BR

Martin

 

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

That's very helpful, thanks Martin. In your explanation, did you swap #1 and #2 around?

 
Martin Vang
Martin Vang
Reply

No! I make no mistakes!

Just kidding. I edited the post to make it readable. Thanks for helping me out with 1+2 :) !

BR

Martin

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Martin,

 

Your explanation is very helpful and does help me understand the differences better, thank you. I will be bookmarking this thread, because I am sure I will have a use for it in the future.

 

Best Regards,

Nuno Aguiar

 

You must be logged in to post in the forum