OK, I think I've got to grips with the Cataloger module except for one thing; I can't get the Printable Catalog page to work.
As far as I understand it, all I need to do is create a page with content type Catalog (Printable) and the default template should output all your items.
However, on my page nothing between the {section}{/section} tags is output.
Am I missing something?
[Solved (sort of)] Cataloger module - Printable Catalog returns no results
-
stopsatgreen
- Power Poster

- Posts: 322
- Joined: Sat Feb 04, 2006 1:24 am
[Solved (sort of)] Cataloger module - Printable Catalog returns no results
Last edited by stopsatgreen on Tue Oct 02, 2007 11:14 am, edited 1 time in total.
-
alby
Re: Cataloger module - Printable Catalog returns no results
Check variable with:stopsatgreen wrote: OK, I think I've got to grips with the Cataloger module except for one thing; I can't get the Printable Catalog page to work.
As far as I understand it, all I need to do is create a page with content type Catalog (Printable) and the default template should output all your items.
However, on my page nothing between the {section}{/section} tags is output.
Am I missing something?
{$variable|print_r}
Alby
-
stopsatgreen
- Power Poster

- Posts: 322
- Joined: Sat Feb 04, 2006 1:24 am
Re: Cataloger module - Printable Catalog returns no results
The items should be listed in the array $items; when I use $items.print_r it returns 'Array'. When I use $items|@print it returns 0. In my catalog so far I have one category and two items, so it should be returning something, right?
Any idea what I'm missing?
Any idea what I'm missing?
-
alby
Re: Cataloger module - Printable Catalog returns no results
There is a bug. $content is empty alwaysstopsatgreen wrote: The items should be listed in the array $items; when I use $items.print_r it returns 'Array'. When I use $items|@print it returns 0. In my catalog so far I have one category and two items, so it should be returning something, right?
Any idea what I'm missing?
Code: Select all
function & getAllContent()
{
global $gCms;
$content = array();
$hm =& $gCms->GetHierarchyManager();
$rn = $hm->GetRootNode();
$count = 0;
$hm->getFlattenedChildren($rn, $content, $count);
return $content;
}
Alby
-
stopsatgreen
- Power Poster

- Posts: 322
- Joined: Sat Feb 04, 2006 1:24 am
Re: Cataloger module - Printable Catalog returns no results
I've filed this as a bug; fingers crossed someone addresses it soon, as I'm working on a project which needs this functionality.
Thanks for your help.
Thanks for your help.
-
Duketown
Re: [Solved (sort of)] Cataloger module - Printable Catalog returns no results
stopsatgreen, alby,
I did some digging and found the following:
alby noted that $content is always empty. Based upon this I searched internet for getFlattenedChildren. One of the results was:
http://trac.cmsmadesimple.org/cgi-bin/trac.cgi/changeset/2430?format=diff&new=2430.
Now there it showed a totally different detail of the function getFlattenedChildren. This function is part of the class Tree. This can be found in ..\lib\Tree\Tree.php on lines 215-218:
I changed the function with the part found in the trac result. So I commented out lines 215-218 and inserted the found part, which results in:
I saved the Tree.php source and only one error occured:
Fatal error: Call to a member function Alias() on a non-object in ..\modules\Cataloger\action.defaultprintable.php on line 45
Now this is an easy one:
Simply change curPage on line 47 in action.defaultprintable.php into thisPage:
I tested this on a 1.0.8 version. Brilliant.
I tested this in another site that runs on 1.1.2. Brilliant.
Well brilliant, I'm not that happy about the layout, but that is now a minor thing.
Are you able to test this, since Tree.php forms part of the core I would say.
Duketown
I did some digging and found the following:
alby noted that $content is always empty. Based upon this I searched internet for getFlattenedChildren. One of the results was:
http://trac.cmsmadesimple.org/cgi-bin/trac.cgi/changeset/2430?format=diff&new=2430.
Now there it showed a totally different detail of the function getFlattenedChildren. This function is part of the class Tree. This can be found in ..\lib\Tree\Tree.php on lines 215-218:
Code: Select all
function &getFlattenedChildren()
{
return $this->nodes->getFlatList();
}
Code: Select all
/* function &getFlattenedChildren()
{
return $this->nodes->getFlatList();
}
*/
function getFlattenedChildren(&$parentnode, &$nodelist, &$count)
{
$children =& $parentnode->getChildren();
if (isset($children) && count($children))
{
reset($children);
while (list($key) = each($children))
{
$onechild =& $children[$key];
$content =& $onechild->GetContent();
$content->flatIndex = $count;
array_push($nodelist, $content);
$count++;
$this->getFlattenedChildren($onechild, $nodelist, $count);
}
}
}
Fatal error: Call to a member function Alias() on a non-object in ..\modules\Cataloger\action.defaultprintable.php on line 45
Now this is an easy one:
Simply change curPage on line 47 in action.defaultprintable.php into thisPage:
Code: Select all
$this->imageSpec($curPage->Alias(), 'p', 1, $printThumbSize);
into:
$this->imageSpec($thisPage->Alias(), 'p', 1, $printThumbSize);I tested this in another site that runs on 1.1.2. Brilliant.
Well brilliant, I'm not that happy about the layout, but that is now a minor thing.
Are you able to test this, since Tree.php forms part of the core I would say.
Duketown
-
stopsatgreen
- Power Poster

- Posts: 322
- Joined: Sat Feb 04, 2006 1:24 am
Re: [Solved (sort of)] Cataloger module - Printable Catalog returns no results
That seems to have done the trick! Tested on 1.2, seems fine apart from one weird behaviour: if you use a template with more then one {content} area, the list outputs in all of them.
Now that it's working, there are more bugs to report...
Now that it's working, there are more bugs to report...
Last edited by stopsatgreen on Sun Nov 25, 2007 11:23 pm, edited 1 time in total.
