- Posts: 106
- Thank you received: 2
OS Property support center
Adding City to Featured Agents
- Jim
- Topic Author
- Offline
- Premium Member
-
Less
More
10 years 9 months ago #53444
by Jim
Adding City to Featured Agents was created by Jim
Hi.
I am wanting to add the field 'City' to the Featured Agents Template
(modules/mod_featuredagents/tmpl.default.php)
When i added the field it added the City Id not the City name (as the id is stored in the Agents table in City)
I need to change the helper.php file code so it joins the Cities table and extracts the 'City' Field
Is this simple to change the below in the helper.php file?
$db = JFactory::getDbo();
$db->setQuery("Select * from #__osrs_agents where published = '1' $userSql $userSql1 order by $sort_by limit $number_agents");
$items = $db->loadObjectList();
return $items;
I am wanting to add the field 'City' to the Featured Agents Template
(modules/mod_featuredagents/tmpl.default.php)
When i added the field it added the City Id not the City name (as the id is stored in the Agents table in City)
I need to change the helper.php file code so it joins the Cities table and extracts the 'City' Field
Is this simple to change the below in the helper.php file?
$db = JFactory::getDbo();
$db->setQuery("Select * from #__osrs_agents where published = '1' $userSql $userSql1 order by $sort_by limit $number_agents");
$items = $db->loadObjectList();
return $items;
Please Log in or Create an account to join the conversation.
- Dang Thuc Dam
-
- Offline
- Administrator
-
Less
More
- Posts: 13244
- Thank you received: 1729
10 years 9 months ago #53502
by Dang Thuc Dam
Replied by Dang Thuc Dam on topic Adding City to Featured Agents
Hi Jim,
When you show agent details in the module, you can use this code
$db->setQuery("Select city from #__osrs_cities where id = '$item->city'");
echo $db->loadResult();
it will show city value of agent
Thanks
Dam
When you show agent details in the module, you can use this code
$db->setQuery("Select city from #__osrs_cities where id = '$item->city'");
echo $db->loadResult();
it will show city value of agent
Thanks
Dam
Please Log in or Create an account to join the conversation.
- Jim
- Topic Author
- Offline
- Premium Member
-
Less
More
- Posts: 106
- Thank you received: 2
10 years 9 months ago - 10 years 9 months ago #53580
by Jim
Replied by Jim on topic Adding City to Featured Agents
Hi Dam,
Thank you but I cant seem to get it to work.
To clarify..... the code you supplied would be pasted into the template modules/mod_featuredagents/tmpl/default.php instead of the below in red ? (when i try i get a blank page with just one single agent photo)
<?php
if($item->phone != ""){
?>
<div class="phone"><em class="fa fa-phone"></em> <?php echo $item->phone;?></div>
<?php
}
?>
Thank you but I cant seem to get it to work.
To clarify..... the code you supplied would be pasted into the template modules/mod_featuredagents/tmpl/default.php instead of the below in red ? (when i try i get a blank page with just one single agent photo)
<?php
if($item->phone != ""){
?>
<div class="phone"><em class="fa fa-phone"></em> <?php echo $item->phone;?></div>
<?php
}
?>
Last edit: 10 years 9 months ago by Jim.
Please Log in or Create an account to join the conversation.
- Jim
- Topic Author
- Offline
- Premium Member
-
Less
More
- Posts: 106
- Thank you received: 2
10 years 9 months ago - 10 years 9 months ago #53890
by Jim
Replied by Jim on topic Adding City to Featured Agents
unfortunately I cant get this to work ... 
It works in other templates but not the featured agent.

It works in other templates but not the featured agent.
Last edit: 10 years 9 months ago by Jim. Reason: Updated after testing
Please Log in or Create an account to join the conversation.
Moderators: Dang Thuc Dam, Nguyen Phu Quan
Support
Documentation
Information
Copyright © 2025 Joomla Extensions by Joomdonation. All Rights Reserved.
joomdonation.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.