使用WSI将ASPDNSF中的类别映射到制造商

本文关键字:映射 制造商 WSI ASPDNSF 使用 | 更新日期: 2023-09-27 18:04:08

如果我使用WSI服务将数据导入ASPDNSF,我有以下内容

            sb.AppendLine("<Mappings AutoCleanUp='"true'">");
        sb.AppendLine("<Entity EntityType='"Manufacturer'" ID='"" + ManufacturerID + "'" />");
        if (Category != null)
            sb.AppendLine("<Entity EntityType='"Category'" ID='"" + Category.CategoryID + "'" />");
        sb.AppendLine("")
        sb.AppendLine("</Mappings>");

目前所有的产品都被添加到制造商,但没有显示在产品/类别下,我希望有人能给我指出正确的方向,我想我需要利用

<Mappings AutoCleanup="boolean">
<Entity EntityType="Manufacturer|Distributor|Category|Section|Genre|Vector" Name="string" XPath="string" ID="integer" GUID="uniqueidentifier" DisplayOrder="integer"/>

是XML格式

这是完整的字符串生成器

public string ToXML()
    {
        StringBuilder sb = new StringBuilder();
        sb.AppendLine("<AspDotNetStorefrontImport SetImportFlag='"true'" Verbose='"true'" AutoLazyAdd='"true'">");
        sb.AppendLine("<Product Action='"" + Action.ToString() + "'" EnsureDefaultVariant='"true'" SKU='"" + SKU + "'"" + (GUID != null ? " GUID='"" + GUID + "'"" : "") + " Name='"" + System.Web.HttpUtility.HtmlEncode(Name) + "'">");
        sb.AppendLine("<Name>" + System.Web.HttpUtility.HtmlEncode(Name) + "</Name>");
        sb.AppendLine("<Summary>" + System.Web.HttpUtility.HtmlEncode(Name) + "</Summary>");
        sb.AppendLine("<SeAltText>" + System.Web.HttpUtility.HtmlEncode(Name) + "</SeAltText>");
        sb.AppendLine("<ProductType ID='"" + ProductTypeID + "'" />");
        sb.AppendLine("<Price>" + Price + "</Price>");
        sb.AppendLine("<Display>");
        sb.AppendLine("<XmlPackage>" + ConfigurationManager.AppSettings["XMLPackage"] + "</XmlPackage>");
        sb.AppendLine("</Display>");
        sb.AppendLine("<SKU>" + SKU + "</SKU>");
        sb.AppendLine("<Description>" + System.Web.HttpUtility.HtmlEncode(Description) + "</Description>");
        sb.AppendLine("<Published>" + InStock.ToString() + "</Published>");
        sb.AppendLine("<Images>");
        sb.AppendLine("<ImageFilenameOverride>" + ImageName + "</ImageFilenameOverride>");
        sb.AppendLine("</Images>");
        sb.AppendLine("<Mappings AutoCleanUp='"true'">");
        sb.AppendLine("<Entity EntityType='"Manufacturer'" ID='"" + ManufacturerID + "'" />");
        if (Category != null)
            sb.AppendLine("<Entity EntityType='"Category'" ID='"" + Category.CategoryID + "'" />");
        sb.AppendLine("")
        sb.AppendLine("</Mappings>");
        sb.AppendLine("<Variants AutoCleanup='"true'">");
        sb.AppendLine("<Variant Action='"Add'" Name='"" + System.Web.HttpUtility.HtmlEncode(Name) + "'">");
        sb.AppendLine("<IsDefault>true</IsDefault>");
        sb.AppendLine("<Name>" + System.Web.HttpUtility.HtmlEncode(Name) + "</Name>");
        sb.AppendLine("<Description>" + System.Web.HttpUtility.HtmlEncode(Description) + "</Description>");
        sb.AppendLine("<Price>" + Price + "</Price> ");
        sb.AppendLine("<Images>");
        sb.AppendLine("<ImageFilenameOverride>" + ImageName + "</ImageFilenameOverride>");
        sb.AppendLine("</Images>");
        sb.AppendLine("<MSRP>" + (SalesListPrice ?? OrigListPrice) + "</MSRP>");
        sb.AppendLine("<Cost>" + Cost + "</Cost>");
        sb.AppendLine("</Variant>");
        sb.AppendLine("</Variants>");
        sb.AppendLine("</Product>");
        sb.AppendLine("</AspDotNetStorefrontImport>");
        return sb.ToString();
    }
}

}

感谢您的帮助

迈克

使用WSI将ASPDNSF中的类别映射到制造商

Mike,

指定的类别是否存在?我没有使用id指定映射的经验,但是使用XPath属性有很多成功的经验。

<Entity EntityType="Category" Name="" XPath="/Products/NewCategoryName/" />

你能解决这个问题吗?