• Resolved dbetberg

    (@dbetberg)


    Hi,

    So how the business works is if you select a particular city, state, then there is only one location that should be shown.

    However, if you put in just the state, we want to show ALL locations within that state.

    I haven’t been able to figure out how to do this. Any suggestions?

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

    (@tijmensmit)

    This is not supported at the moment, but it will come in 3.0 update where any state / country input will optionally return all locations.

    Thread Starter dbetberg

    (@dbetberg)

    HI,

    Thanks for responding. That’s great! Do you a general estimate on when the 3.0 update might be available.

    Plugin Author Tijmen Smit

    (@tijmensmit)

    Well, I keep running into issues, but early December may work.

    Hi @tijmensmit!

    Are you still planning to add a similar feature and release a new version of plugin? That would be really very helpful!

    Is there NOW a way to add a custom button to the template (which would work using AJAX/JS) and simulate the search action (as if the user entered something in the search field and clicked on the “Search” button).

    For example (briefly),
    I created and use a Custom Store Locator Template, and will add something like:

    <a href="" id="" onclick="">New York</a>

    When the user clicks on this button, it simulates the user’s actions, the same as if the user entered “New York” in the search box and pressed “Enter”.

    Will it work?
    That would help a lot!

    Thanks!

    • This reply was modified 3 years, 10 months ago by dev_John.
    • This reply was modified 3 years, 10 months ago by dev_John.
    Plugin Author Tijmen Smit

    (@tijmensmit)

    I have had some health issues, so couldn’t get as much work done as I would have liked to the last couple of weeks. The update will still come, it includes lots of other things like support for OpenStreetMaps, REST API etc.

    To make a custom link trigger a search requires the trigger event for the #wpsl-search-btn.

    Hi @tijmensmit

    Thank you for taking the time to respond!
    I hope you’re feeling well!

    Yes, of course I used .trigger(), I added some buttons using some similar code:

    	window.addEventListener("DOMContentLoaded", function () {
    			$(document).ready(function() {
    			       $("#CUSTOM_BTN_ID_1").click(function() {			       		
    			           $("#wpsl-search-input").val("SOME_STATE_VALUE_1");
    			           $("#wpsl-radius-dropdown").val("SOME_RADIUS_VALUE_1");
    			           $( "#wpsl-radius .wpsl-dropdown .wpsl-selected-item" ).attr( "data-value", "SOME_RADIUS_VALUE_1" );
    			           $("#wpsl-search-btn").trigger("click");
    			       });
    			});
    
    			$(document).ready(function() {
    			       $("#CUSTOM_BTN_ID_2").click(function() {			       		
    			           $("#wpsl-search-input").val("SOME_STATE_VALUE_2");
    			           $("#wpsl-radius-dropdown").val("SOME_RADIUS_VALUE_2");
    			           $( "#wpsl-radius .wpsl-dropdown .wpsl-selected-item" ).attr( "data-value", "SOME_RADIUS_VALUE_2" );
    			           $("#wpsl-search-btn").trigger("click");
    			       });
    			});
    	});

    everything works as I planned, except for one problem:
    when I click on the first button, my script works correctly, I see what I need on the map and see the corresponding results in the list.
    But if after that I click on any other custom button, the results will start to get confused, for example, the marker of the previous search result will remain on the map, but the results in the list will be correct, or the previous results will remain in the list of results, and a new marker will appear on the map. This applies to all subsequent button clicks. BUT, if I click the same button twice, the results will be correct again.

    It looks like there is no reset of some parameters after clicking on the next custom button.

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Show all results if just state chosen’ is closed to new replies.