I have a drupal 6 website with many nodes, which were created before I came aware of the existence of the location module. These nodes have (normal) cck text fields for street address, postal code, city and country. As I would like to provide a map for each node, and thus use the location and gmap module, I would like to import or copy the values in my normal cck fields into the location fields. I tried to do this by using mySQL, but I noticed that the geocodes were not automatically computed. Also the values of the location fields (which are there, because I can explore them with mySQL in the location table, are not displayed in the node view. Only when I fill in the location fields by hand, the geocodes are computed and the fields are displayed correctly.
So, could someone help me by providing some instructions to follow? Thank you.
K
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | Captura2.PNG | 14.78 KB | manoloka |
Comments
Comment #1
tom_gustav commentedAnyone?
Comment #2
restyler commentedHere is the code that is seems to work for me, geocoding is working too
I've created it 2h ago, please tell me if you get any problems
Please note that I have location_cck field now attached to profile node type, that replaced my plain cck fields.
Comment #3
yesct commentedalso, try the migrate extras module:
http://drupal.org/node/459236#comment-2757412
Comment #4
rooby commentedMarking as a duplicate of #570816: Convert from CCK field to Location CCK field
I have given some explanation there but there is not really any easy solution unfortunately.
Comment #5
manoloka commentedHi Restiler,
I've tried your sql query but I get an error in line 1
Any idea what could be wrong? my content type is called "business"
I'd be happy to pay for someone to get me this done as I've got over 2000 nodes that need importing all this data.
Comment #6
manoloka commentedHi tom_gustav,
I think yuo can use the solution here http://drupal.org/node/1041632 to update geocode.
Could you please post what mysql queries did you use to import your data?
Thanks
Manuel
Comment #7
rooby commentedAlso look at comment #1 in the issue linked to in #4.
The sql part of your code looks fine, but it looks like you might be somehow passing the whole lne into mysql, not just the sql?
You don't seem to be copying restyler's code exactly.
For one you are missing the curly braces.
Try copying it exactly and only changing table and field names as required.
Comment #8
manoloka commentedHi Rooby,
Thanks for pointing this out, what I silly mistake :( I did paste it directly into the sql query form of my phpmyadmnin
I've now created a page with it give it php code input format and simply open the page within a browser ... and seems to be working to some extend, however some of the data in some of the nodes isn't being copied, I can't see why, I'll have a closer look.
Comment #9
manoloka commentedI got it all working except for the "province" that it was taxonomy term id therefore it's not recognizing it.
How could sort that out?
Comment #10
rooby commentedDoes the term name = the province?
If so you can get the term name from the term ID via the term_data database table.
If not you have to manually map your term ID's to their corresponding province.
Comment #11
manoloka commentedYes it does, however I've noticed that the location table saves the 3 letter code instead of the whole name, I don't know if that affects.
I wouldn't know how to change the script for that (not a programmer),
any help on this?