Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

Another Zoo recipe

Another Zoo recipe

Hi,

some while ago you helped me out with a Zoo recipe for items and categories. categories are part of catalogs and when I want to display a certain module with a catalog view page the recipes you gave me are (obviously) not working. It would be great if you could have a look...

Thanks a lot
Rooney

Edit: Sorry, here is the link to the previous thread: http://www.metamodpro.com/forums/topic?id=171

Edited By: Rooney
01-Oct-10 10:30:05

Rooney
Beginner Modder
ranks
useravatar
Offline
16 Posts
Administrator has disabled public posting

Re: Another Zoo recipe

Hi Rooney,

I'll take a look at this 1st thing next week.

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3328 Posts
User info in posts
Administrator has disabled public posting

Re: Another Zoo recipe

Hi again,

I installed the free version of Zoo but it doesn't include the "catalog" application so I don't think I can advise. Is it actually named "catalog" or do you mean "category"? Or, do you mean that you need to detect any page that's part of the particular Zoo "Application" (by application id)? Which application are you using?

Perhaps you could post a dump of the database table column names and types...

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3328 Posts
User info in posts
Administrator has disabled public posting

Re: Another Zoo recipe

Hi,

sorry for the late reply. I've been trekking in the Nepal Himalaya for about 4 weeks (in Germany, you know, we have lot's of vacation... ;-) ).

In the old Zoo version (don't know about the 2.X versions) one has to create catalogs which can contain categories. These catalogs have an own id. I have attached a dump with the Zoo catalog and category tables.

Actually, did not find a possibility to attach files. So, here's the dump source code.

Code:

CREATE TABLE `#__zoo_core_catalog` (

  `id` int(11) NOT NULL auto_increment,
  `name` varchar(255) collate latin1_german2_ci NOT NULL,
  `alias` varchar(255) collate latin1_german2_ci NOT NULL,
  `description` text collate latin1_german2_ci NOT NULL,
  `params` text collate latin1_german2_ci NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `ALIAS_INDEX` (`alias`)
)

Code:

CREATE TABLE `#__zoo_core_category` (

  `id` int(11) NOT NULL auto_increment,
  `catalog_id` int(11) NOT NULL,
  `name` varchar(255) collate latin1_german2_ci NOT NULL,
  `alias` varchar(255) collate latin1_german2_ci NOT NULL,
  `description` text collate latin1_german2_ci NOT NULL,
  `parent` int(11) NOT NULL,
  `ordering` int(11) NOT NULL,
  `published` tinyint(1) NOT NULL,
  `params` text collate latin1_german2_ci NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `ALIAS_INDEX` (`alias`),
  KEY `CATALOG_INDEX` (`catalog_id`)
)

Code:

CREATE TABLE `#__zoo_core_category_item` (

  `catalog_id` int(11) NOT NULL,
  `category_id` int(11) NOT NULL,
  `item_id` int(11) NOT NULL,
  PRIMARY KEY  (`catalog_id`,`category_id`,`item_id`)
)

Thanks a lot!
Rooney

Rooney
Beginner Modder
ranks
useravatar
Offline
16 Posts
Administrator has disabled public posting

Re: Another Zoo recipe

Ok, thanks for these. Now, to try to tie everything together, could you give me an example URL (sef off) for one of the pages where you want the module to appear?

If you have SEF on, then it's better to give me the output from the MetaMod Advanced Debug on that page.

Also can you tell me if you want to output specific modules for specific catalogs? Or is it just a matter of "only display this module on Catalog pages"? Or "Display this module on all item pages where the item is in a specific catalog (via category)".

The details are important smile

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3328 Posts
User info in posts
Administrator has disabled public posting

Re: Another Zoo recipe

Hi Stephen,

first of all, is it possible to get an automatic e-mail notification if a new reply post is available? Would be helpful. (Update: Ups, just saw the subscription option...)

I decided to make the big step and updated the page from Z00 1 to Zoo 2. The way how the path is build has changed:

Root category view:

Old

Code:

option=com_zoo&view=category&layout=category&Itemid=820

New

Code:

index.php?option=com_zoo&view=category&layout=category&Itemid=820

Category view:

Old

Code:

Itemid=820&option=com_zoo&view=category&category_id=2

New

Code:

option=com_zoo&task=category&category_id=202&Itemid=820

Item view:

Old

Code:

Itemid=820&option=com_zoo&view=item&category_id=186&item_id=85

New

Code:

option=com_zoo&task=item&item_id=1516&category_id=214&Itemid=820

I want to archive three options:
- Display module on item view
- Display module on category view
- Display module on all item views that belong to one category

It would be great if you could help me out!

Cheers
Rooney

Rooney
Beginner Modder
ranks
useravatar
Offline
16 Posts
Administrator has disabled public posting

Re: Another Zoo recipe

Hi Rooney, thanks for sending the updated URLs. They are a big help. The main difference seems to be that the new one uses "task=" instead of "view=".

Try this:

$task = JRequest::getVar("task");
// check for item view
if ( $option == 'com_zoo' and $task == 'item') return WWW;
// check for category view
if ( $option == 'com_zoo' and $task == 'category') return XXX;
// check for all items in item view that belong to a certain category
if ( $option == 'com_zoo' and $task == 'item' ) {
  $category_id = JRequest::getVar("category_id");
  if ($category_id == 1) return YYY; // module YYY for category 1
  if ($category_id == 2) return ZZZ; // module ZZZ for category 1
}

Replace WWW-ZZZ with the appropriate module ids for each situation.

Hope that helps,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3328 Posts
User info in posts
Administrator has disabled public posting

Re: Another Zoo recipe

Excellent, worked perfectly. Thanks a lot.

I have two more issues. Lining to a root category gives the following code:

Code:

index.php?option=com_zoo&view=category&layout=category&Itemid=820

Linking directly to an item gives:

Code:

index.php?option=com_zoo&view=item&layout=item&Itemid=682

Both times Itemid has nothing to do with the actual Item or Category ID

By the way, can I put the code into the Zoo forum?

Rooney

Rooney
Beginner Modder
ranks
useravatar
Offline
16 Posts
Administrator has disabled public posting

Re: Another Zoo recipe

Hi Rooney,

yes, as you have discovered, when you create a menu item to an item in Joomla, this frequently means that the id of the item does not get put into the URL. The "Itemid" that you see in the URL actually refers to the id of the Menu Item. Joomla uses this to look up the rest of the parameters for that menu item in the database.

This means it's a bit more tricky to get hold of that id number. You can't just assume that every time you see "Itemid=820" that it's going to be displaying a certain content item, because the Itemid numbers may stay the same if the user pages through a set of items (for example), or views a detail page from a list of items.

What you can safely assume is that if the URL is exactly "index.php?option=com_zoo&view=category&layout=category&Itemid=820" then it's always going to display a certain category. So you can check for that exact URL.

You can *probably* assume that if the request includes Itemid=820, and if there's no category_id or item_id mentioned then it will be displaying a certain category.

In your case I guess that you don't have many of these menu items linking to particular categories or items. So to keep it all simple you could just check for particular URLs and assume the category/item ids from them.

e.g.

if ( $core_genius->check('url = http://mysite.com/index.php?option=com_ … =820' ) ) return XXX;


Hope that helps,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3328 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5933
Posts this week:
4
User Info:
 
Total Users:
4378
Newest User:
miller2341
Members Online:
3
Guests Online:
170


Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked