- Posts: 19
- Thank you received: 0
OS Property support center
Adding "Amenities/Convenience" to List View
- Jason Wagner
- Topic Author
- Offline
- New Member
-
Less
More
11 years 10 months ago #31771
by Jason Wagner
Adding "Amenities/Convenience" to List View was created by Jason Wagner
How can I add amenities/convenience to list view?
I know it's something I will have to hardcode into "listing.html.tpl.php" but I do not know the exact code.
I know it's something I will have to hardcode into "listing.html.tpl.php" but I do not know the exact code.
Please Log in or Create an account to join the conversation.
- Mr. Dam
-
- Offline
- Administrator
-
Less
More
- Posts: 13023
- Thank you received: 1688
11 years 10 months ago #31778
by Mr. Dam
Replied by Mr. Dam on topic Re: Adding "Amenities/Convenience" to List View
Hi Jason,
You can see how to retrieve the amenities from the details property page. There are 2 files that you need to notice
1. components > com_osproperty > classes > listing.php
function details
from line 1878 to 1933
$query = "Select a.id, a.amenities from #__osrs_amenities as a"
." inner join #__osrs_property_amenities as b on b.amen_id = a.id"
." where a.published = '1' and b.pro_id = '$property->id'";
2. components > com_osproperty > templates > default > details.html.tpl.php
or
components > com_osproperty > templates > theme1 > details.html.tpl.php
and in this file, we only need to print out the amenities list
Thanks
Dam
You can see how to retrieve the amenities from the details property page. There are 2 files that you need to notice
1. components > com_osproperty > classes > listing.php
function details
from line 1878 to 1933
$query = "Select a.id, a.amenities from #__osrs_amenities as a"
." inner join #__osrs_property_amenities as b on b.amen_id = a.id"
." where a.published = '1' and b.pro_id = '$property->id'";
2. components > com_osproperty > templates > default > details.html.tpl.php
or
components > com_osproperty > templates > theme1 > details.html.tpl.php
and in this file, we only need to print out the amenities list
Thanks
Dam
Please Log in or Create an account to join the conversation.
- Jason Wagner
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 19
- Thank you received: 0
11 years 10 months ago #31813
by Jason Wagner
Replied by Jason Wagner on topic Re: Adding "Amenities/Convenience" to List View
Thanks Dam,
Unfortunately this a little beyond my programming skills. Is there anyway you could provide me with the code snippet for:
components > com_osproperty > classes > listing.php
I don't think I need to worry about the print feature.
Thanks!
Unfortunately this a little beyond my programming skills. Is there anyway you could provide me with the code snippet for:
components > com_osproperty > classes > listing.php
I don't think I need to worry about the print feature.
Thanks!
Please Log in or Create an account to join the conversation.
- Mr. Dam
-
- Offline
- Administrator
-
Less
More
- Posts: 13023
- Thank you received: 1688
11 years 10 months ago #31833
by Mr. Dam
Replied by Mr. Dam on topic Re: Adding "Amenities/Convenience" to List View
Hi,
In function listProperties in file listing.php
find this code
if(count($rows) > 0){
for($i=0;$i<count($rows);$i++){//for
$row = $rows[$i];
//process photo
$db->setQuery("select count(id) from #__osrs_photos where pro_id = '$row->id'");
$count = $db->loadResult();
if($count > 0){
$row->count_photo = $count;
$db->setQuery("select image from #__osrs_photos where pro_id = '$row->id' order by ordering limit 1");
$row->photo = JURI::root()."images/osproperty/properties/medium/".$db->loadResult();
}else{
$row->count_photo = 0;
$row->photo = JURI::root()."components/com_osproperty/images/assets/noimage.png";
}//end photo
//get state
$db->setQuery("Select state_name from #__osrs_states where id = '$row->state'");
$row->state_name = $db->loadResult();
//get country
$db->setQuery("Select country_name from #__osrs_countries where id = '$row->country'");
$row->country_name = $db->loadResult();
//rating
if($configClass == 1){
if($row->number_votes > 0){
$points = round($row->total_points/$row->number_votes);
ob_start();
for($j=1;$j<=$points;$j++){
?>
<img src="<?php echo JURI::root()?>components/com_osproperty/images/assets/star1.png">
<?php
}
for($j=$points+1;$j<=5;$j++){
?>
<img src="<?php echo JURI::root()?>components/com_osproperty/images/assets/star2.png">
<?php
}
$row->rating = ob_get_contents();
ob_end_clean();
}else{
ob_start();
for($j=1;$j<=5;$j++){
?>
<img src="<?php echo JURI::root()?>components/com_osproperty/images/assets/star2.png">
<?php
}
$row->rating = ob_get_contents();
ob_end_clean();
} //end rating
}
//comments
$db->setQuery("Select count(id) from #__osrs_comments where pro_id = '$row->id'");
$ncomment = $db->loadResult();
if($ncomment > 0){
$row->comment = $ncomment;
}else{
$row->comment = 0;
}
}//for
}//if rows > 0
and change it to
if(count($rows) > 0){
for($i=0;$i<count($rows);$i++){//for
$row = $rows[$i];
//process photo
$db->setQuery("select count(id) from #__osrs_photos where pro_id = '$row->id'");
$count = $db->loadResult();
if($count > 0){
$row->count_photo = $count;
$db->setQuery("select image from #__osrs_photos where pro_id = '$row->id' order by ordering limit 1");
$row->photo = JURI::root()."images/osproperty/properties/medium/".$db->loadResult();
}else{
$row->count_photo = 0;
$row->photo = JURI::root()."components/com_osproperty/images/assets/noimage.png";
}//end photo
//get state
$db->setQuery("Select state_name from #__osrs_states where id = '$row->state'");
$row->state_name = $db->loadResult();
//get country
$db->setQuery("Select country_name from #__osrs_countries where id = '$row->country'");
$row->country_name = $db->loadResult();
//rating
if($configClass == 1){
if($row->number_votes > 0){
$points = round($row->total_points/$row->number_votes);
ob_start();
for($j=1;$j<=$points;$j++){
?>
<img src="<?php echo JURI::root()?>components/com_osproperty/images/assets/star1.png">
<?php
}
for($j=$points+1;$j<=5;$j++){
?>
<img src="<?php echo JURI::root()?>components/com_osproperty/images/assets/star2.png">
<?php
}
$row->rating = ob_get_contents();
ob_end_clean();
}else{
ob_start();
for($j=1;$j<=5;$j++){
?>
<img src="<?php echo JURI::root()?>components/com_osproperty/images/assets/star2.png">
<?php
}
$row->rating = ob_get_contents();
ob_end_clean();
} //end rating
}
//comments
$db->setQuery("Select count(id) from #__osrs_comments where pro_id = '$row->id'");
$ncomment = $db->loadResult();
if($ncomment > 0){
$row->comment = $ncomment;
}else{
$row->comment = 0;
}
//amenities
$query = "Select a.id, a.amenities from #__osrs_amenities as a"
." inner join #__osrs_property_amenities as b on b.amen_id = a.id"
." where a.published = '1' and b.pro_id = '$row->id'";
$db->setQuery($query);
$amens = $db->loadObjectList();
$amens_str1 = "";
if(count($amens) > 0){
$amens_str = "";
for($i=0;$i<count($amens);$i++){
$j++;
$amens_str .= "";
$amen = $amens[$i];
$amens_str .= $amen->amenities;
$amens_str .= ", ";
}
$amens_str .= substr($amens_str,0,strlen($amens_str)-2);
}else{
$amens_str = JText::_('OS_NO_AMENITIES');
}
$row->amens_str = $amens_str;
}//for
}//if rows > 0
in the listing.html.tpl.php, echo $row->amens_str
Good luck
Dam
In function listProperties in file listing.php
find this code
if(count($rows) > 0){
for($i=0;$i<count($rows);$i++){//for
$row = $rows[$i];
//process photo
$db->setQuery("select count(id) from #__osrs_photos where pro_id = '$row->id'");
$count = $db->loadResult();
if($count > 0){
$row->count_photo = $count;
$db->setQuery("select image from #__osrs_photos where pro_id = '$row->id' order by ordering limit 1");
$row->photo = JURI::root()."images/osproperty/properties/medium/".$db->loadResult();
}else{
$row->count_photo = 0;
$row->photo = JURI::root()."components/com_osproperty/images/assets/noimage.png";
}//end photo
//get state
$db->setQuery("Select state_name from #__osrs_states where id = '$row->state'");
$row->state_name = $db->loadResult();
//get country
$db->setQuery("Select country_name from #__osrs_countries where id = '$row->country'");
$row->country_name = $db->loadResult();
//rating
if($configClass == 1){
if($row->number_votes > 0){
$points = round($row->total_points/$row->number_votes);
ob_start();
for($j=1;$j<=$points;$j++){
?>
<img src="<?php echo JURI::root()?>components/com_osproperty/images/assets/star1.png">
<?php
}
for($j=$points+1;$j<=5;$j++){
?>
<img src="<?php echo JURI::root()?>components/com_osproperty/images/assets/star2.png">
<?php
}
$row->rating = ob_get_contents();
ob_end_clean();
}else{
ob_start();
for($j=1;$j<=5;$j++){
?>
<img src="<?php echo JURI::root()?>components/com_osproperty/images/assets/star2.png">
<?php
}
$row->rating = ob_get_contents();
ob_end_clean();
} //end rating
}
//comments
$db->setQuery("Select count(id) from #__osrs_comments where pro_id = '$row->id'");
$ncomment = $db->loadResult();
if($ncomment > 0){
$row->comment = $ncomment;
}else{
$row->comment = 0;
}
}//for
}//if rows > 0
and change it to
if(count($rows) > 0){
for($i=0;$i<count($rows);$i++){//for
$row = $rows[$i];
//process photo
$db->setQuery("select count(id) from #__osrs_photos where pro_id = '$row->id'");
$count = $db->loadResult();
if($count > 0){
$row->count_photo = $count;
$db->setQuery("select image from #__osrs_photos where pro_id = '$row->id' order by ordering limit 1");
$row->photo = JURI::root()."images/osproperty/properties/medium/".$db->loadResult();
}else{
$row->count_photo = 0;
$row->photo = JURI::root()."components/com_osproperty/images/assets/noimage.png";
}//end photo
//get state
$db->setQuery("Select state_name from #__osrs_states where id = '$row->state'");
$row->state_name = $db->loadResult();
//get country
$db->setQuery("Select country_name from #__osrs_countries where id = '$row->country'");
$row->country_name = $db->loadResult();
//rating
if($configClass == 1){
if($row->number_votes > 0){
$points = round($row->total_points/$row->number_votes);
ob_start();
for($j=1;$j<=$points;$j++){
?>
<img src="<?php echo JURI::root()?>components/com_osproperty/images/assets/star1.png">
<?php
}
for($j=$points+1;$j<=5;$j++){
?>
<img src="<?php echo JURI::root()?>components/com_osproperty/images/assets/star2.png">
<?php
}
$row->rating = ob_get_contents();
ob_end_clean();
}else{
ob_start();
for($j=1;$j<=5;$j++){
?>
<img src="<?php echo JURI::root()?>components/com_osproperty/images/assets/star2.png">
<?php
}
$row->rating = ob_get_contents();
ob_end_clean();
} //end rating
}
//comments
$db->setQuery("Select count(id) from #__osrs_comments where pro_id = '$row->id'");
$ncomment = $db->loadResult();
if($ncomment > 0){
$row->comment = $ncomment;
}else{
$row->comment = 0;
}
//amenities
$query = "Select a.id, a.amenities from #__osrs_amenities as a"
." inner join #__osrs_property_amenities as b on b.amen_id = a.id"
." where a.published = '1' and b.pro_id = '$row->id'";
$db->setQuery($query);
$amens = $db->loadObjectList();
$amens_str1 = "";
if(count($amens) > 0){
$amens_str = "";
for($i=0;$i<count($amens);$i++){
$j++;
$amens_str .= "";
$amen = $amens[$i];
$amens_str .= $amen->amenities;
$amens_str .= ", ";
}
$amens_str .= substr($amens_str,0,strlen($amens_str)-2);
}else{
$amens_str = JText::_('OS_NO_AMENITIES');
}
$row->amens_str = $amens_str;
}//for
}//if rows > 0
in the listing.html.tpl.php, echo $row->amens_str
Good luck
Dam
Please Log in or Create an account to join the conversation.
- Jason Wagner
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 19
- Thank you received: 0
11 years 10 months ago #31912
by Jason Wagner
Replied by Jason Wagner on topic Re: Adding "Amenities/Convenience" to List View
Thanks Dang,
This is now showing up on my listing page, however it's not displaying the amenities after a custom search. I have added the row to results.html.tpl.php but it is not returning the list of amenities. Do I need to add code to another file so that it pulls the amenities list after a search?
This is now showing up on my listing page, however it's not displaying the amenities after a custom search. I have added the row to results.html.tpl.php but it is not returning the list of amenities. Do I need to add code to another file so that it pulls the amenities list after a search?
Please Log in or Create an account to join the conversation.
- Mr. Dam
-
- Offline
- Administrator
-
Less
More
- Posts: 13023
- Thank you received: 1688
11 years 10 months ago #31929
by Mr. Dam
Replied by Mr. Dam on topic Re: Adding "Amenities/Convenience" to List View
Hi Jason,
I need your site information for checking your result.
Thanks
Dam
I need your site information for checking your result.
Thanks
Dam
Please Log in or Create an account to join the conversation.
- Jason Wagner
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 19
- Thank you received: 0
11 years 10 months ago #32401
by Jason Wagner
Replied by Jason Wagner on topic Re: Adding "Amenities/Convenience" to List View
Hi Dang,
I am sending you my site information now. This is still a major issue.
I am sending you my site information now. This is still a major issue.
Please Log in or Create an account to join the conversation.
Moderators: Mr. 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.