Tôi đang làm việc với Magento 1.8. 0.0, tôi có một phiên bản thử nghiệm được cài đặt trên một máy chủ WAMP qua localhost và khi tôi muốn thêm loại của tôi nhận được lỗi sau:Lỗi nghiêm trọng: Gọi hàm thành viên getId() trên một đối tượng không trong C: wamp www magentno lib Varien Data Tree Dbp.php trên dòng 332
Fatal error: Call to a member function getId() on a non-object in C:\wamp\www\magentno\lib\Varien\Data\Tree\Dbp.php on line 332
tôi đã không được thực hiện một cửa hàng nhưng vì tôi cần phải loại cho rằng .
Tôi đã thêm mã try và catch vào dòng cung cấp lỗi.
này là mã mà cung cấp cho các lỗi:
public function loadEnsuredNodes($category, $rootNode)
{
$pathIds = $category->getPathIds();
$rootNodeId = $rootNode->getId();
$rootNodePath = $rootNode->getData($this->_pathField);
$select = clone $this->_select;
$select->order($this->_table.'.'.$this->_orderField . ' ASC');
if ($pathIds) {
$condition = $this->_conn->quoteInto("$this->_table.$this->_idField in (?)", $pathIds);
$select->where($condition);
}
$arrNodes = $this->_conn->fetchAll($select);
if ($arrNodes) {
$childrenItems = array();
foreach ($arrNodes as $nodeInfo) {
$nodeId = $nodeInfo[$this->_idField];
if ($nodeId<=$rootNodeId) {
continue;
}
$pathToParent = explode('/', $nodeInfo[$this->_pathField]);
array_pop($pathToParent);
$pathToParent = implode('/', $pathToParent);
$childrenItems[$pathToParent][] = $nodeInfo;
}
$this->_addChildNodes($childrenItems, $rootNodePath, $rootNode, true);
}
}
dòng này là kẻ giết người:
$rootNodeId = $rootNode->getId();
loại của bạn là 'NULL' nên sử dụng '->' trên phi vật thể (NULL) ném một lỗi nghiêm trọng. Bạn nên thêm mã nếu bạn muốn chúng tôi giúp bạn gỡ lỗi. – Debflav
tôi sẽ thêm mã ngay bây giờ – Djeroen
'$ root Node' là gì? '$ root Node' là NULL. – Debflav