facetwp custom table

Support MB FacetWP Integration facetwp custom tableResolved

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #21342
    EricHedvatEricHedvat
    Participant

    Ive seen a previous thread on connecting facetwp to custom table fields from 2 yrs ago, but no conclusive answer.

    Inside facetwp plugin folder there is a file class-helper.php, with this line:

    
    // Get custom fields
    $meta_keys = $wpdb->get_col( "SELECT DISTINCT meta_key FROM {$wpdb->postmeta} ORDER BY meta_key" );
    

    Since I am storing my meta fields/values in a custom table, will it be enough to just change this line? And what should it be changed to?

    #21346
    Long NguyenLong Nguyen
    Moderator

    Hi Eric,

    The extension Meta Box - FacetWP Integrator also supports to index the post which has the field's value save in the custom table. See my screen record https://www.loom.com/share/bfee1ed88ef04a33bf79c16147898163.

    If you want to customize more, please follow the developer documentation of Facet https://facetwp.com/documentation/developers/.

    #21350
    EricHedvatEricHedvat
    Participant

    Thanks it works, makes sense.

    Related to this however, I have tried to create a 'Proximity' Facet which connects to the google maps metabox field - the LAT/LONG of the address. It doesnt seem to work, nor does it register the location coordinates in the facetwp index table in db.

    here is my map field

    [
                    'id'            => $prefix . 'map_lat_long',
                    'type'          => 'map',
                    'name'          => esc_html__( 'Map', 'text-domain' ),
                    'address_field' => 'building_address',
                    'api_key'       => '...',
                    'region'        => '.us',
                    'std'           => '40.7831, -73.9712,14',
                ],

    Thanks.

    #21353
    Long NguyenLong Nguyen
    Moderator

    Hi,

    FacetWP can’t filter by maps. You should make it filter by other fields (cities, wards, etc.), and the map will be displayed accordingly.

    Refer to this topic https://support.metabox.io/topic/render-openstreetmap-for-archive-pages-elementor-or-any/.

    #21356
    EricHedvatEricHedvat
    Participant

    The documentation states it can filter by lat/long: https://facetwp.com/documentation/facets/facet-types/proximity/

    It also says "The Data Source should be a custom field containing a comma-separated latitude, longitude."
    My map field in the custom table is stored exactly like this (provided an address is selected via the building_address field.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.