Developer forum

Forum » Development » ProductViewModel how to get Images that are not based on Pattern (EcomDetails)

ProductViewModel how to get Images that are not based on Pattern (EcomDetails)

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

I am trying to adjust a template to use ProductViewModel. I have checked the properties and I could find ImagePatternImages but I could not find a property listing the images that are assigned manually.

How do I get a hold of those images? Should I use AssetCategories instead?

Thank you,

Adrian


Replies

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

[Update]

I have tried the AssetsCategories approach but I only got the Assets node under each AssetCategory. There is no way I can identify each AssetCategory.

Here is the output of the AssetCategory model:
{'Assets':[{'Value':'/Files/Images/Ecom/Products/GF-0639_1.jpg','Name':'ImportedDETAIL1240'},{'Value':'/Files/Images/Ecom/Products/GF-0639_2.jpg','Name':'ImportedDETAIL1241'}]}{'Assets':[{'Value':'/Files/DigitalAssets/Manuale/GF-0639.pdf','Name':'DETAIL1773'}]}

The trouble is that some products have more Asset categories filled in and I cannot use a convention based on order.

Thank you,

Adrian

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

Hi Adrian,

You are on the right track :)

The AssetCategories property on the ProductViewModel gives you a list of AssetCategoryViewModel.
The AssetCategoryViewModel has both Name and SystemName.

Here is an example:

{
  "AssetCategories": [
    {
      "Name": "Images",
      "SystemName": "Images",
      "Assets": [
        {
          "Value": "/Files/Images/test2.jpg",
          "Name": "DETAIL2",
          "Keywords": "",
          "DisplayName": ""
        }
      ]
    },
    {
      "Name": "TestAssetCategory1",
      "SystemName": "TestAssetCategory1",
      "Assets": [
        {
          "Value": "/Files/Images/test1.jpg",
          "Name": "DETAIL1",
          "Keywords": "",
          "DisplayName": ""
        }
      ]
    }
  ]
}

Are you using the "Product catalog for ViewModel" app?
Check the app settings for "Asset Categories" and make sure you have included the values you need.

If you still can't make it work then I think we need some more details.
How and where are you trying to use this?
Which version of Dynamicweb is this?

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Morten,

Thank you for the suggestion.

I am working on a Feed template and the solution is 9.9.8.

My expectation was to see exactly what you posted but I only get the Assets node and inside the Assets node, I get only Values and Name.

And I have checked the Feed settings and I have noticed that I also need to add SystemName and Name:

Thank you for your help.

Adrian

 

You must be logged in to post in the forum