blocksoftware.mattijs

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • in reply to: How to show just search field? #57965
    blocksoftware.mattijs
    Member

    sorry not right now because the feature is still in development so I can’t publicize it yet.
    I will make a proof of concept soon (if possible this weekend), I will keep you posted.

    Mattijs Snepvangers
    Blocksoftware BV, a division of Robotogroep.nl

    in reply to: How to show just search field? #57961
    blocksoftware.mattijs
    Member

    $("input[class^=wpgmza_sl_search_button]").click()

    Actually means:
    look for the first input element who’s class name starts with “wpgmza_sl_search_button” and click it

    Mattijs Snepvangers
    Blocksoftware BV, a division of Robotogroep.nl

    in reply to: How to show just search field? #57959
    blocksoftware.mattijs
    Member

    • This reply was modified 5 months ago by blocksoftware.mattijs. Reason: Removed this duplicate post

    Mattijs Snepvangers
    Blocksoftware BV, a division of Robotogroep.nl

    in reply to: How to show just search field? #57958
    blocksoftware.mattijs
    Member

    Search form on different page, basic as can be:

    form method="get" action="/locations/"
         input type="text" name="near" placeholder="postal/city"
         input type="submit" value"search"
    /form

    The javascript code in my previous reply is placed inside the body tag, just underneath the loading of jquery of each page.
    The advantage of this, combined with the wildcard in the js code means you can have multiple search forms with multiple maps by altering the ‘action’ link in the form code.

    The search parameter will be entered by the js code in the first addressInput field found and the first searchbutton found will be clicked, but not before the markerlistings are loaded(updated).

    For instance, if you enter Alphen aan den Rijn, the get request becomes "website"/locations/?near=Alphen+aan+den+Rijn, which the js code translates back to Alphen aan den Rijn, enters it in the addressInput field and hits the search button.

    If you like, I can set up a private demo for you guys tomorrow

    Mattijs Snepvangers
    Blocksoftware BV, a division of Robotogroep.nl

    in reply to: How to show just search field? #57937
    blocksoftware.mattijs
    Member

    I fixed it!!!

    Here’s the updated code:

    
    jQuery(function ($) {
    	function getParameterByName(name, url) {
    		if (!url) url = window.location.href;
    		name = name.replace(/[\[\]]/g, '\\$&');
    		var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'), results = regex.exec(url);
    		if (!results) return null;
    		if (!results[2]) return '';
    		return decodeURIComponent(results[2].replace(/\+/g, ' '));
    	}
    	$(window).on('markerlistingupdated.wpgmza', function(event) {
    		var near = getParameterByName("near");
    		if(!near) return;
    		$(".addressInput").val(near);
    		$("input[class^=wpgmza_sl_search_button]").click();
    	});
    });
    

    Mattijs Snepvangers
    Blocksoftware BV, a division of Robotogroep.nl

    in reply to: How to show just search field? #57935
    blocksoftware.mattijs
    Member

    the closing bracket doesn’t seem to make a difference, sadly… I can’t get the dialog boxes to stop, option to block them is gone now as well. I feel really stupid right now…

    Mattijs Snepvangers
    Blocksoftware BV, a division of Robotogroep.nl

    in reply to: How to show just search field? #57933
    blocksoftware.mattijs
    Member

    the weird part is; the closing bracket is in the source but it’s gone after divi mangels (parses) it…

    Mattijs Snepvangers
    Blocksoftware BV, a division of Robotogroep.nl

    in reply to: How to show just search field? #57928
    blocksoftware.mattijs
    Member

    the corresponding line of code:

    document.querySelector("label[for^='wpgmza_tolls_1']").childNodes[1].nodeValue = " Tol vermijden";

    Mattijs Snepvangers
    Blocksoftware BV, a division of Robotogroep.nl

    in reply to: How to show just search field? #57926
    blocksoftware.mattijs
    Member

    appearently it get’s fired to quickly. now, i’ve read some stuff on stackoverflow concerning jquery->deferred(); what element should I look for to make sure all stuff concerning wpgmaps is loaded before sending the click?

    update: info from the browser console:

    Uncaught TypeError: Cannot read property ‘childNodes’ of null
    at HTMLDocument.<anonymous> (?near=breda:608)
    at i (jquery.js?ver=1.12.4-wp:2)
    at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4-wp:2)
    at Function.ready (jquery.js?ver=1.12.4-wp:2)
    at HTMLDocument.J (jquery.js?ver=1.12.4-wp:2)

    • This reply was modified 5 months ago by blocksoftware.mattijs.

    Mattijs Snepvangers
    Blocksoftware BV, a division of Robotogroep.nl

    in reply to: How to show just search field? #57925
    blocksoftware.mattijs
    Member

    regarding the last 2 replies by me:

    the first one is in chrome, the second one is in firefox.
    Opera’s response resembles firefox’s, but worse; no blocking option and much, much more iterations… ceased my efforts with opera…..
    M$ edge takes about 25-30 clicks….

    Mattijs Snepvangers
    Blocksoftware BV, a division of Robotogroep.nl

    in reply to: How to show just search field? #57923
    blocksoftware.mattijs
    Member

    ok, now i have to block dialogs for the plugin to load properly?!

    what did i mess up?

    https://voedietist.nl/locaties/?near=alphen+aan+den+rijn

    update: appearently the plugin generates the <place not found> dialog 40-50 times before loading the rest of the map….

    • This reply was modified 5 months ago by blocksoftware.mattijs.

    Mattijs Snepvangers
    Blocksoftware BV, a division of Robotogroep.nl

    in reply to: How to show just search field? #57922
    blocksoftware.mattijs
    Member

    ok, it kinda works but still needs some tweaking, maybe a delay?
    now i get an alert saying “no results found” but a couple of secs later the results show up and the alert disappears….

    I’ve altered the js code slightly to accomodate for the different search button class generated by wpgmaps:

    $("input[class^=wpgmza_sl_search_button").click();

    This way it’ll look for any input element which classname starts with “wpgmza_sl_search_button” and clicks it. This way you can use one piece of code in the header on multiple maps if need be.

    Mattijs Snepvangers
    Blocksoftware BV, a division of Robotogroep.nl

    in reply to: How to show just search field? #57920
    blocksoftware.mattijs
    Member

    cheers!

    Mattijs Snepvangers
    Blocksoftware BV, a division of Robotogroep.nl

    in reply to: How to show just search field? #57915
    blocksoftware.mattijs
    Member

    I’ve made a very basic search form which generates this:

    voedietist.nl/locaties/?near=alphen+aan+den+rijn

    The search form sits on a seperate page, so GET is our preferred way of getting this working considering SEO…

    The code doesn’t need to be 100% specific, I like to learn stuff along the way 😉

    Your efforts are really appreciated!!!

    • This reply was modified 5 months ago by blocksoftware.mattijs. Reason: url 2 code

    Mattijs Snepvangers
    Blocksoftware BV, a division of Robotogroep.nl

    in reply to: How to show just search field? #57911
    blocksoftware.mattijs
    Member

    sure does, let me get back to you on that! (:

    Mattijs Snepvangers
    Blocksoftware BV, a division of Robotogroep.nl

Viewing 15 posts - 1 through 15 (of 16 total)