Click or drag to resize

ESDocumentProduct Class

Ecommerce standards document that contains a list of product records
Inheritance Hierarchy

Namespace:  EcommerceStandardsDocuments
Assembly:  EcommerceStandardsDocuments.Library (in EcommerceStandardsDocuments.Library.dll) Version: 1.3.0.0 (1.0.0.0)

The ESDocumentProduct type exposes the following members.

Constructors
Fields
  NameDescription
Public fieldconfigs
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.)
Public fielddataRecords
List of product records
Public fielddataTransferMode
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.)
Public fieldmessage
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.)
Public fieldresultStatus
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.)
Public fieldtotalDataRecords
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.)
Public fieldversion
Version of the Ecommerce Standards Document. Verifying the version of the document is critical for systems transferring and manipulating the data.
(Inherited from ESDocument.)
Top
Examples
An example of the Product Ecommerce Standards document in its JSON serialised form
{
    "version": 1.3,
    "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,productClass,keySellUnitID,unit,weight,width,height,depth,averageCost,warehouse,supplier,deliveryTimeNoStock,deliveryTimeInStock,stockQuantity,stockNoneQuantity,stockLowQuantity,stockLowQuantity,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":"",
            "productClass":"paper",
            "unit":"REAM",
            "weight": 20.1,
            "width": 21,
            "height": 29.7,
            "depth": 10,
            "averageCost": 10.00,
            "warehouse":"Swisho Warehouse",
            "supplier":"Swisho",
            "deliveryTimeNoStock": 112112,
            "deliveryTimeInStock": 1212,
            "stockQuantity": 200,
            "stockNoneQuantity": 0,
            "stockLowQuantity": 10,
            "isPriceTaxInclusive": "N",
            "isKitted":"N",
            "kitProductsSetPrice":"N",
            "keySellUnitID": 2,
            "ordering": 1,
            "sellUnits":[
                {
                    "keySellUnitID":"2"
                },
                {
                    "keySellUnitID":"3",
                    "keySellUnitParentID":"2",
                    "baseQuantity": "6"
                },
                {
                    "keySellUnitID":"4",
                    "keySellUnitParentID":"3",
                    "baseQuantity": "24",
                    "parentQuantity": "4"
                }
            ]
        }
    ]
}
An example of the Product Ecommerce Standards document in its JSON serialised form
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;
     }
    }
}
See Also