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 5 of 5

Thread: Mapping product to customer level

  1. #1
    Rebecca.Mavidea is offline Junior Member
    Join Date
    Jun 2009
    Posts
    5

    Default Mapping product to customer level

    Hello,

    I'm working with a client that uses customer levels to hide products from certian customers.

    How can I use WSI to map a product to customer levels? I don't want to assign a price to the product for the customer level, just map it.

    Looked around in the forums and manual but didn't see an answer to this.

    Thanks!

    Rebecca

  2. #2
    George the Great is offline Senior Member
    Join Date
    Nov 2006
    Location
    Cleveland, OH
    Posts
    1,792

    Default

    There are two ways to do this. First, you can do it within the Product add/update node:
    Code:
    <AspDotNetStorefrontImport>
    <Product Action="Update" ID="1">
    <Mappings AutoCleanup="false">
    <CustomerLevel ID="1"/>
    <CustomerLevel Name="Customer Level 2"/>
    <CustomerLevel GUID="d733e74b-2e79-44e2-8903-0d0f8711174c"/>
    </Mappings>
    </Product>
    </AspDotNetStorefrontImport>
    or you can do it through a mappings node (yes the attributes are EntityType and EntityID...but it works all the same )
    Code:
    <AspDotNetStorefrontImport>
    <Mapping Action="Add" EntityType="CustomerLevel" EntityID="1" ObjectType="Product" ObjectID="1"/>
    </AspDotNetStorefrontImport>
    <a href="http://www.aspdotnetstorefront.com">Shopping Cart Software</a>

  3. #3
    Rebecca.Mavidea is offline Junior Member
    Join Date
    Jun 2009
    Posts
    5

    Default

    Awesome! Thanks!

  4. #4
    Rob is offline Senior Member
    Join Date
    Aug 2004
    Posts
    3,037

    Default

    Ha, that's cute. didn't realize that code would work, but yes, it does...
    I hate it when G1 knows WSI better than I do...
    AspDotNetStorefront
    Shopping Cart

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

    Default Not working for me

    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("&", "&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();
        }