OS Property support center

how can I display a specific extra field group

  • BA Kellems
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 6 months ago #71129 by BA Kellems
Hello,

I am customizing my own OSP Template and need the ability to place extra field groups that I create in different places in the listing detail template. I found your post that tells us how we can add extra fields inside field groups to our template, I am hoping we can do this with an entire group...with this said how can I display a specific extra field group?

Thank you for your help.

Please Log in or Create an account to join the conversation.

More
9 years 6 months ago #71147 by Mr. Dam
Hi Kellems,
Can you please let me know where do you want to show the Extra field groups? In Property details page?
Thanks
Dam

Please Log in or Create an account to join the conversation.

  • BA Kellems
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 6 months ago #71148 by BA Kellems
Replied by BA Kellems on topic how can I display a specific extra field group
Hello Dang,

Thank you for responding.

I need to be able to do this in the listing detail template, the page is named details.html.tpl.php

Please Log in or Create an account to join the conversation.

  • BA Kellems
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 6 months ago #71168 by BA Kellems
Replied by BA Kellems on topic how can I display a specific extra field group
Hello Dang,

Anyway you could respond to this today?...I can't go forward with my clients site without this ability and I'm losing precious development time waiting. This is all that is holding me back.

I appreciate your help.

Please Log in or Create an account to join the conversation.

More
9 years 6 months ago #71187 by Mr. Dam
Hi,
In fact, to show value of extra field in Property Details page, you can use the function:
HelperOspropertyFieldsPrint::showField($field,$pid);
$field is extra field object
$pid is ID of property
Thanks
Dam

Please Log in or Create an account to join the conversation.

  • BA Kellems
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 6 months ago #71188 by BA Kellems
Replied by BA Kellems on topic how can I display a specific extra field group
okay, well, thank you for telling me how to display an individual extra field, but as I stated in my original question, I already know how to do that from another post you posted.

This isn't what I asked for. Let's go back to my original question and let me reword it.

I have created the following extra field "GROUPS":

- Property Information
- Utilities
- Property Type

I need the ability to place each of those "GROUPS" separate from each other in various places within the listing detail page.

For example, I need to place the "Property Type GROUP" at the top of my template and the "Utilities GROUP" in yet a completely different position in my template. In order to do this I need the code that would call each group by the group ID.

I hope this explains better what I need to do.

Thank you for your help.

Please Log in or Create an account to join the conversation.

More
9 years 6 months ago #71209 by Mr. Dam
Hi,
There are some steps you need to do to show the fields of groups. If you open file: components > com_osproperty > classes > listing.php
Find this code is file:
Code:
//get the field groups $access_sql = ' and `access` IN (' . implode(',', JFactory::getUser()->getAuthorisedViewLevels()) . ')'; $extra_field_groups = array(); $db->setQuery("Select * from #__osrs_fieldgroups where published = '1' $access_sql order by ordering"); $fieldgroups = $db->loadObjectList(); $j = 0; if(count($fieldgroups) > 0){ for($i=0;$i<count($fieldgroups);$i++){ $fieldgroup = $fieldgroups[$i]; $access_sql = ' and b.access IN (' . implode(',', JFactory::getUser()->getAuthorisedViewLevels()) . ')'; $checkgroup = HelperOspropertyFields::checkFieldData($property->id, $fieldgroup->id); if($checkgroup == 1){ $extra_field_groups[$j]->group_name = OSPHelper::getLanguageFieldValue($fieldgroup,'group_name'); $extra_field_groups[$j]->fields = HelperOspropertyFields::getFieldsData($property->id, $fieldgroup->id); $j++; } } }

This code is used to retrieve field groups and extra fields of each field group. You can replace the code:
Code:
$db->setQuery("Select * from #__osrs_fieldgroups where published = '1' $access_sql order by ordering");
and replace by
Code:
$db->setQuery("Select * from #__osrs_fieldgroups where id='9999'");
9999 is ID of one extra field group.
After this change, you have one object that containing fields and value.
Next, if you open file:
components > com_osproperty > templates > theme1 > details.html.tpl.php
Find code within
Code:
if(count($row->extra_field_groups) > 0){ ...... }
You will see the fields of groups are being shown.
Good luck
Dam

Please Log in or Create an account to join the conversation.

  • BA Kellems
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 6 months ago #71275 by BA Kellems
Replied by BA Kellems on topic how can I display a specific extra field group
Thank you very very much Dang, I knew we would get it eventually!

Another question, going back to your previous post on how to show the value of a specific extra field you stated:

HelperOspropertyFieldsPrint::showField($field,$pid);
$field is extra field object
$pid is ID of property

Can you please show me an example how to use this?...for example say that I want to show the value of extrafield id 14 if it is filled in for any property added to the system.

Thank you again for your help!

Please Log in or Create an account to join the conversation.

More
9 years 6 months ago #71304 by Mr. Dam
Hi,
If FIeld id is 14, Property ID is 10, here is the example
Code:
$db=JFactory::getDbo(); $db->setQuery("Select * from #__osrs_fieldgroups where id='14'"); $field = $db->loadObject(); HelperOspropertyFieldsPrint::showField($field,10);
Good luck
Dam

Please Log in or Create an account to join the conversation.

More
8 years 7 months ago #88455 by Jose Manuel
Replied by Jose Manuel on topic how can I display several groups of extra fields
Hello Dam,

This code is to display a single group of extra fields in one position in the template but how do I do if I want to show several groups of extra fields in different template positions?

Thank you very much

Please Log in or Create an account to join the conversation.

Moderators: Mr. DamNguyen Phu Quan