I just found this thread, which is exactly what I am trying to do.
I tried both ways, as part of a larger update statement, and it's not having any effect.
What i really need is, for my update NOT to override my previously mapped customer levels. here is the update code:
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("&", "&"));
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();
}