Skip Navigation

[Resolved] How can I convert my old Types custom fields to new Address for Google Maps

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.

This topic contains 5 replies, has 3 voices.

Last updated by craigB-3 5 years, 9 months ago.

Assigned support staff: Beda.

Author
Posts
#354558

Hello,
I have 2,000+ directory listings with the address built from single line custom fields (address, city, state, zip)

I'm testing out the beta Toolset Maps plugin (0.9), but I see that it uses a new 'Address' custom field.

How can I convert all of my old addresses to this new custom field type?

Thank you,
Craig

#354563

Thank You for asking. I have the same requirement

#354705

Thank you for contacting us here in the Support Forum

The situation is a bit specific here, as we previously had many Fields for the address and now a single Address Field.

of course you could run a get/update query to retrieve the information stored in the old fields, and update_post_meta this info (after formatting it) to the new dress fields.

But please let me query with the DEV if they have foreseen this and eventually have a smarter solution ready.

What is possible out of the Box, is to set "Enable the old Views Map Plugin" in Views > Settings if you are already using Maps with the Older Plugin.

Please expect my informations here in the forum.

Thank you for your patience.

#354921

I apologize the delay here

There are 2 solutions.

1. if you have a address stored in ONE field (even if old MAPS plugin) you could head to Types Custom Fields Control and change the type of this field to be "address field"
(Backup your Database previously!)

2. if you stored the Addresses in many single fields (town, country, number, street etc) then you need Custom Code scripts.

This Script would:
1. get_post_meta of each single Field of each single Post,
2. then you would join those values (for each post) with PHP in a $variable = $street . ',' . $town . ',' . $country ;
3. and update your new Custom (address) Field of each post, with each new $variable value.

I would recommend to keep the old way if you have many of those entries and want to avoid Custom Code.

Please do not hesitate to open a new thread if other issues or problems arise

Thank you for your patience.

#354990

Hi Beda,
I suspected that would be the answer.

In my case then, I'll need a custom script (solution #2 you described).

However, creating this custom script is beyond my abilities. Can you recommend a vendor

#354993

Hi Beda,
One other question as I reach out to a developer to get this custom script...

The script they create will populate the new address field, but is that all that's necessary.

The reason I ask is, when you manually input an address into the new plugin, it queries Google and pulls in the map. During this manual process, is something returned from Google and inserted into the database?

Since this custom script will probably be done via mysql, it won't be triggering that Google query.

Thanks again,
Craig