New home › Forums › Pro Add-on › General queries › Add '15 miles' to store locator radius drop-down?
Tagged: radius, store locator
- This topic has 15 replies, 5 voices, and was last updated 4 years, 3 months ago by thebobajob.
-
AuthorPosts
-
February 27, 2017 at 12:00 pm #24749adambradfordMember
Hi,
I am using the Store Locator above a map and it works very well.
The ‘Radius’ drop-down starts at 10 miles and then goes up to 25 miles, 50 miles etc. The site owner is asking me if it is possible to add an additional figure of 15 miles in there?
Thanks.
Adam.
February 27, 2017 at 1:36 pm #24752adambradfordMemberHi Nick,
Thanks for your reply. I’m perfectly happy to make changes to the code my end, but since I’ve already made some changes (as seen in this thread: https://www.wpgmaps.com/forums/topic/change-map-marker-list-to-direct-links), I’m a little worried that if I keep making changes, it will be very difficult if you guys update the plugin at some point and I then need to re-enter all my changes if I want to use the new version!
Please could you publish the required code changes, and I’ll then decide whether to use them? If not then at least it may help someone else looking here with the same requirement!
Thanks,
Adam.
March 1, 2017 at 8:36 am #24806DylanModeratorHi Adam,
Thank you so much for your time on this one.
This can be achieved by finding the following segment of code in the wp-google-maps-pro/wp-google-maps-pro.php file:
$ret_msg .= " <option class=\"wpgmza_sl_select_option\" value=\"1\">".__("1mi","wp-google-maps")."</option>"; $ret_msg .= " <option class=\"wpgmza_sl_select_option\" value=\"5\">".__("5mi","wp-google-maps")."</option>"; $ret_msg .= " <option class=\"wpgmza_sl_select_option\" value=\"10\" selected>".__("10mi","wp-google-maps")."</option>"; $ret_msg .= " <option class=\"wpgmza_sl_select_option\" value=\"25\">".__("25mi","wp-google-maps")."</option>"; $ret_msg .= " <option class=\"wpgmza_sl_select_option\" value=\"50\">".__("50mi","wp-google-maps")."</option>"; $ret_msg .= " <option class=\"wpgmza_sl_select_option\" value=\"75\">".__("75mi","wp-google-maps")."</option>"; $ret_msg .= " <option class=\"wpgmza_sl_select_option\" value=\"100\">".__("100mi","wp-google-maps")."</option>"; $ret_msg .= " <option class=\"wpgmza_sl_select_option\" value=\"150\">".__("150mi","wp-google-maps")."</option>"; $ret_msg .= " <option class=\"wpgmza_sl_select_option\" value=\"200\">".__("200mi","wp-google-maps")."</option>"; $ret_msg .= " <option class=\"wpgmza_sl_select_option\" value=\"300\">".__("300mi","wp-google-maps")."</option>";
And simply adding another ‘option’ field as seen here:
$ret_msg .= " <option class=\"wpgmza_sl_select_option\" value=\"1\">".__("1mi","wp-google-maps")."</option>"; $ret_msg .= " <option class=\"wpgmza_sl_select_option\" value=\"5\">".__("5mi","wp-google-maps")."</option>"; $ret_msg .= " <option class=\"wpgmza_sl_select_option\" value=\"10\" selected>".__("10mi","wp-google-maps")."</option>"; $ret_msg .= " <option class=\"wpgmza_sl_select_option\" value=\"15\" selected>".__("15mi","wp-google-maps")."</option>"; $ret_msg .= " <option class=\"wpgmza_sl_select_option\" value=\"25\">".__("25mi","wp-google-maps")."</option>"; $ret_msg .= " <option class=\"wpgmza_sl_select_option\" value=\"50\">".__("50mi","wp-google-maps")."</option>"; $ret_msg .= " <option class=\"wpgmza_sl_select_option\" value=\"75\">".__("75mi","wp-google-maps")."</option>"; $ret_msg .= " <option class=\"wpgmza_sl_select_option\" value=\"100\">".__("100mi","wp-google-maps")."</option>"; $ret_msg .= " <option class=\"wpgmza_sl_select_option\" value=\"150\">".__("150mi","wp-google-maps")."</option>"; $ret_msg .= " <option class=\"wpgmza_sl_select_option\" value=\"200\">".__("200mi","wp-google-maps")."</option>"; $ret_msg .= " <option class=\"wpgmza_sl_select_option\" value=\"300\">".__("300mi","wp-google-maps")."</option>";
I hope this helps? 🙂
March 6, 2017 at 4:07 pm #25020adambradfordMemberHi Dylan,
Since this required only a small addition to the code, I decided to implement it, and it worked a treat. Many thanks.
Adam.
March 7, 2017 at 7:44 am #25027DylanModeratorHi Adam,
My pleasure, glad to hear it helped!
Please shout if you need any further assistance in future.
Have a great week! 🙂
March 7, 2017 at 4:36 pm #25034adambradfordMemberHi Dylan,
Unfortunately I spoke too soon, the page in question is exhibiting strange behaviour.
Please could you have a look?
https://www.mamababybliss.com/find-a-class-or-therapist-near-you
Thanks,
Adam.
March 8, 2017 at 8:28 am #25040DylanModeratorHi Adam,
So sorry for the issues you are having.
I had a look at your map, however it appears to be working as intended.
Perhaps I am overlooking something on my side?
March 8, 2017 at 10:13 am #25041adambradfordMemberHi Dylan,
If you try to search for a place name, for example “Mapperley” on a 10 mile radius, and note the number of pins in the circle.
Then try the same search with a 15 mile radius, and you’ll see firstly that there is no circle, and secondly that nearly all the pins are missing.
Thanks,
Adam.
March 8, 2017 at 1:57 pm #25044Nick DuncanKeymasterHi Adam
Sorry about that. There is one more thing to change!
Please open wp-google-maps-pro/js/core.js and search for this function:function searchLocationsNear(mapid,category,center_searched,search_title) { clearLocations(); var distance_type = document.getElementById("wpgmza_distance_type_"+mapid).value; var radius = document.getElementById('radiusSelect_'+mapid).value; if (parseInt(category) === 0) { category = 'all'; } if (category === "0") { category = 'all'; } if (category === "Not found") { category = 'all'; } if (category === null) { category = 'all'; } if (category.length < 1) { category = 'all'; } if (distance_type === "1") { if (radius === "1") { zoomie = 14; } else if (radius === "5") { zoomie = 12; } else if (radius === "10") { zoomie = 11; } else if (radius === "25") { zoomie = 9; } else if (radius === "50") { zoomie = 8; } else if (radius === "75") { zoomie = 8; } else if (radius === "100") { zoomie = 7; } else if (radius === "150") { zoomie = 7; } else if (radius === "200") { zoomie = 6; } else if (radius === "300") { zoomie = 6; } else { zoomie = 14; } } else { if (radius === "1") { zoomie = 14; } else if (radius === "5") { zoomie = 12; } else if (radius === "10") { zoomie = 11; } else if (radius === "25") { zoomie = 10; } else if (radius === "50") { zoomie = 9; } else if (radius === "75") { zoomie = 9; } else if (radius === "100") { zoomie = 8; } else if (radius === "150") { zoomie = 8; } else if (radius === "200") { zoomie = 7; } else if (radius === "300") { zoomie = 7; } else { zoomie = 14; } }
Please change that too:
function searchLocationsNear(mapid,category,center_searched,search_title) { clearLocations(); var distance_type = document.getElementById("wpgmza_distance_type_"+mapid).value; var radius = document.getElementById('radiusSelect_'+mapid).value; if (parseInt(category) === 0) { category = 'all'; } if (category === "0") { category = 'all'; } if (category === "Not found") { category = 'all'; } if (category === null) { category = 'all'; } if (category.length < 1) { category = 'all'; } if (distance_type === "1") { if (radius === "1") { zoomie = 14; } else if (radius === "5") { zoomie = 12; } else if (radius === "10") { zoomie = 11; } else if (radius === "15") { zoomie = 11; } else if (radius === "25") { zoomie = 9; } else if (radius === "50") { zoomie = 8; } else if (radius === "75") { zoomie = 8; } else if (radius === "100") { zoomie = 7; } else if (radius === "150") { zoomie = 7; } else if (radius === "200") { zoomie = 6; } else if (radius === "300") { zoomie = 6; } else { zoomie = 14; } } else { if (radius === "1") { zoomie = 14; } else if (radius === "5") { zoomie = 12; } else if (radius === "10") { zoomie = 11; } else if (radius === "15") { zoomie = 11; } else if (radius === "25") { zoomie = 10; } else if (radius === "50") { zoomie = 9; } else if (radius === "75") { zoomie = 9; } else if (radius === "100") { zoomie = 8; } else if (radius === "150") { zoomie = 8; } else if (radius === "200") { zoomie = 7; } else if (radius === "300") { zoomie = 7; } else { zoomie = 14; } }
- This reply was modified 6 years ago by Nick Duncan.
- This reply was modified 6 years ago by Nick Duncan.
March 8, 2017 at 2:17 pm #25048adambradfordMemberThanks Nick, that works perfectly.
Adam.
March 8, 2017 at 7:07 pm #25052adambradfordMemberHi,
Sorry to keep bothering you about this, but I just noticed an issue. Under Advanced Settings I use the first option for Infowindow Style (the default, I think). This displays perfectly when a pin is clicked without first using the locator.
However, if I enter a search term into the box and search within any radius, clicking a pin means that the Infowindow shows the photo at the top (instead of to the right where I wanted it) and in some cases this obscures the text.
Is it possible that the modifications have broken something?
Adam.
March 9, 2017 at 8:35 am #25057Nick DuncanKeymasterHi Adam
This is a confirmed bug, sorry about that. To fix this (in the meantime, until we release the new version), please change the following in the core.js (pro):
if (wpgmaps_localize_global_settings['wpgmza_settings_image_width'] === "" || 'undefined' === typeof wpgmaps_localize_global_settings['wpgmza_settings_image_width']) { wpgmaps_localize_global_settings['wpgmza_settings_image_width'] = 'auto'; } else { wpgmaps_localize_global_settings['wpgmza_settings_image_width'] = wpgmaps_localize_global_settings['wpgmza_settings_image_width']+'px'; } if (wpgmaps_localize_global_settings['wpgmza_settings_image_height'] === "" || 'undefined' === typeof wpgmaps_localize_global_settings['wpgmza_settings_image_height']) { wpgmaps_localize_global_settings['wpgmza_settings_image_height'] = 'auto'; } else { wpgmaps_localize_global_settings['wpgmza_settings_image_height'] = wpgmaps_localize_global_settings['wpgmza_settings_image_height']+'px'; }
To this instead:
if (wpgmaps_localize_global_settings['wpgmza_settings_image_width'] === "" || 'undefined' === typeof wpgmaps_localize_global_settings['wpgmza_settings_image_width']) { wpgmaps_localize_global_settings['wpgmza_settings_image_width'] = 'auto'; } else { if(wpgmaps_localize_global_settings['wpgmza_settings_image_width'].indexOf('px') === -1){ wpgmaps_localize_global_settings['wpgmza_settings_image_width'] = wpgmaps_localize_global_settings['wpgmza_settings_image_width'] + "px"; } } if (wpgmaps_localize_global_settings['wpgmza_settings_image_height'] === "" || 'undefined' === typeof wpgmaps_localize_global_settings['wpgmza_settings_image_height']) { wpgmaps_localize_global_settings['wpgmza_settings_image_height'] = 'auto'; } else { if(wpgmaps_localize_global_settings['wpgmza_settings_image_height'].indexOf('px') === -1){ wpgmaps_localize_global_settings['wpgmza_settings_image_height'] = wpgmaps_localize_global_settings['wpgmza_settings_image_height'] + 'px'; } }
- This reply was modified 6 years ago by Nick Duncan.
- This reply was modified 6 years ago by Nick Duncan.
May 18, 2017 at 10:08 pm #27273jwrightspplusMemberQuestion…. would not all the recommended changed mentioned here be wiped out when the Pro Plugin gets updated?
May 19, 2017 at 1:40 pm #27292DylanModeratorHi there,
Yes that is correct, unfortunately these changes will be undone upon updating the plugin.
We will be adding options in the future to customize the radius options permanently from within the settings.
I hope this helps?
-
AuthorPosts
- You must be logged in to reply to this topic.