Magento 1.7 api - proxy.catalogcategorycreate()抛出错误

时间:2012-10-18 11:47:09

标签: c# magento

虽然我正在尝试使用api在magento中创建类别。它会为每个类别抛出错误 使用代码。

categoryEntity = new catalogCategoryEntityCreate();

string[] sortby_values;
    sortby_values = cat.available_sort_by.ToString().Split(',');
    currstore = 1;
//string[] sortby = new[] { "name", "price" };
string[] sortby;
sortby = sortby_values;// new[] { "name", "price" };
categoryEntity.available_sort_by = sortby;
rtbState.Text += "testing";
categoryEntity.default_sort_by = cat.default_sort_by; // "name";
//categoryEntity.available_sort_by = null;
//categoryEntity.default_sort_by = null;
categoryEntity.description = null;
categoryEntity.is_active =                           Convert.ToInt16(rectify_option(cat.is_active.ToString()));
categoryEntity.is_activeSpecified = cat.is_activeSpecified;
categoryEntity.include_in_menu = Convert.ToInt16(rectify_option(cat.include_in_menu.ToString()));
categoryEntity.include_in_menuSpecified = cat.include_in_menuSpecified;
categoryEntity.name = cat.Name;
WriteLine("Category with code : " + categoryEntity.name + " Created in magento Successfully.");
if (cat.Is_Anchor == Is_Anchor.Yes)
    categoryEntity.is_anchor = 1;
else
    categoryEntity.is_anchor = 0;
categoryEntity.is_anchorSpecified = true;
try
{   
    int categoryid = proxy.catalogCategoryCreate(sessionId, cat.parent_category_id , categoryEntity, "1" );
}

它在最后一行抛出错误。错误是:在非对象上调用成员函数getId()

1 个答案:

答案 0 :(得分:0)

它在magento 1.7.0.3中存在问题。 你必须改变一个设置。 管理/系统/结构/扩展/ dropdownmenu 禁用它(启用字段名称)下拉列表并禁用它。 现在使用api并成功创建类别..