BLM

Setting up a BLM import

This page contains information specific to the BLM format. For a general guide on setting up a property import, please see our 'Creating your first property import' guide.

When creating an import in the BLM format, you'll be presented with 2 options in the list of formats to choose from:

BLM - Local Directory

This is the default method when using the BLM format.

Using this option requires you to create an FTP user and folder on your server specifically for the third party that will be sending the feed.

How you do this depends on your hosting and what control panel access you have. If you're not sure we recommend you ask your hosting company.

We recommend when setting up a new FTP user that you set the users 'home directory' (the directory they get put into by default when they connect) to the new folder in question.

That way they will have access to this folder only, and not any other files on your site.

When creating an import using the 'BLM - Local Directory' option, you'll be presented with the following fields:

Local Directory - The directory on your server where the third party will be uploading the files too.

This does default to your sites full server path followed by '/wp-content/uploads/ph_import/' but can be customised accordingly based on the FTP folder you setup.

This field should contain the full server path from the very root of the server. The directory added by default when setting up a new import does contain this.

Only import updated properties - To ensure feeds run quicker and more efficiently you can tick this option to only import properties that have changed since the last time an import ran.

BLM - Remote URL

Similar to the above but instead of the third party sending the file(s) to your site via FTP, you enter a URL where we can go off and obtain the BLM (or ZIP) file(s).

Note this option requires a fixed filename and doesn't work if the third party creates dynamic filenames, such as appending a timestamp or similar.

When creating an import using the 'BLM - Remote URL' option, you'll be presented with the following fields:

URL to BLM - The full URL to the BLM. You can also link to a ZIP file here and that will also work.

If providing a link direct to a BLM, the images and other media within the BLM must be provided as full URL's and not just the filenames.

Only import updated properties - To ensure feeds run quicker and more efficiently you can tick this option to only import properties that have changed since the last time an import ran.

Developer hooks

Hook name: propertyhive_pre_import_properties_blm

Hook type: Action

Description: Executed after the properties are parsed but before they are actually imported.

Example usage:

add_action( 'propertyhive_pre_import_properties_blm', 'pre_import' );
function pre_import( $properties )
{
     // $properties (array) - Multidimensional array containing property data parsed from a BLM

    // do something here...
}

Hook name: propertyhive_blm_properties_due_import

Hook type: Filter

Description: Executed after the properties are parsed but before actually being imported. Allows you to filter out any properties you don't want to import.

For example, maybe you want to only import properties belonging to a certain office.

Example usage:

add_filter( 'propertyhive_blm_properties_due_import', 'filter_properties' );
function filter_properties( $properties )
{
    // $properties (array) - Multidimensional array containing property data parsed from a BLM

    $new_properties = array();
    
    foreach ($properties as $property)
    {
        if ( isset($property['BRANCH_ID']) && $property['BRANCH_ID'] == '12345' )
        {
            $new_properties[] = $property;
        }
    }
    return $new_properties;
}

Hook name: propertyhive_blm_address_fields_to_check

Hook type: Filter

Description: If you have locations setup under 'Property Hive > Settings > Custom Fields' we'll look at a number of address fields provided in the BLM data and, if a matching 'Location' is found, we'll set it accordingly.

Using this filter you can customise the address fields in the BLM that we consider when looking for a matching location.

Example usage:

add_filter( 'propertyhive_blm_address_fields_to_check', 'customise_address_fields' );
function customise_address_fields($address_fields)
{
    // $address_fields (array) - defaults to ['ADDRESS_2', 'ADDRESS_3', 'TOWN', 'ADDRESS_4', 'OS_TOWN_CITY', 'OS_REGION']

    $address_fields[] = 'ADDRESS_1'; // also look at address line 1 when mapping to location

    return $address_fields;
}

Hook name: propertyhive_property_imported_blm

Hook type: Action

Description: Executed after each individual property is imported.

Example usage:

add_action( 'propertyhive_property_imported_blm', 'property_imported', 10, 2 );
function property_imported( $post_id, $property )
{
    // $post_id (int) - the WordPress post ID of the imported property
    // $property (array) - The property received in the BLM

    // do something here...
}

Hook name: propertyhive_post_import_properties_blm

Hook type: Action

Description: Executed after all properties have been imported.

Example usage:

add_action( 'propertyhive_post_import_properties_blm', 'post_import' );
function post_import()
{
    // do something here...
}

Hook name: propertyhive_property_removed_blm

Hook type: Action

Description: Executed after a property has been removed from Property Hive due to it not being present in the feed.

Example usage:

add_action( 'propertyhive_property_removed_blm', 'property_removed' );
function property_removed( $post_id )
{
    // $post_id (int) - the WordPress post ID of the imported property

    // do something here...
}