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.

 

Mosets Tree custom fields recipe

Mosets Tree custom fields recipe

Hi,

I am trying to get Mosets Tree custom field to be included in the recipe, but can't find my way through it. Can you share an example to do this?

Right now I only have this:

Code:

if ($option == 'com_mtree' and JRequest::getVar('task') == 'viewlink' ) 


{
  return XX;
}

But that's only for a link with 'viewlink'.

I am trying to differentiate two types of mosets listing and recognize them by custom field. It seems there is too much page to assigned module by page ID, so it would be wise to include one custom field that differentiate between these two types.

Any help?

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

Re: Mosets Tree custom fields recipe

Try this:

if ($option == 'com_mtree' and JRequest::getVar('task') == 'viewlink' ) {
  $link_id = JRequest::getInt('link_id', 0);
  $custom_field_id = 28; // replace with the ID of the custom field you want to check for
  $query = "SELECT value FROM  #__mt_cfvalues WHERE cf_id = $custom_field_id and link_id = $link_id";
  $db->setQuery( $query );
  $result = $db->loadResult();
  if ( $result == 1 ) return XXX; // replace XXX with module id to return when custom field id "28" has value "1"
}

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
3312 Posts
User info in posts
Administrator has disabled public posting

Re: Mosets Tree custom fields recipe

Hi Stephen,

Thanks for the reply! That works for the detail page but when I go to different page/view but same component, this error throws out:

Notice: Undefined variable: result in /home/public_html/xxxx.com/modules/mod_metamod/helper.php(539) : eval()'d code on line 12

This is very close! Any idea?

ps: Hows thing for you? Hopefully all fine and safe!

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

Re: Mosets Tree custom fields recipe

Hi Pembaris,

if you're getting an error in line 12 then you're not using the exact recipe I sent... perhaps you are using the $result variable outside of the { } characters?

And things for me... not too bad. Still no laptop, but they didn't steal my iMac which was sitting next to it, and all the Meta* stuff was synched with DropBox, so I have good backup. I'm very glad for good backups, DropBox, insurance, and incompetent burglars!

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
3312 Posts
User info in posts
Administrator has disabled public posting

Re: Mosets Tree custom fields recipe

Hi Stephen,

haha funny when you called me Pembaris, as i believe you know what it means too from last time wink

I am the same guy that subscribes the metamod pro, Ajmal but since the site i am handling doesn't subscribe to it that's why i am posting it under metamod forum smile

Anyway, yeah I somehow missed the '}' when copy pasting so my bad! It works now smile

Thank you so much for the help I greatly appreciate it. I am sorry to hear about the news (and last time the earthquake news) so looking forward to hearing some great news in the future! smile

Good thing you are a competent web developer and programmer to have a good practice of backup and all important stuffs smile

Now I should learn how to "Dropbox" my stuffs too!

Have a good remaining Sunday!

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

Re: Mosets Tree custom fields recipe

Hi Ajmal,

Thanks for your good wishes. I generally refer to people's login name on the forum, even if I know the real name, unless they have signed their name at the bottom of the post. It's just a matter of privacy smile

Best regards,
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
3312 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1667
Total Polls:
6
Total Posts:
5909
Total Posts Today:
1
User Info:
 
Total Users:
10075
Newest User:
rsker57
Members Online:
0
Guests Online:
250

Online: 
There are no members online

Forum Legend:

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