ESDocumentProduct Class |
Namespace: EcommerceStandardsDocuments
The ESDocumentProduct type exposes the following members.
Name | Description | |
---|---|---|
ESDocumentProduct(Int32, String, ESDRecordProduct) | Constructor | |
ESDocumentProduct(Int32, String, ESDRecordProduct, DictionaryString, String) | Constructor |
Name | Description | |
---|---|---|
configs | A dictionary of additional configurations and settings to include with each Ecommerce Standard Document. Typically documents would contain the "dataFields" key that would have a comma delimited list of record properties that are expected to contain data when reading the document's records. Any records not containing data for properties in list could then have the data set to a default when saved to a database. (Inherited from ESDocument.) | |
dataRecords | List of product records | |
dataTransferMode | Denotes if the data being placed into document is a complete data set, or partial data being transferred containing only data changes. (Inherited from ESDocument.) | |
message | Message providing details of if the data could be obtained when requesting the document. The message gives meaning to the result status. (Inherited from ESDocument.) | |
resultStatus |
Code that denotes if the data could be successfully obtained for the document, and if not why.
See ESDocumentConstants Class for the list of status codes
(Inherited from ESDocument.) | |
totalDataRecords | The total number of records placed within document.
For documents that contain multiple record lists, please check the relevant documentation to see how this number applies.
(Inherited from ESDocument.) | |
version |
Version of the Ecommerce Standards Document.
Verifying the version of the document is critical for systems transferring and manipulating the data.
(Inherited from ESDocument.) |
{ "version": 1.5, "resultStatus": 1, "message":"The product data has been successfully obtained.", "dataTransferMode": "COMPLETE", "totalDataRecords": 2, "configs":{"dataFields":"keyProductID,productCode,keyTaxcodeID,productSearchCode,barcode,barcodeInner,brand,name,description1,description2,description3,description4,metaTitle,metaDescription,metaKeywords,productClass,keySellUnitID,unit,weight,width,height,depth,averageCost,warehouse,supplier,deliveryTimeNoStock,deliveryTimeInStock,stockQuantity,stockNoneQuantity,stockLowQuantity,stockLowQuantity,stockAvailableSinceDate,isPriceTaxInclusive,isKitted,kitProductsSetPrice"}, "dataRecords": [ { "keyProductID":"123A", "productCode":"PROD-123", "keyTaxcodeID":"FREE" }, { "keyProductID":"1234", "productCode":"PROD-001", "keyTaxcodeID":"GST", "productSearchCode":"Green-Recycled-Paper-Swisho", "barcode":"03423404230", "barcodeInner":"234234", "brand":"Swisho Paper", "name":"Swisho Green Paper", "description1":"Swisho green coloured paper is the ultimate green paper.", "description2":"Paper built strong and tough by Swisho", "description3":"Recommended to be used with dark inks.", "description4":"", "metaTitle":"Swisho green coloured paper", "metaDescription":"Swisho green coloured paper is the ultimate green paper that stands out above the rest.", "metaKeywords":"Swisho green coloured paper ultimate stationery printing environment nature", "productClass":"paper", "unit":"REAM", "weight": 20.1, "width": 21, "height": 29.7, "depth": 10, "widthUnitMeasureCode": "CM", "heightUnitMeasureCode": "CM", "depthUnitMeasureCode": "CM", "weightUnitMeasureCode": "KG", "averageCost": 10.00, "warehouse":"Swisho Warehouse", "supplier":"Swisho", "deliveryTimeNoStock": 112112, "deliveryTimeInStock": 1212, "stockQuantity": 200, "stockNoneQuantity": 0, "stockLowQuantity": 10, "stockAvailableSinceDate": 1726503215904, "isPriceTaxInclusive": "N", "isKitted":"N", "kitProductsSetPrice":"N", "keySellUnitID": 2, "ordering": 1, "sellUnits":[ { "keySellUnitID":"2", "minOrderQuantity": 1, "incrementOrderQuantity": 1, "weight": 1.2, "width": 6.1, "height": 4.4, "depth": 2.9, "packageWeight": 2.3, "packageWidth": 8.0, "packageHeight": 9.2, "packageDepth": 10.1, "widthUnitMeasureCode":"CM", "heightUnitMeasureCode":"CM", "depthUnitMeasureCode":"CM", "weightUnitMeasureCode":"KG" }, { "keySellUnitID":"3", "keySellUnitParentID":"2", "baseQuantity": 6, "minOrderQuantity": 2, "incrementOrderQuantity": 2, "weight": 7.3, "width": 6.1, "height": 4.4, "depth": 14, "packageWeight": 14.7, "packageWidth": 8.0, "packageHeight": 9.2, "packageDepth": 70.2, "widthUnitMeasureCode":"CM", "heightUnitMeasureCode":"CM", "depthUnitMeasureCode":"CM", "weightUnitMeasureCode":"KG" }, { "keySellUnitID":"4", "keySellUnitParentID":"3", "baseQuantity": 24, "parentQuantity": 4 } ] } ] }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using EcommerceStandardsDocuments; namespace MyApp { public class MyClass { /// <summary> Obtains a list of products records contained within an a products Ecommerce Standards Document</summary> public ESDocumentProducts getProducts() { List<ESDRecordProduct> products = new List<ESDRecord>(); Dictionary<string, string> docConfigs = new Dictionary<string, string>(); //create a new product Ecomerce Standards Document ESDocumentProduct productsDoc = new ESDocumentProduct(ESDocumentConstants.RESULT_ERROR_UNKNOWN, "Unable to get product data.", null, null); //create a record for a tea towel product ESDRecordProduct product1 = new ESDRecordProduct(); product1.keyProductID = "1"; product1.productCode = "PROD-1"; product1.name = "Tea Towels"; products.add(product1); //create another record for a kettle product ESDRecordProduct product2 = new ESDRecordProduct(); product2.keyProductID = "2"; product2.productCode = "PROD-2"; product2.name = "Kettle"; products.add(product2); //in the document configs list all the properties of the product records that are being set, any properties not in the list can be ignored by the system when processing the product records docConfigs.Add("dataFields","keyProductID,productCode,name"); productsDoc.configs = docConfigs; productsDoc.dataRecords = products.ToArray(); productsDoc.resultStatus = ESDocumentConstants.RESULT_SUCCESS; productsDoc.message = "Product data has been successfully obtained."; return productsDoc; } } }