Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2004
    Posts
    24
    Plugin Contributions
    0

    Default Fatal error: Call to a member function on a non-object

    We have been running ZENCART for over 12 months now without a problem now when selecting certain root categories we get the message:

    Fatal error: Call to a member function on a non-object in /hsphere/local/home/jedko/milsims.com.au/test/includes/classes/category_tree.php on line 70

    Offending code snippet is:
    class category_tree {

    function zen_category_tree($product_type = "all") {
    global $db, $cPath, $cPath_array;
    if ($product_type != 'all') {
    $sql = "select type_master_type from " . TABLE_PRODUCT_TYPES . "
    where type_master_type = '" . $product_type . "'";
    $master_type_result = $db->Execute($sql);
    $master_type = $master_type_result->fields['type_master_type'];
    }
    $this->tree = array();
    if ($product_type == 'all') {
    $categories_query = "select c.categories_id, cd.categories_name, c.parent_id
    from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd
    where c.parent_id = '0'
    and c.categories_id = cd.categories_id
    and cd.language_id='" . (int)$_SESSION['languages_id'] . "'
    and c.categories_status= '1'
    order by sort_order, cd.categories_name";
    } else {
    $categories_query = "select ptc.category_id as categories_id, cd.categories_name, c.parent_id
    from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd, " . TABLE_PRODUCT_TYPES_TO_CATEGORY . " ptc
    where c.parent_id = '0'
    and ptc.category_id = cd.categories_id
    and ptc.product_type_id = '" . $master_type . "'
    and c.categories_id = ptc.category_id
    and cd.language_id='" . (int)$_SESSION['languages_id'] ."'
    and c.categories_status= '1'
    order by sort_order, cd.categories_name";
    }
    $categories = $db->Execute($categories_query, '', true, 150);
    while (!$categories->EOF) {
    $this->tree[$categories->fields['categories_id']] = array('name' => $categories->fields['categories_name'],
    'parent' => $categories->fields['parent_id'],
    'level' => 0,
    'path' => $categories->fields['categories_id'],
    'next_id' => false);

    if (isset($parent_id)) {
    $this->tree[$parent_id]['next_id'] = $categories->fields['categories_id'];
    }

    $parent_id = $categories->fields['categories_id'];

    if (!isset($first_element)) {
    $first_element = $categories->fields['categories_id'];
    }
    $categories->MoveNext(); // offending line
    }

    And the offending line is:

    $categories->MoveNext();

    My PHP is not that great but I have done some looking around and have establised the following:

    1) If I go to the admin module and expand the offending category it looks OK
    2) Browsing the category tables look OK

    Any help woulfd be much appreciated - thankyou
    Jon

  2. #2
    Join Date
    Mar 2005
    Posts
    1
    Plugin Contributions
    0

    Default Re: Fatal error: Call to a member function on a non-object

    got same problem but noticed in my old 1.2.4 version following difference (now 1.3.5) in line:

    $categories = $db->Execute($categories_query, '', false, 150);

    I changed it at the tree is working; i didn't found the explication of this parameter.
    Perhaps anyone else may tell.

 

 

Similar Threads

  1. v151 Fatal error: Call to a member function on a non-object
    By joejoejoe in forum General Questions
    Replies: 1
    Last Post: 8 Jan 2013, 11:53 PM
  2. Fatal error: Call to a member function on a non-object
    By alkayem in forum Installing on a Linux/Unix Server
    Replies: 5
    Last Post: 11 Feb 2008, 08:50 AM
  3. Replies: 6
    Last Post: 4 Jun 2007, 11:42 PM
  4. Fatal error: Call to a member function on a non-object
    By [email protected] in forum Installing on a Linux/Unix Server
    Replies: 1
    Last Post: 16 Jan 2007, 03:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg