OS Property support center

Extra Fields: OSProperty v2.0.4.3

  • Garth Wilson
  • Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 9 months ago - 10 years 9 months ago #34034 by Garth Wilson
Extra Fields: OSProperty v2.0.4.3 was created by Garth Wilson
I am a PHP novice.
Our website was recently upgraded to Joomla 2.5.7 with OSProperty 2.0.4.3.
We are a commercial & industrial real estate (CRE) agency, website www.dunbar.co.za/new
We created extra fields for CRE being sub-type, gla (gross lettable area), land-size, yield and noi (net operating income).
We need to show these extra fields individually in different locations in the grid view e.g.:

Commercial Property for Sale 014
Office Block <sub-type> For Sale
R 6 100 000
Convert Currency:
GLA: <gla> , Land <land-size>
Yield: <yield>, NOI: <noi>

Vereeniging, Gauteng, South Africa

Category : SOLD - Agent: Garth Wilson

From other forum topic suggestions, we added code to grid.html.tpl.php:

Close to top...
<!-- START: Call to prepare extra fields -->
<?php
//convertArray to use ids as key
$extrafields = array();
foreach($item->extra_fields as $item)
{
$extrafields[$item->id] = $item->field_label;
}
?>
<!-- END: Call to prepare extra fields -->

And where we wanted to show the extra field...

<?php echo $extrafields[1];?> 1 being the ID for sub-type.

This does not work...

Any ideas?
Last edit: 10 years 9 months ago by Garth Wilson. Reason: spelling error

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

More
10 years 9 months ago #34042 by Mr. Dam
Replied by Mr. Dam on topic Re: Extra Fields: OSProperty v2.0.4.3
Hi,
Of course, with that solution, it won't work.
If you want to show the value of extra field of one property at the list view (grid view), you can use the source code,
1. Find the id of the extra field (it's the unique number of each extra field, you can find it in the extra field management)
2. get the field object from id - $extrafield_id
$db = JFactory::getDBO();
$db->setQuery("Select * from #__osrs_extra_fields where id = '$extrafield_id'");
$field = $db->loadObject();
3. Get data of the field in property
HelperOspropertyFields::showField($field,$pid);

$field: Custom field object
$pid : id of property

Good luck
Dam

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

  • Garth Wilson
  • Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 9 months ago - 10 years 9 months ago #34079 by Garth Wilson
Replied by Garth Wilson on topic Re: Extra Fields: OSProperty v2.0.4.3
Hi Dam

Apologies for my ignorance but tried whole day with variations to try get it to work.
Essentially I want to list extra fields for all properties in the grid view in different locations.

If I get code for one extra field, I will comfortably be able to duplicate for the rest.

The #__osrs_extra_fields db is as follows:
id : group_id : field_type : field_name : field_label
1 : 1 : text : gla : GLA
2 : 1 : text : land-size : Land Size
3 : 1 : text : yield : Yield
4 : 1 : text : sub-type : Sub-Type
5 : 1 : text : noi : NOI

This is what I entered in grid.html.tpl.php where I want to display 'sub-type' which is id '4';

<?php
$db = JFactory::getDBO();
$db->setQuery("Select * from #__osrs_extra_fields where id = '$extrafield_id'");
$field = $db->loadObject();
HelperOspropertyFields::showField('4',$pid); ?>

I tried various alternatives for $pid...needs to be specific sub-type unique to each property.
Last edit: 10 years 9 months ago by Garth Wilson. Reason: spacing

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

More
10 years 9 months ago #34092 by Mr. Dam
Replied by Mr. Dam on topic Re: Extra Fields: OSProperty v2.0.4.3
Hi,
In case you want to retrieve data of field with id = 4, you need modify the source like bellow

$db = JFactory::getDBO();
$db->setQuery("Select * from #__osrs_extra_fields where id = '4'");
$field = $db->loadObject();
HelperOspropertyFields::showField($field,$pid); ?>

$pid is the id of property, maybe 1 or 2 or 3 v.v. In the list or grid view, $pid is $row->id

Thanks
Dam

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

  • Garth Wilson
  • Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 9 months ago #34106 by Garth Wilson
Replied by Garth Wilson on topic Re: Extra Fields: OSProperty v2.0.4.3
Muchas gracias, Dam...she works!

$db = JFactory::getDBO();
$db->setQuery("Select * from #__osrs_extra_fields where id = '4'");
$field = $db->loadObject();
HelperOspropertyFields::showField($field,$row->id);

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

More
10 years 9 months ago #34110 by Mr. Dam
Replied by Mr. Dam on topic Re: Extra Fields: OSProperty v2.0.4.3
Configuration :)

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

More
10 years 9 months ago #34181 by Marios
Replied by Marios on topic Re: Extra Fields: OSProperty v2.0.4.3
Hi,
Is it possible to remove the Text Box surrounding the extra field?
Thanx

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

More
10 years 9 months ago #34192 by Mr. Dam
Replied by Mr. Dam on topic Re: Extra Fields: OSProperty v2.0.4.3
Hi Marios,
can you explain more details your question? photo attach is welcome
Thanks
Dam

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

  • Garth Wilson
  • Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 9 months ago - 10 years 9 months ago #34207 by Garth Wilson
Replied by Garth Wilson on topic Re: Extra Fields: OSProperty v2.0.4.3
Hi Dam

Marios asks for the code to reflect the Text only; the present code displays the text within a text box as one would find in a drop down menu.

Pic below explains graphically the code output
Attachments:
Last edit: 10 years 9 months ago by Garth Wilson. Reason: spelling

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

More
10 years 9 months ago #34208 by Mr. Dam
Replied by Mr. Dam on topic Re: Extra Fields: OSProperty v2.0.4.3
Hi,
Please try to replace
HelperOspropertyFields::showField($field,$row->id);
by
HelperOspropertyFieldsPrint::showField($field,$row->id);

Good luck
Dam

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

Moderators: Mr. DamNguyen Phu Quan