Page 1 of 1

[Solved] Cataloger upgrade = in "Fatal error: Call to a member function Id()"

Posted: Wed Oct 15, 2008 3:45 am
by vaughnt
Hi all-

Hoping someone will have an idea here, my site is down. I upgraded from CMSMS 1.2.5 to 1.4.1.  (basically deleted all CMSMS files, did fresh install, but kept and upgraded old DB). The site itself is working fine, but Cataloger is not.

When I try to display a category in cataloger, I get:
Fatal error: Call to a member function Id() on a non-object in /home/vaughnt/public_html/modules/Cataloger/Cataloger.module.php on line 361

Example:  http://www.vaughnsphotoart.com/index.ph ... hotography


Item pages still work ok.  http://www.vaughnsphotoart.com/index.ph ... hole-falls


Here is part of the code in question...

Code: Select all

  function getCatalogItemsList(&$params)
  {
    global $gCms;

    $hm =& $gCms->GetHierarchyManager();
    $lastcat = "";

    if (isset($params['alias']) && $params['alias'] == '/')
      {
      $content = $hm->getFlatList();
      $curHierDepth = isset($params['start_depth'])?$params['start_depth']:-1;
      $curHierarchy = '';
      $curHierLen = 0;
      $curPage = new ContentBase();
      }
    else
      {
    if (isset($params['content_id']))
      {
        $curPageID = $gCms->variables[$params['content_id']];
        $curPageNode = $hm->sureGetNodeById($curPageID);
        $curPage = $curPageNode->GetContent();
      }
    else if (isset($params['alias']))
      {
        $curPageNode = $hm->sureGetNodeByAlias($params['alias']);
         $curPage = $curPageNode->GetContent();
        $curPageID = $curPage->Id();
      }
    else if (isset($gCms->variables['content_id']))
      {
        $curPageID = $gCms->variables['content_id'];
        $curPageNode = $hm->sureGetNodeById($curPageID);
        $curPage = $curPageNode->GetContent();
      }
    $curHierarchy = $curPage->Hierarchy();
    $curHierLen = strlen($curHierarchy);
    $curHierDepth = substr_count($curHierarchy,'.');
   
    $content = $this->getSubContent($curPageID);
      }
    $categoryItems = array();
    foreach ($content as $thisPage)
      {
    $thispagecontent = $thisPage->GetContent();
    if ($thispagecontent === false)
        {
        continue;
        }
    if (method_exists($thispagecontent,'Active') && !$thispagecontent->Active())
      {
        continue;
      }
    if ($thispagecontent->Id() == $curPage->Id())
      {
        continue;
      }

Line 361 is:         if ($thispagecontent->Id() == $curPage->Id())



Info:
CMSMS 1.4.1

Installed Modules:
    * CMSMailer: 1.73.14
    * MenuManager: 1.5.1
    * ModuleManager: 1.2.1
    * nuSOAP: 1.0.1
    * ThemeManager: 1.0.8
    * Cataloger: 0.7
    * TinyMCE: 2.4.5
    * Captcha: 0.3.1
    * FileManager: 0.4.1
    * Captcha: 0.3.1
    * Cataloger: 0.7


Php Information:
    * safe_mode: Off (False)
    * phpversion: 5.2.6
    * memory_limit: 40M
    * max_execution_time: 300
    * gd_version: 2
    * session_save_path: /tmp (1777)


Server Information:
    * Server Api: cgi
    * Server Db Type: MySQL (mysql)
    * Server Db Version: 5.0.51a


---SOLVED---

After help from a friend inserting much debug into the code, finally found out it was actually choking on Type(). It turns out that I had a few straggling content items that used the contentalias module. ContentAlias is not compatible with 1.4.1, so I had removed these items from the content table. Or so I thought. I must have had my SQL wrong, as they were still there.

After discovering the problem was with the Type, my friend found this post:
http://dev.cmsmadesimple.org/forum/mess ... sg_id=1012

Which suggested changing the content type from "contentalias" to "link".  I did this and it worked.

---/SOLVED---

Re: [Solved] Cataloger upgrade = in "Fatal error: Call to a member function Id()"

Posted: Wed Oct 15, 2008 7:21 am
by alby
vaughnt wrote: Which suggested changing the content type from "contentalias" to "link".  I did this and it worked.
Or "Internal Page Link" (Core alternative to ContentAlias)

Alby