Developer forum

Forum » Dynamicweb 10 » Product feed does not expose custom product field

Product feed does not expose custom product field

Jelle Deridder
Reply

Hi,

I’m building a product feed using the standard JSON template:

@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Ecommerce.ProductCatalog.ProductListViewModel>
@Model.ToJson()
 

I need to output CategoryPath (stored in EcomProducts.CategoryPath) in the JSON feed.


 

What I’ve done/verified:

  • EcomProducts.CategoryPath is filled in the database.

  • In the repository index (Products.index) I can see the field exists (e.g. CustomField_CategoryPath / CategoryPath is visible in “Browse index” / “Index document fields”).

  • In the query (Products.query) I added:

<ViewFields>
<Field Name="CategoryPath" />
</ViewFields>
 

and rebuilt the index.

  • In the Feed Provider UI for the feed, CategoryPath is selected under “Product Custom Fields”.

Still:

  • @Model.ToJson() does not include CategoryPath anywhere.

So it looks like CategoryPath is not exposed on ProductViewModel/ProductListViewModel, even though it’s available in DB and the index and is selected in the feed provider.

How can I expose CategoryPath in ProductListViewModel/ProductViewModel so it’s available in templates/feeds?

Thanks!


Replies

 

You must be logged in to post in the forum