Cataloger 0.2 Module

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
mikemcvey
Forum Members
Forum Members
Posts: 61
Joined: Tue May 02, 2006 4:08 am

Cataloger 0.2 Module

Post by mikemcvey »

Hi,

I am hoping to use this module but need some help figuring out how to do this...
I have added a custom attribute to the items called - "summary"

I want this to show when I am looking at the catagory level.

So that user can see the
1] title
2] image
3] and summary

Any ideas how I would access this value from the category template?

Any help very appreciated as am pretty stuck on this one!
User avatar
sjg
Power Poster
Power Poster
Posts: 310
Joined: Thu Jan 27, 2005 5:11 pm
Location: Los Angeles, CA

Re: Cataloger 0.2 Module

Post by sjg »

This has actually been updated in SVN to support exactly that kind of thing.

The change is in cataloger/action.defaultcategory.php, around line 99. Before the line that contains

Code: Select all

			array_push($categoryItems,$thisItem);
paste in the following code:

Code: Select all

$theseAttrs = $thisPage->getAttrs();
foreach ($theseAttrs as $thisAttr)
{
$safeattr = strtolower(preg_replace('/\W/','',$thisAttr));
				$thisItem[$thisAttr] = $thisPage->GetPropertyValue($thisAttr);
}
You'll also need to add the attribute tag of your summary to your category template.

Keep in mind that this change imposes an overhead when displaying category pages, and can result in more database queries. But then, Cataloger is not a very efficient module, database-wise.
Many modules available from the http://dev.cmsmadesimple.org
The CMS Made Simple Developer Cookbook is now available from Packt Publishers!
mikemcvey
Forum Members
Forum Members
Posts: 61
Joined: Tue May 02, 2006 4:08 am

Re: Cataloger 0.2 Module

Post by mikemcvey »

Awesome... thanks!
HMTKSteve
Forum Members
Forum Members
Posts: 23
Joined: Fri May 26, 2006 5:56 pm

Re: Cataloger 0.2 Module

Post by HMTKSteve »

I could not find the line in my file...

I'm using cataloger 0.4.1
User avatar
sjg
Power Poster
Power Poster
Posts: 310
Joined: Thu Jan 27, 2005 5:11 pm
Location: Los Angeles, CA

Re: Cataloger 0.2 Module

Post by sjg »

No need to add it!

It's already built in to Cataloger 0.4.1

___Samuel___
Many modules available from the http://dev.cmsmadesimple.org
The CMS Made Simple Developer Cookbook is now available from Packt Publishers!
HMTKSteve
Forum Members
Forum Members
Posts: 23
Joined: Fri May 26, 2006 5:56 pm

Re: Cataloger 0.2 Module

Post by HMTKSteve »

I posted a question about this in a different forum http://forum.cmsmadesimple.org/index.ph ... 834.0.html and I have not been able to pull the values from the db to make it work.

Thanks!
User avatar
sjg
Power Poster
Power Poster
Posts: 310
Joined: Thu Jan 27, 2005 5:11 pm
Location: Los Angeles, CA

Re: Cataloger 0.2 Module

Post by sjg »

Doh!

The code posted here has the same bug as is in Cataloger 0.4.1 as well.

It should be

Code: Select all

{
$safeattr = strtolower(preg_replace('/\W/','',$thisAttr));
$thisItem[$safeattr] = $thisPage->GetPropertyValue($thisAttr);
}
I'll patch that, and release 0.4.2.

That way, the attribute will properly be the attribute name all lower cased and with only alphanumerics.

Sorry 'bout that.

___Samuel___
Many modules available from the http://dev.cmsmadesimple.org
The CMS Made Simple Developer Cookbook is now available from Packt Publishers!
HMTKSteve
Forum Members
Forum Members
Posts: 23
Joined: Fri May 26, 2006 5:56 pm

Re: Cataloger 0.2 Module

Post by HMTKSteve »

I'm getting a lot of use out of cataloger but I have a question...

I'm using the table layout to list game reviews and their pertinent information (http://www.thedicetower.com/thedicetower) but I was wondering if there is any easy way to allow the user to resort the catalog entries based on the Item Attributes I have addedd to each item?

For example we list publisher, designer and rating for each game. Currently the catalog lists all the reviews alphabeticaly but I would love for the user to be able to resort the displayed listing by product attribute.

If this is already possible, could you help me out?

Thanks!
User avatar
sjg
Power Poster
Power Poster
Posts: 310
Joined: Thu Jan 27, 2005 5:11 pm
Location: Los Angeles, CA

Re: Cataloger 0.2 Module

Post by sjg »

Unfortunately, sorting by attribute is not (yet) possible.

The other thing that I'm facing when working on my own site that uses Cataloger, is that if you have a menu that shows the child pages of a catalog section page, the menu does not re-order according to the ordering selected for the catalog section page. In other words, my catalpg section page displays the items alphabetically, but the menu still shows them in the hierarchy order.

I'm trying to think of the best way to approach this in order to make it make the most sense to the user.

If you have any suggestions, I'd love to hear them. Obviously, they'd also apply to other sort orders as they get added.

Thanks,
___Samuel___
Many modules available from the http://dev.cmsmadesimple.org
The CMS Made Simple Developer Cookbook is now available from Packt Publishers!
HMTKSteve
Forum Members
Forum Members
Posts: 23
Joined: Fri May 26, 2006 5:56 pm

Re: Cataloger 0.2 Module

Post by HMTKSteve »

climberusa
Forum Members
Forum Members
Posts: 126
Joined: Sun Feb 26, 2006 7:10 pm

Re: Cataloger 0.2 Module

Post by climberusa »

You'll also need to add the attribute tag of your summary to your category template.
Can someone explain the code I need to place in my category template to display item attributes at that level? I've added the code to my module and i couldn't figure it out. I even downloaded then latest version of cataloger and still have had no success. Can I just access the attributes like {$attribute} or am I missing something????
Post Reply

Return to “Developers Discussion”