- Posts: 3
- Thank you received: 0
OS Property support center
SOLVED !!! Amenities Search
- Kasey Moore
- Topic Author
- Offline
- New Member
-
Less
More
10 years 7 months ago - 10 years 6 months ago #57959
by Kasey Moore
SOLVED !!! Amenities Search was created by Kasey Moore
Hi there,
We have amenities down the left however they're not quite working right with logic.
When you have two tick boxes checked it will look for each results individually in an OR logic. We want AND logic.
For example if you tick disabled access it results 8 listings. If I also tick Toilets Nearby it then displays 35 results. But Beauchamp Arms does not have disabled access.
Do you have any idea how to switch the logic around on the search form?
We have amenities down the left however they're not quite working right with logic.
When you have two tick boxes checked it will look for each results individually in an OR logic. We want AND logic.
For example if you tick disabled access it results 8 listings. If I also tick Toilets Nearby it then displays 35 results. But Beauchamp Arms does not have disabled access.
Do you have any idea how to switch the logic around on the search form?
Last edit: 10 years 6 months ago by Dang Thuc Dam.
Please Log in or Create an account to join the conversation.
- Dang Thuc Dam
-
- Away
- Administrator
-
Less
More
- Posts: 13247
- Thank you received: 1729
10 years 7 months ago #58068
by Dang Thuc Dam
Replied by Dang Thuc Dam on topic Amenities Search
Hi Kasey,
To solve the problem, you can follow these steps
1. Open file: components > com_osproperty > classes > listing.php
2. find
$amenities_sql = " AND a.id in (SELECT pro_id FROM #__osrs_property_amenities WHERE amen_id in ($amenities_str))";
and replace by
$amenities_sql = " AND a.id in (SELECT pro_id FROM #__osrs_property_amenities WHERE amen_id in ($amenities_str) group by pro_id having count(pro_id) = ".count($amenities).")";
Good luck
Dam
To solve the problem, you can follow these steps
1. Open file: components > com_osproperty > classes > listing.php
2. find
$amenities_sql = " AND a.id in (SELECT pro_id FROM #__osrs_property_amenities WHERE amen_id in ($amenities_str))";
and replace by
$amenities_sql = " AND a.id in (SELECT pro_id FROM #__osrs_property_amenities WHERE amen_id in ($amenities_str) group by pro_id having count(pro_id) = ".count($amenities).")";
Good luck
Dam
Please Log in or Create an account to join the conversation.
- Kasey Moore
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 3
- Thank you received: 0
10 years 6 months ago #58240
by Kasey Moore
Replied by Kasey Moore on topic Amenities Search
Great worked first time.
Can you do the same with checkbox on Extra Field?
Can you do the same with checkbox on Extra Field?
Please Log in or Create an account to join the conversation.
- Dang Thuc Dam
-
- Away
- Administrator
-
Less
More
- Posts: 13247
- Thank you received: 1729
10 years 6 months ago #58257
by Dang Thuc Dam
Replied by Dang Thuc Dam on topic Amenities Search
Hi Kasey,
Please open file:
administrator > components > com_osproperty > helpers > extrafields.php
find
if(count($value) > 0){
$extraArr = array();
for($i=0;$i<count($value);$i++){
$v = $value[$i];
$extraArr[] = " a.id in (Select pid from #__osrs_property_field_opt_value where fid = '$field->id' and `oid` = '$v') ";
}
$sql = " ( ". implode(" OR ",$extraArr) ." ) ";
}
and change to
if(count($value) > 0){
$extraArr = array();
for($i=0;$i<count($value);$i++){
$value[$i] = "'".$value[$i]."'";
}
$valueSql = implode(",",$value);
$sql = " a.id in (Select pid from #__osrs_property_field_opt_value where fid = '$field->id' and `oid` in ($valueSql)) group by pid having count (pid) = '".count($value)."'";
}
Thanks
Dam
Please open file:
administrator > components > com_osproperty > helpers > extrafields.php
find
if(count($value) > 0){
$extraArr = array();
for($i=0;$i<count($value);$i++){
$v = $value[$i];
$extraArr[] = " a.id in (Select pid from #__osrs_property_field_opt_value where fid = '$field->id' and `oid` = '$v') ";
}
$sql = " ( ". implode(" OR ",$extraArr) ." ) ";
}
and change to
if(count($value) > 0){
$extraArr = array();
for($i=0;$i<count($value);$i++){
$value[$i] = "'".$value[$i]."'";
}
$valueSql = implode(",",$value);
$sql = " a.id in (Select pid from #__osrs_property_field_opt_value where fid = '$field->id' and `oid` in ($valueSql)) group by pid having count (pid) = '".count($value)."'";
}
Thanks
Dam
Please Log in or Create an account to join the conversation.
- Kasey Moore
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 3
- Thank you received: 0
10 years 6 months ago #58258
by Kasey Moore
Replied by Kasey Moore on topic Amenities Search
You're the man!
Thanks a lot!
Thanks a lot!
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.