添加产品以纪念服务器类别 [英] Add A Product to commerse server category

查看:55
本文介绍了添加产品以纪念服务器类别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi Frns

我必须在目录类别下添加产品。我可以在基础目录下添加产品,但我找不到任何方法将其存储在特定类别下。

I Have to add a Product under a category of a catalog. I am able to add a product to under base catalog but I din't find any method to store it under a specific category.

我的目录结构:

BaseCatalog

BaseCatalog

     --- Category1

     --- Category1

     --- Category2

     --- Category2

等等

如何在category1下放置新产品而不是在base目录下请帮助我

How can I place a new product under category1 instead of under base catalog Please help me

 

代码:

BaseCatalog

BaseCatalog

baseCatalog =(BaseCatalog)context .GetCatalog((字符串)行[" CatalogName编"]);

 

baseCatalog = (BaseCatalog)context.GetCatalog((string)row["CatalogName"]);
 

尝试

{

 

{
 

产品product = baseCatalog.CreateProduct((string)row [" DefinitionName"],

(string)row [" ProductID"],

Convert.ToDecimal(row [" ListPrice"]),(string)row [" CategoryName"]);

product.DisplayName =(string)row [" DisplayName"];

product [" ImageURL_Small"] = row [" Image"];

product [" Description"] = row [" Description"];

Product product = baseCatalog.CreateProduct((string)row["DefinitionName"],
(string)row["ProductID"],
Convert.ToDecimal(row["ListPrice"]), (string)row["CategoryName"]);
product.DisplayName = (string)row["DisplayName"];
product["ImageURL_Small"] = row["Image"];
product["Description"] = row["Description"];

product.Save();

}

product.Save();
}

 

我从excel中获取行值...

I am getting row values from a excel ...

 

提前致谢

 

推荐答案

/ /只需将您的产品添加到类别

product.AddParentCategory("您的父类别名称);

// To simply add your product to a category
product.AddParentCategory("Your Parent Category Name");

//要设置主要父类别,在保存之前执行此操作。
product.PrimaryParentCategoryName ="您的类别";

// To set the primary parent category, do this prior to the Save
product.PrimaryParentCategoryName = "Your Category";

享受。

 


这篇关于添加产品以纪念服务器类别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆