Apex27

Setting up an import from Apex27

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

When creating an import from Apex27, you'll be presented with the following fields:

XML URL - You will need to obtain your XML URL directly from Apex27.

Developer hooks

Hook name: propertyhive_import_properties_apex27_xml_exclude_statuses

Hook type: Filter

Description: We receive properties of all statuses by default in the Apex27 XML feed. As a result we exclude properties by default with a status of 'Pending', 'Let' or 'Sold'.

Use this filter to include or exclude properties with different statuses than these.

Example usage:

add_filter( 'propertyhive_import_properties_apex27_xml_exclude_statuses', 'exclude_statuses' );
function exclude_statuses( $statuses_to_exclude )
{
    // $statuses_to_exclude (array) - Array of statuses to exclude from imports
    // Default: ['Pending', 'Let', 'Sold']

    // Change array to ensure sold properties are imported
    $statuses_to_exclude = ['Pending', 'Let'];

    return $statuses_to_exclude;
}

Hook name: propertyhive_pre_import_properties_apex27_xml

Hook type: Action

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

Example usage:

add_action( 'propertyhive_pre_import_properties_apex27_xml', 'pre_import' );
function pre_import( $properties )
{
     // $properties (array) - Array of SimpleXML objects containing property data sent by Apex27

    // do something here...
}

Hook name: propertyhive_apex27_xml_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_apex27_xml_properties_due_import', 'filter_properties' );
function filter_properties( $properties )
{
    // $properties (array) - Array of SimpleXML objects containing property data sent by Apex27

    $new_properties = array();
    
    foreach ($properties as $property)
    {
        if ( 
            isset($property->Branch->Name) && 
            (string)$property->Branch->Name == 'Manchester' 
        )
        {
            $new_properties[] = $property;
        }
    }
    return $new_properties;
}

Hook name: propertyhive_apex27_xml_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 Apex27 data and, if a matching 'Location' is found, we'll set it accordingly.

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

Example usage:

add_filter( 'propertyhive_apex27_xml_address_fields_to_check', 'customise_address_fields' );
function customise_address_fields($address_fields)
{
    // $address_fields (array) - defaults to ['Address1', 'Address2', 'Address3', 'Address4', 'City', 'County']

    $address_fields[] = 'PostalCode'; // also look at postal code when mapping to location

    return $address_fields;
}

Hook name: propertyhive_property_imported_apex27_xml

Hook type: Action

Description: Executed after each individual property is imported.

Example usage:

add_action( 'propertyhive_property_imported_apex27_xml', 'property_imported', 10, 2 );
function property_imported( $post_id, $property )
{
    // $post_id (int) - the WordPress post ID of the imported property
    // $property (SimpleXML object) - The property received from Apex27

    // do something here...
}

Hook name: propertyhive_post_import_properties_apex27_xml

Hook type: Action

Description: Executed after all properties have been imported.

Example usage:

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

Hook name: propertyhive_property_removed_apex27_xml

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_apex27_xml', 'property_removed' );
function property_removed( $post_id )
{
    // $post_id (int) - the WordPress post ID of the imported property

    // do something here...
}