Skip to content

Instantly share code, notes, and snippets.

@g-maclean
Created December 15, 2025 20:13
Show Gist options
  • Select an option

  • Save g-maclean/e329997fed05893fc97d299a3e3b5d7b to your computer and use it in GitHub Desktop.

Select an option

Save g-maclean/e329997fed05893fc97d299a3e3b5d7b to your computer and use it in GitHub Desktop.
Property Hive - Agency Pilot - Import all commercial
add_filter( "propertyhive_agency_pilot_api_request_body", 'include_completed_in_body' );
function include_completed_in_body($body)
{
$body['FilterOptions']['ActiveOnly'] = false;
return $body;
}
add_filter( "propertyhive_agency_pilot_api_properties_due_import", 'filter_completed', 10, 3 );
function filter_completed($properties, $options, $token)
{
$new_properties = array();
foreach ( $properties as $property )
{
if (
//$property['MarketStatus']['ID'] == 3 || // Comparable
$property['MarketStatus']['ID'] == 4 || // Sold
$property['MarketStatus']['ID'] == 5 || // Let
$property['MarketStatus']['ID'] == 6 || // Sold Subject to Contract
//$property['MarketStatus']['ID'] == 7 || // Under Development
$property['MarketStatus']['ID'] == 8 || // Under Offer
$property['MarketStatus']['ID'] == 14 || // Available
//$property['MarketStatus']['ID'] == 15 || // Withdrawn
//$property['MarketStatus']['ID'] == 16 || // Pending
//$property['MarketStatus']['ID'] == 17 || // Professional
$property['MarketStatus']['ID'] == 18 || // For Sale
$property['MarketStatus']['ID'] == 19 // To Let
)
{
$new_properties[] = $property;
}
}
return $new_properties;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment