Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 3 of 3

Thread: Product Update deletes Mappings

  1. #1
    avsune is offline Member
    Join Date
    Feb 2008
    Posts
    68

    Default Product Update deletes Mappings

    I have an upload tool, which, when used to update a product, its overriding my previously mapped customer levels. here is the update code: What do I need to change/add?

    Code:
            sbProductXML.Append("<AspDotNetStorefrontImport Verbose='true'><Transaction><Product Action='Update' ID='" + strProductID + "'>");
            sbProductXML.Append("<Name><![CDATA[");
            sbProductXML.Append(oRow["ProductName"].ToString());
            sbProductXML.Append("]]></Name>");
            sbProductXML.Append("<ProductType>");
            sbProductXML.Append(oRow["ProductType"].ToString());
            sbProductXML.Append("</ProductType>");
            sbProductXML.Append("<Display><XmlPackage>product.variantsinrightbar.xml.config</XmlPackage><ColWidth>4</ColWidth><PageSize>20</PageSize></Display>");
            sbProductXML.Append("<Images><ImageFilenameOverride>");
            sbProductXML.Append(oRow["ImageName"].ToString());
            sbProductXML.Append("</ImageFilenameOverride></Images>");
            sbProductXML.Append("<Summary><![CDATA[");
            sbProductXML.Append(oRow["Summary"].ToString());
            sbProductXML.Append("]]></Summary>");
            sbProductXML.Append("<Description><![CDATA[");
            sbProductXML.Append(oRow["Description"].ToString());
            sbProductXML.Append("]]></Description>");
            sbProductXML.Append("<MiscText>");
            sbProductXML.Append(oRow["SellingUnit"].ToString());
            sbProductXML.Append("</MiscText>");
            sbProductXML.Append("<SKU>");
            sbProductXML.Append(oRow["SKU"].ToString());
            sbProductXML.Append("</SKU>");
            sbProductXML.Append("<Mappings AutoCleanup='True'>");
    
            string strCategoryID = oRow["CategoryID"].ToString();
            long lngCategoryID = long.Parse(strCategoryID);
            if (lngCategoryID <= -1)
            {
                sbProductXML.Append("<Entity EntityType='Category' XPath='");
                sbProductXML.Append(oRow["Category"].ToString());
                sbProductXML.Append("'/>");
            }
            else
            {
                sbProductXML.Append("<Entity EntityType='Category' ID='");
                sbProductXML.Append(oRow["CategoryID"].ToString());
                sbProductXML.Append("'/>");
            }
    
    
            sbProductXML.Append("<Entity EntityType='Manufacturer' Name='");
            sbProductXML.Append(oRow["Manufacturer"].ToString().Replace("&", "&amp;"));
            sbProductXML.Append("'/>");
     
            sbProductXML.Append("</Mappings>");
            sbProductXML.Append("<Variants>");
            sbProductXML.Append("<Variant Action='Update' ID='" + strVariantID + "'>");
            sbProductXML.Append("<Name><![CDATA[");
            sbProductXML.Append(oRow["ProductName"].ToString());
            sbProductXML.Append("]]></Name>");
            sbProductXML.Append("<Description><![CDATA[");
            sbProductXML.Append(oRow["Description"].ToString());
            sbProductXML.Append("]]></Description>");
            sbProductXML.Append("<Price>");
            sbProductXML.Append(oRow["NetPrice"].ToString());
            sbProductXML.Append("</Price>");
            sbProductXML.Append("<IsTaxable>True</IsTaxable>");
            sbProductXML.Append("<FreeShipping>");
            sbProductXML.Append(oRow["FreeShipping"].ToString());
            sbProductXML.Append("</FreeShipping>");
            sbProductXML.Append("<MSRP>");
            sbProductXML.Append(oRow["ListPrice"].ToString());
            sbProductXML.Append("</MSRP>");
            sbProductXML.Append("<Weight>");
            sbProductXML.Append(oRow["Weight"].ToString());
            sbProductXML.Append("</Weight>");
            if (oRow["Dimensions"] != null)
            {
                string strDimensions = oRow["Dimensions"].ToString();
                string[] aDimesions = new string[3] { "0", "0", "0" };
                strDimensions = strDimensions.ToLower();
                Char[] aChar = new char[] { 'x' };
    
                aDimesions = strDimensions.Split(aChar, StringSplitOptions.RemoveEmptyEntries);
    
                sbProductXML.Append("<Dimensions>");
                sbProductXML.Append("<Height>");
                sbProductXML.Append(aDimesions[0]);
                sbProductXML.Append("</Height>");
                sbProductXML.Append("<Width>");
                sbProductXML.Append(aDimesions[1]);
                sbProductXML.Append("</Width>");
                sbProductXML.Append("<Length>");
                sbProductXML.Append(aDimesions[2]);
                sbProductXML.Append("</Length>");
    
    
                sbProductXML.Append(oRow["Dimensions"].ToString());
    
    
    
                //aDimesions[0]=
            }
    
    
            sbProductXML.Append("</Dimensions>");
            sbProductXML.Append("<Inventory>");
           // sbProductXML.Append(oRow["Inventory"].ToString());
            sbProductXML.Append("1000000");
            sbProductXML.Append("</Inventory>");
            sbProductXML.Append("<Published>");
            sbProductXML.Append("True");
            sbProductXML.Append("</Published>");
            sbProductXML.Append("<ExtensionData2>");
            sbProductXML.Append(oRow["Discount"].ToString());
            sbProductXML.Append("</ExtensionData2>");
            sbProductXML.Append("<ExtensionData3>");
            sbProductXML.Append(oRow["Markup"].ToString());
            sbProductXML.Append("</ExtensionData3>");
            sbProductXML.Append("<ExtensionData4>");
            sbProductXML.Append(oRow["InitialNetPrice"].ToString());
            sbProductXML.Append("</ExtensionData4>");
            sbProductXML.Append("</Variant></Variants>");
            sbProductXML.Append("</Product></Transaction></AspDotNetStorefrontImport>");
    
            return sbProductXML.ToString();
        }

  2. #2
    ASPAlfred is offline Senior Member
    Join Date
    Nov 2007
    Posts
    2,244

    Default

    Try to set the mapping AutoCleanup node to false.

    e.g.
    Code:
    sbProductXML.Append("<Mappings AutoCleanup='False'>");

  3. #3
    avsune is offline Member
    Join Date
    Feb 2008
    Posts
    68

    Default

    how will this affect the other mapping nodes?