尝试使用 CSV 导入产品时在控制台中出现以下错误我正在使用 magento 核心导入功能
<b>Fatal error</b>: Call to a member function getName() on a non-object in <b>/home/magentosite/public_html/store/app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php</b> on line <b>377</b><br />
product.php 文件中第 377 行的函数没有更改核心文件
/**
* Initialize categories text-path to ID hash.
*
* @return Mage_ImportExport_Model_Import_Entity_Product
*/
protected function _initCategories()
{
$collection = Mage::getResourceModel('catalog/category_collection')->addNameToResult();
/* @var $collection Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection */
foreach ($collection as $category) {
$structure = explode('/', $category->getPath());
$pathSize = count($structure);
if ($pathSize > 2) {
$path = array();
for ($i = 2; $i < $pathSize; $i++) {
$path[] = $collection->getItemById($structure[$i])->getName(); ---> **This is line no 377**
}
$this->_categories[implode('/', $path)] = $category->getId();
}
}
return $this;
}
请问有人知道解决方案吗?我在 magento 1.6.2
:(