Search by Postcode

Discussions about OpenEstate-ImmoTool
Forum rules
Please consider the general rules for this board, before you enter the discussion.

Search by Postcode

Postby eddyR3 » Thu 23. May 2013, 14:09

Hey guys, im still having a problem with the search feature.

If you look here : emonestates.co.uk/index.php?page=Property and use the search feature for anything it takes you back to home page, any ideas why? Its appending the URL with index.php, also, is there a way to have a postcode search? Have i missed it, or is this not implemented?

many thanks!
Eddy
eddyR3
 

Re: Search by Postcode

Postby Andreas Rudolph » Thu 23. May 2013, 16:14

Hi Eddy.

eddyR3 wrote:If you look here : emonestates.co.uk/index.php?page=Property and use the search feature for anything it takes you back to home page, any ideas why?

This is definitely a bug in our CMSms module. I can reproduce that issue on a separate test installation. I assume, that we will provide an update of the CMS module during the next week.

As a workaround you can enable the "pretty URL's" feature of CMSms - as I've mentioned earlier. On our test installation the problem does not occur with

Code: Select all
$config['url_rewriting'] = 'mod_rewrite'; 

or

Code: Select all
$config['url_rewriting'] = 'internal'; 
Mit freundlichem Gruß / Yours sincerely
Andreas Rudolph
User avatar
Andreas Rudolph
 
Posts: 3738
Joined: Tue 16. Feb 2010, 21:48
Location: Berlin, Germany

Re: Search by Postcode

Postby eddyR3 » Thu 23. May 2013, 17:58

Excellent, thankyou :)

Is there a way of searching by Postcode? :)
eddyR3
 

Re: Search by Postcode

Postby Andreas Rudolph » Thu 23. May 2013, 20:42

Hi Eddy,

thanks for your response. It looks to me, that the redirection problem does not occur, if the property listing is opened with http://emonestates.co.uk/Property/?

eddyR3 wrote:Is there a way of searching by Postcode? :)

Sorry, I've overlooked that question in your first message. :oops:

The default PHP-export does not provide a filter for postcodes. But you can implement such a filter criteria by yourself.

(1) Save the following PHP code to a file named "class.filter_postcode.php" into the "include" directory of the PHP export:
Code: Select all
<?php
/**
 * Website-Export, Filter nach Postleitzahl.
 * $Id$
 *
 * @author Andreas Rudolph & Walter Wagner
 * @copyright 2009-2013, OpenEstate.org
 * @license http://www.gnu.org/licenses/gpl-3.0.txt
 */

if (!defined('IN_WEBSITE')) exit;
require_once(
 IMMOTOOL_BASE_PATH . 'include/class.filter.php' );

class ImmoToolFilter_postcode extends ImmoToolFilter {
  /**
   * Überprüfung, ob ein Objekt von dem Filter erfasst wird.
   */
  function filter( $object, &$items ) {
    $value = (isset($object['adress']['postal']))?
            $object['adress']['postal']: null;
    if (!is_string($value)) return;
    $value = trim($value);
    if (strlen($value)==0) return;
    if (!isset($items[$value]) || !is_array($items[$value])) $items[$value] = array();
    $items[$value][] = $object['id'];
  }

  /**
   * Name des Filters.
   */
  function getName() {
    return 'postcode';
  }

  /**
   * Titel des Filters, abhängig von der Sprache.
   */
  function getTitle( &$translations, $lang ) {
    $title = (isset($translations['labels']['estate.postal']))?
            $translations['labels']['estate.postal']: null;
    return is_string($title)? $title: $this->getName();
  }

  /**
   * HTML-Code zur Auswahl des Filterkriteriums erzeugen.
   */
  function getWidget( $selectedValue, $lang, &$translations, &$setup ) {
    if (!$this->readOrRebuild($setup->CacheLifeTime)) return null;
    $widget = '';
    $options = array_keys( $this->items );
    asort( $options );
    if (is_array($options) && count($options)>0) {
      $by = $this->getTitle( $translations, $lang );
      $widget .= '<select id="filter_' . $this->getName() . '" name="'.IMMOTOOL_PARAM_INDEX_FILTER.'[' . $this->getName() . ']">';
      $widget .= '<option value="">[ ' . $by . ' ]</option>';
      foreach ($options as $city) {
        $selected = ($selectedValue==$city)? 'selected="selected"': '';
        $widget .= '<option value="' . $city . '" ' . $selected . '>' . $city . '</option>';
      }
      $widget .= '</select>';
    }
    return $widget;
  }
}
?>


(2) Enable the newly created filter with the following setting in your "myconfig.php":
Code: Select all
  /**
   * Konfiguration der Immobilienübersicht überschreiben.
   * @param object $config Konfigurations-Objekt
   */
  function load_config_index( &$config ) {
    // allgemeine Konfiguration (siehe oben)
    immotool_myconfig::load_config_default( $config );

    // ggf. individuelle Konfigurationswerte einfügen
    $config->FilterOptions = array( 'action', 'type', 'postcode' );
  } 

The relevant part is the 'postcode' entry in $config->FilterOptions = array( 'action', 'type', 'postcode' ); - The rest should already be present in your "myconfig.php".
Mit freundlichem Gruß / Yours sincerely
Andreas Rudolph
User avatar
Andreas Rudolph
 
Posts: 3738
Joined: Tue 16. Feb 2010, 21:48
Location: Berlin, Germany

Re: Search by Postcode

Postby eddy-r3 » Tue 28. May 2013, 09:21

Excellent, is there a way to have a user input? Instead of filter results by ascending for example :

Enter Postcode : (input box) DY12 2UL then a list of properties within a 50mile radius appear? Is that an option? :)
eddy-r3
 

Re: Search by Postcode

Postby Andreas Rudolph » Wed 29. May 2013, 03:11

Hi Eddy.

eddy-r3 wrote:Excellent, is there a way to have a user input? Instead of filter results by ascending for example :
Enter Postcode : (input box) DY12 2UL then a list of properties within a 50mile radius appear? Is that an option? :)

Unfortunately that is not possible with the current PHP export, because it does not make use af a database so far. That makes it difficult to search for properties by a freely entered text. The PHP export can only do pre-computed filtering at the moment. Thereby it is indifferent, if you want to search within a description or within the postcodes.

We're planning a complete rebuild of the PHP export. In future it should be possible to store the properties into a MySQL database, what makes them easily searchable with a PHP script. But I assume, that it will take some more month until we can start the work on the new PHP export. The finalization of ImmoTool 1.0 has priority so far.
Mit freundlichem Gruß / Yours sincerely
Andreas Rudolph
User avatar
Andreas Rudolph
 
Posts: 3738
Joined: Tue 16. Feb 2010, 21:48
Location: Berlin, Germany


Return to OpenEstate-ImmoTool

Who is online

Users browsing this forum: No registered users and 1 guest