Hi,
Working on DW10
We are trying to extend the OrderViewModel.
The goal is to expose order-related documents on the frontend template.
What we've done so far:
-
Created a
CustomOrderViewModelthat extendsOrderViewModel -
Added properties like
List<Document> Invoices,List<Document> ShippingDocuments, andList<Document> OtherAttachments -
Created a
Documentclass with:-
Name -
Type -
CreatedDate/LastUpdatedDate -
DownloadUrl(with thedownloadattribute for browser download)
-
My main question is:
How are the properties I define in CustomOrderViewModel actually populated?
Sharing my code
Document Class
namespace Dna.Kent.Orders.Entities; public class Document { public string Name { get; set; } public string Type { get; set; } public DateTime CreatedDate { get; set; } public string DownloadUrl { get; set; } public Document() { //Default Constructor } public Document(string name, string type, DateTime createdDate, string downloadUrl) { Name = name; Type = type; CreatedDate = createdDate; DownloadUrl = downloadUrl; } }
CustomOrderViewModel
using Dynamicweb.Ecommerce.Frontend; namespace Dna.Kent.Orders.Entities; public class CustomOrderViewModel : OrderViewModel { public List<Document> shippingDocuments { get; set; } public List<Document> Invoices { get; set; } public List<Document> AdditionalAttachments { get; set; } public CustomOrderViewModel() { //Default Constructor } }