jdaehne / GoogleStoreLocator

MODX Extra: Proximity search of Stores based on the Google API.
6 stars 3 forks source link

A few question #10

Closed zenotds closed 6 years ago

zenotds commented 6 years ago
  1. Is it possible to have the form in a page and the results in another? Or eventually load the result with ajax without having to refresh the page?

  2. Dont know if it's a bug or i'm doing something wrong but i'd love to show results only if more than 0 stores are found. My code is like this:

[[!GoogleStoreLocator? &parents=68 &totalVar=totalStores ]] [[!+gsl.form]] <span class="debug">[[+totalStores]]</span> [[+totalStores:is=0:then=There are no stores in your area:else=[[!+gsl.map]]]]

While .debug always show the correct results the output filters doesnt work, it always shows the map even with 0 results.

zenotds commented 6 years ago

I managed to achieve something like what i wanted with css by hiding the div with class "results0". I then read the url and if it contains the string "?location" i make the page scroll down to the results div.

Not optimal at all since it still loads the map, but will work for now.

jdaehne commented 6 years ago
  1. Both yes. You can eather just place [[!GoogleStoreLocator]] and [[!+gsl.form]] without [[!+gsl.map]] on the one site and on the other site you do the same with [[!+gsl.map]] and without [[!+gsl.form]]. But you could also just create your own form and just direct to your result site. 1B. Ajax calls are easy with the runSnippet code from MODX: https://docs.modx.com/revolution/2.x/developing-in-modx/other-development-resources/class-reference/modx/modx.runsnippet Just setup your own ajax-call and run the GoogleStoreLocator Snippet within this call.

  2. There is a "&tplNoResult" chunk. May that help you? But your option works too. Just don't cache this placeholder: [[!+totalStores:is=0:then=There are no stores in your area:else=[[!+gsl.map]]]]