• Resolved rafda26

    (@rafda26)


    Hello,

    i import from an xml file. The field mapping works. I would like to change from (example plot size) 100.00 (decimal value) to an integer format = 100 without the .00

    Is there a syntax to realize that in field mapping or in the options?

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author Property Hive

    (@propertyhive)

    This isn’t possible via the field mapping area, but a snippet like so should do what you’re after:

    add_action( "houzez_property_feed_property_imported", 'clean_sizes', 10, 3 );
    function clean_sizes( $post_id, $property, $import_id )
    {
    // Clean the 'fave_property_size' meta key
    $size = get_post_meta( $post_id, 'fave_property_size', true );
    if ( strpos( $size, '.00' ) !== false ) {
    $cleaned_size = rtrim( $size, '.00' ); // Remove '.00' from the size
    update_post_meta( $post_id, 'fave_property_size', $cleaned_size );
    }

    // Clean the 'fave_property_land' meta key
    $land = get_post_meta( $post_id, 'fave_property_land', true );
    if ( strpos( $land, '.00' ) !== false ) {
    $cleaned_land = rtrim( $land, '.00' ); // Remove '.00' from the land size
    update_post_meta( $post_id, 'fave_property_land', $cleaned_land );
    }
    }

    Do let me know if I can assist further,

    Steve

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.