• Resolved facemail4me

    (@facemail4me)


    Hi,
    i am looking for a way to add stores automatically.
    I thought you could use a Contact form 7 and then create the store in a hook. What would be the best function for that?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter facemail4me

    (@facemail4me)

    i would like to have the function that is used at CSV import, which also maps the fields and calculates GPS.
    If I buy the add-on, do I have such a function and if so, what is it called?

    Plugin Author Tijmen Smit

    (@tijmensmit)

    The code in the CSV Manager runs on import only, so it’s not a standalone function that you can use.

    But if your comfortable with code use wp_insert_post and set the post type to wpsl_stores.

    Next set the meta data with the returned post id with update_post_meta. You can get a list of used meta fields with this function.

    Geocoding the address can be done with this function.

    I will create a single function to get this done in the next update.

    Thread Starter facemail4me

    (@facemail4me)

    okay thanks for the quick response.
    That’s what I call good support, i like it
    When would the function be available?

    And how do I get the “wpsl_get_address_latlng” function in the function.php? The rest I know and can implement myself.

    Plugin Author Tijmen Smit

    (@tijmensmit)

    You will have to include the /plugins/wp-store-locator/inc/wpsl-functions.php file in the functions.php to call the wpsl_get_address_latlng function, or just copy the code and place it in a custom function.

    Thread Starter facemail4me

    (@facemail4me)

    okay i get the error:
    Cannot redeclare wpsl_get_gmap_api_params() (previously declared in wp-content/plugins/wp-store-locator/inc/wpsl-functions.php:12)

    i included like this:
    $file = ABSPATH.’wp-content/plugins/wp-store-locator/inc/wpsl-functions.php’;
    include($file);

    and used it like this:
    $longlat = wpsl_get_address_latlng( $fields[ ‘street’ ].’ ‘.$fields[ ‘nr’ ] .’, ‘.$fields[ ‘city’ ] );

    Plugin Author Tijmen Smit

    (@tijmensmit)

    Try changing include($file) into require_once( $file );

    Thread Starter facemail4me

    (@facemail4me)

    okay thx it works fine.
    YOu can add the post and meta in one function.
    Now i have another question.
    I need to ” Clear store locator transient cache” that it will show, wen you don’ filld the search form.
    Is there a function for that?

    Plugin Author Tijmen Smit

    (@tijmensmit)

    Try this.

    $wpsl_admin = new WPSL_Admin();
    $wpsl_admin->delete_autoload_transient();
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Create a store with php’ is closed to new replies.