RETS & DRealty: How to use Drupal 7 for Real Estate Listings

Contact your MLS provider to acquire your appropriate RETS credentials. Most major realty corporations include this access to their registered agents through their managing brokers.

With so many listings on the market now, it’s nearly impossible to share online real estate listings with clients. Most MLS systems are great for searching and sorting, but are too cumbersome for clients to use on their own. Fortunately, we can use Drupal 7 and a module called DRealty to import listings to our own websites, and present a more refined list of properties for clients to sort through. Unlike WordPress plugins, which show frames from MLS services, Drupal allows us to list the properties on our own websites, which is great for SEO, site performance, and display control.

Looking at past tutorials, we found the setup instructions for Drupal 7 + DRealty to be hard to follow and incomplete. Please comment on this tutorial, whether you’re able to use it as-is or if you find discrepancies, and let us know about your experience.

Ensure the newest version of Drupal is installed (7.32 as of 11/5/14)
Required Modules: Entity API (enabled), Libraries (enabled), System (enabled)
Required Libraries: phRets library, the newest version
Install the dRealty module on Drupal

Log-in to the RETS database


Set up the Drealtor module to log-in to your RETS database.

  1. Enable connection


If you see this error, confirm your log-in information with your RETS provider.


Successful connection message:


  1. Go to configure listings
  2. Select a listing class that you want to import from the RETS system. For example, Residential Property
    1. Check the box under Enabled next to your chosen listing class
    2. Select an option under Lifetime to enable automatic imports
    3. Click configure to set up the query

Listing Import Settings

  1. The Required Fields

Required Fields

The Required Fields must be filled with RETS metadata terms which can be found by using RETSMD. The terms might be different based on your RETS provider

    1. Id Field-Must be an ID field for the RETS system. For Properties it is usually the MLS ID or Listing ID. However, in some RETS systems it can be listed out like LN-MLS.
    2. Key Field- The key field is defined by the RETS provider, it can be the same as the ID Field, but some providers have a separate field.
    3. Status Field-The RETS MLS status field, it will be listed in RETSMD.
    4. Drealty Property Type-Additional property types can be created to maintain multiple queries.
  1. RETS Import Options


    1. Query Type- choose a query type you want to set up.



      1. Default query type- you must select a status field
      2. Offset Not Supported (Query based on price field)-Sets the offset based on the Price field. This setting needs a DMQL query. The price field must be set with a price listing. Amount of the Offset and the Maximum offset amount must be set by using the drop down boxes.
      3. Offset Not Supported (Query based on RETS Key)-Set the offset based on the RETS Key, you must select the amount of records that are processed at a time.
      4. Manually supplied Query (Server must support offset)-You must provide a DMQL query and the amount of records to be provided.
      5. Query to use — this is the most important tool in the process. this defines the records you’re going to pull. Make sure you explain how this query will batch results and give a few example queries and what they mean: (ZP = 60302*) will return all residential properties in zip code 60302, (LIST_22=1000+) will return all residential properties with a list price of $1,000 or greater -Select the query type. Any MLS field type can be used. It’s important to use the supplied tutorial because the search will fail if there are any errors.
      6. Price field to base the offset on-
      7. The amount to offset by.-

For more information on query follow this tutorial

      1. The maximum offset amount.-
    1. Images


      1. To import photos, you must click the checkbox.
      2. Photo Modification Timestamp Field-To get the photo Timestamp, you have to look what your RETS system declares as the picture Date. This Field type will be a Date type.
      3. Object types to download-Select the type of photos you want to import
      4. Image Field-select the image field you want to import to
      5. Image Chunk Size-Select the size of photo data chunks you want to be processed at a time. Smaller chunk sizes use less system memory, but take longer to process. Larger chunk sizes process faster, but use more memory, and may cause memory errors.
    1. Mark Listings


      1. Mark all listings for update?-Check the box if you want to force reset the lifetime clock to zero.
    1. Click Save Configuration to save your configuration


  1. Drealty Property Types.
    1. Create a listing if you haven’t already
    2. Add a Tags label with the Field Type Term Reference and Widget type Autocomplete term widget (tagging)
    3. Add an image field if you want one or haven’t added one already
    4. Add any other fields you want to import from RETS and display on your Drupal site
    5. Click Save to save your listing


  1. Importing RETS listing
    1. Log into bash on your server
    2. Install drush to your Drupal system.
    3. Check on your Drupal status with drush command: drush status
    4. Run cron via drush with drush command: drush cron
    5. Clear cache via drush with drush command: drush cc all
    6. To import the listing from RETS use this drush command: drush -u admin -d rets-import
      1. To flush the RETS system, you can use this command drush -u admin -d rets-flush
    7. Wait until the system has finished importing your listings from RETS

Importing listings can take a significant amount of time

  1. Go to find content on your Drupal site
    1. In content go to Drealty Listings and you’ll see all the imported listings
    2. Click on one the imported listings and look at all the fields you have imported from RETS


Leave a Reply