1. Home
  2. Docs
  3. Add-Ons
  4. Property Import
  5. Available Hooks – Structure

Available Hooks – Structure

There are number of hooks available to use during the import to add custom functionality. Maybe you've got custom fields that you want to import, or perhaps you want to use a different field for the description, for example.

Each format has it's own actions and are in the following format:

propertyhive_pre_import_properties_[format]
Executed: Just before the properties are to be iterated through and imported
Arguments: $properties

propertyhive_property_imported_[format]
Executed: Once per property after it's been imported.
Arguments: $post_id, $property

propertyhive_post_import_properties_[format]
Executed: Just after all properties have been iterated through.
Arguments: none

propertyhive_property_removed_[format]
Executed: After a property has been taken off the market due to it not existing in the import.
Arguments: $post_id

[format] can be replaced with either of the below depending on which format you are using:

- 10ninety_xml
- acquaint_xml
- agency_pilot_api
- agency_pilot_json
- agentsinsight_xml
- agentos_json
- arthur_json
- bdp_json
- blm
- bookster_json
- caldes_xml
- citylets_xml
- clarks_computers_xml
- csv
- decorus_xml
- dezrez_json
- dezrez_xml
- domus_xml
- estatesit_xml
- expertagent_xml
- gnomen_xml
- jet
- jupix_xml
- juvo_xml
- kyero_xml
- loop_json
- mri_xml
- propertyadd_xml
- realla_json
- reapit_foundations_json
- reaxml
- rentman_xml
- resales_online_xml
- rex_json
- roby_csv
- sme_professional_json
- sme_professional_xml
- street_json
- thesaurus
- utili_json
- vaultea_json
- vebra_api_xml
- veco_json
- virtualneg_xml
- webedge_xml

Let's look at a quick example using one of the above hooks:

add_action( 'propertyhive_property_imported_blm', 'email_imported_property', 10, 2);
function email_imported_property( $post_id, $property )
{
    // Note that $property will differ depending on the format
    // A quick way to see what it contains is var_dump($property);

    // Update custom field
    update_post_meta( $post_id, '_my_custom_field', $property['MY_CUSTOM_VALUE'] );

    // Send an email every time a property is received and processed in the import
    // Obviously it's very unlikely you'd want to do this in real life
    mail( 'test@test.com', 'Property imported', 'Property with address ' . $property['DISPLAY_ADDRESS'] . ' was imported with post ID ' . $post_id );
}
Was this article helpful to you? No Yes

How can we help?