Magento Fatal error Call to a member function getName() on a non-object while import

Getting the following error in my console while trying to import products using CSV I am using magento core import functionality

<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 />

function in product.php file with line no 377 haven't changed core file

/** * 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; }

please can any one knows the solution for this? I am on magento 1.6.2

:(

Category:magento 1.6 Views:6 Time:2013-01-23

Related post

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.081 (s). 11 q(s)