Skip Navigation

[Resolved] Map View is broken – no changes were made…

This support ticket is created 3 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 18 replies, has 2 voices.

Last updated by shawnW-3 3 years, 6 months ago.

Assisted by: Christian Cox.

Author
Posts
#2037303

We haven't yet run this on the Live site...

Looking at Test we realized it shaved off too much.

One thing to note is that 'wpcf-dealer-address' is absolutely the only address field the site is using. The others listed will be deprecated.

Another important thing I should have made clear is that if a user is in the United States and that user does not opt-in to Google's Geo-Locate, then an IP API service will return their 5 digit zip code to the Toolset Map View search field and submit on document ready.

There are quite a lot of codes in the US, so keeping all 5 digit zip codes we get in the cache would save us google maps API usage fees.

Would you be able to adjust the sql to accommodate that?

#2039743

Okay I understand your request, it would be preferred to maintain all cached entries for 5-digit US zip codes. I will ask my 2nd tier team if this customization is possible with a SQL modification, and let you know what I find out. It's fairly custom, but I also think it would be fairly useful for similar sites.

#2046213

Okay I have an update to the SQL script. This should be run in a test environment after you pull down the full database from the live site:

DELETE wp_toolset_maps_address_cache
FROM wp_toolset_maps_address_cache
LEFT JOIN wp_postmeta
    ON wp_toolset_maps_address_cache.address_passed = wp_postmeta.meta_value
    AND wp_postmeta.meta_key IN ('wpcf-dealer-address','wpcf-dealer-address-contact','wpcf-address-contact-crm-bdt','wpcf-address-contact-crm-ss','wpcf-address-contact-hd-bs','wpcf-address-contact-hd-rc','wpcf-address-contact-hd-ss')
WHERE wp_postmeta.meta_value IS NULL
AND wp_toolset_maps_address_cache.address_passed NOT REGEXP '^[0-9]{5}$'

...or if you want to go ahead and delete from the deprecated address fields as well:

DELETE wp_toolset_maps_address_cache
FROM wp_toolset_maps_address_cache
LEFT JOIN wp_postmeta
    ON wp_toolset_maps_address_cache.address_passed = wp_postmeta.meta_value
    AND wp_postmeta.meta_key IN ('wpcf-dealer-address')
WHERE wp_postmeta.meta_value IS NULL
AND wp_toolset_maps_address_cache.address_passed NOT REGEXP '^[0-9]{5}$'

That should preserve all 5-digit US zip code entries. Please let me know the results after running this script in an updated test environment.

#2048083

My issue is resolved now. I would like to strongly recommend expanding on the map cache controls / automation in the settings panel. We're probably not the only Toolset user walking the tightrope of exceptionally high usage while trying to avoid google maps API hits. That said, we really appreciate you taking the time to work up the SQL specifically for our situation. It's definitely a workable solution. Many Thanks!