Search properties

Permalink Browser Info Environment
How to enable search which is mean in specs:
search by price range or can be taylored to search by any Properties attribute?
I didn't find it anywhere.

Type: Discussion
Status: In Progress
dlugilong
View Replies:
dlugilong replied on at Permalink Reply
dlugilong
I see it only in Dashboard but in specs says: that it is avaliable in SINGLE PAGES
JoeHiveCreative replied on at Permalink Reply
JoeHiveCreative
Are you asking how to enable a "search by price range" on the default listing page?
dlugilong replied on at Permalink Reply
dlugilong
Yes, and how to change search in other properties like min sqrft and max sqrft too.
JoeHiveCreative replied on at Permalink Reply
JoeHiveCreative
There is a default search form on the single_pages/listings/view.php for the 'default' case (search the file for 'sorting_sidbar' and you'll find the start of the HTML that defines it.

You can add more fields in here to match them to filter methods in the model ... check out the view() method in controllers/listings/controller.php, around line 97 you should see the block that pulls everything out of the 'post_filters' session variable.
dlugilong replied on at Permalink Reply
dlugilong
Hi,
whatever I type in the location indicated by You, I still search the price not the sqrft. For example, I type
<?php  echo $fm->label('sqrft1_filter', 'Sqrft') ?><br/>
                         <?php  echo $fm->text('sqrft1_filter', $sorting['sqrft1_filter'], array('size' => 16)) ?> PLN

replacing there price1 to sqrft1 but it's not working well. Still see price field.
It is for me very complicated. Can I ask for clarification of code or script file to enter the sqrft field in search fields to get an extra parameter search on the surface?

Let me remind you that the purchasing module mainly suggested the possibility of changing or adding search boxes as it is in description, quote:
search by price range or can be taylored to search by any Properties attribute.
JoeHiveCreative replied on at Permalink Reply
JoeHiveCreative
Changes made to controllers/listings/controller.php
if($key=='price1_filter'){
    $kpl->filterByPrice($_SESSION['post_filters']['price1_filter'],$_SESSION['post_filters']['price2_filter']);
} elseif ($key == 'sqrft1_filter') {
    $kpl->filterBySqrft($_SESSION['post_filters']['sqrft1_filter'],$_SESSION['post_filters']['sqrft2_filter']);
}elseif(!in_array($key,array('sqrft2_filter','price2_filter'))){
    $qu = 'filterBy'.ucfirst($key);
    $kpl->$qu($value);
}


Added function to models/property_list.php
public function filterBySqrft($sqrft1,$sqrft2=null){
    if(!$sqrft2){
        $sqrft2 = $sqrft1;
    }
    $sqrft1 = intval($sqrft1);
    $sqrft2 = intval($sqrft2);
    $this->filter(false, 'ROUND(ak_info_sizes_sqrft) >= \''.$sqrft1.'\' AND ROUND(ak_info_sizes_sqrft) <= \''.$sqrft2.'\'');
}


And finally, changes to single_pages/listings/view.php
<?php 
echo $fm->label('sqrft1_filter', 'By SqrFt Range') ?><br/>
$<?php echo $fm->text('sqrft1_filter', $sorting['sqrft1_filter'], array('size' => 16)) ?>
<br/>
       <?php echo t('to') ?> <br/>
$<?php echo $fm->text('sqrft2_filter', $sorting['sqrft2_filter'], array('size' => 16)) ?>
dlugilong replied on at Permalink Reply
dlugilong
Thank You very much! Now it's working, You're great, but can You make choice for implementing system-level editing, so that you can choose a field to search? It could be very helpful.

I have a last problem: I want to insert the search block on every page and not only the listing search which is visible in page map. Why is not created a block search, can you tell me what code to write and where to insert? I would be very keen on this, so I can decide for myself where to insert search bar.

You could add these options described in the next version of Properties... :)

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.