• Resolved MattArch

    (@mattarch)


    I’ve had a weird request from a client (post implementing this store locator).
    They’ve asked if I can have one supplier (that has multiple stores) NOT show up in the store locator UNLESS they accessed the page from a certain link, in which case it will ONLY show that supplier.

    If that isn’t possible, is it possible to have more than one store locator?

    Thanks

    https://wordpress.org/plugins/wp-store-locator/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Tijmen Smit

    (@tijmensmit)

    I guess it is possible, but it would be kind of complicated to make and would require lots of customizations. You would need to set a param in the url and then change the sql query to include/exclude a certain results. There is no easy way to do this.

    At the moment you can only have one store locator.

    Thread Starter MattArch

    (@mattarch)

    That’s what I thought. I’ll just have to tell them it’s more work that it’s worth.

    Thanks Tijmen

    Thread Starter MattArch

    (@mattarch)

    I’m working on a solution. There seems to be a problem with it not reading the updated variable. Will update if fixed. This isn’t asking for help (just editing an overeager solution I posted)

    $onlyThis;
        $pageURL = $_SERVER[REQUEST_URI];
        if (strpos($pageURL, "URL_STORE_NAME")!==false){
            $onlyThis = "WHERE store LIKE 'STORE_NAME'";
        }
        else {
           $onlyThis = "WHERE store NOT LIKE 'STORE_NAME'";
        }
    
        $result = $wpdb->get_results(
                        $wpdb->prepare( "
                                        SELECT *, ( $distance_unit * acos( cos( radians( %s ) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians( %s ) ) + sin( radians( %s ) ) * sin( radians( lat ) ) ) )
                                        AS distance FROM $wpdb->wpsl_stores $onlyThis
                                        $sql_part
                                        ",
                                        $placeholders
                        )
                    );

    As this is modifying the plugin, just remember you won’t be able to update.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Multiple Store Locators / Only show specific stores’ is closed to new replies.