Developers Stuffs . Lot of Programming tutorials on different lanuages like PHP, JAVA, webdesign, jquery

[[SOLVED]] Fatal Error In Magento (Dbp.php)

[[SOLVED]] Fatal Error In Magento (Dbp.php)

Fatal Error In Magento


While working on Magento some of us may face this fatal error on the Manage Categories page on the Admin part.

fatal Error : Fatal error: Call to a member function getId() on a non-object in
C:\xampp\htdocs\magento\lib\Varien\Data\Tree\Dbp.php on line 331


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);
        }

SOLUTION:

Run this SQL Query. This worked for me.


INSERT INTO catalog_category_entity(entity_id,entity_type_id,attribute_set_id,parent_id,created_at,updated_at,path,POSITION,level,children_count) VALUES (1,3,0,0,'0000-00-00 00:00:00','2009-02-20 00:25:34','1',1,0,1),(2,3,3,0,'2009-02-20 00:25:34','2009-02-20 00:25:34','1/2',1,1,0);

INSERT INTO catalog_category_entity_int(value_id,entity_type_id,attribute_id,store_id,entity_id,value) VALUES (1,3,32,0,2,1),(2,3,32,1,2,1);

INSERT INTO catalog_category_entity_varchar(value_id,entity_type_id,attribute_id,store_id,entity_id,value) VALUES (1,3,31,0,1,'Root Catalog'),(2,3,33,0,1,'root-catalog'),(3,3,31,0,2,'Default Category'),(4,3,39,0,2,'PRODUCTS'),(5,3,33,0,2,'default-category');

If you have any suggestions or still the error persists then please drop it comments.

7 comments:

  1. I also get this message after I deleted a second store and now my first store is not working but magento administration is working normaly. I have a lot of categories inside my magento and I'm affraid to execute above mentioned sql updates because I should lose my existing categories. What do you recommend? What does this queries actualy do?

    ReplyDelete
  2. This is a great post. I like this topic.This site has lots of advantage. It helps me in many ways.Thanks for posting this again.
    magento development company in bangalore 

    ReplyDelete
  3. Hi Admin,

    I met error: MySQL said: Documentation

    #1062 - Duplicate entry '1' for key 'PRIMARY'

    Please help

    ReplyDelete
  4. Could you please support about this error Doctor PC?

    ReplyDelete

ABOUT US

Dev Stuffs is an IT focussed webpage. We strive hard to bring useful content for the budding developers and future programmers. You will find short Programming tutorials and some useful tools for developers.
Happy Programming. :)