Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Using CCK 6.x-2.8, location 6.x-3.1, d6.17
When a 'project' node type with 2 location CCK fields is saved, none of the location information is saved. It's as if there was nothing in those fields, excpt that their titles are displaying. No record of it in the database...
Was apparently an issue before and fixed by Bdragon: http://drupal.org/node/347091#comment-1185760
And then again a patch: http://drupal.org/node/346605#comment-1442872
But the patch is older and the code has changed.
Help!
Comment | File | Size | Author |
---|---|---|---|
#48 | cck_location_fields_do_not_save-906968.patch | 667 bytes | loze |
#37 | do_not_update_nonexistent_locations-906968-37.patch | 1.14 KB | pdrake |
#36 | location_data_not_saved_nonexistent_location_entry-906968-36.patch | 610 bytes | pdrake |
#35 | location_data_not_saved_nonexistent_location_entry-906968-35.patch | 610 bytes | pdrake |
#31 | Bildschirmfoto.png | 33.59 KB | drew29 |
Comments
Comment #1
mrcharles CreditAttribution: mrcharles commentedSnap - I have the same problem...
Please help!
Comment #2
007pig CreditAttribution: 007pig commentedPlease disable "Node Locations" and "Location Add Another" module. They're conflict with "Location CCK".
Tech explain:
Node Locations inserts nid and vid to location_instance table.
Location CCK inserts nid, vid and genid to location_instance table.
After Location CCK calls location_save_locations(), Node Locations will call location_save_locations() again with the same nid and vid. Then location_save_locations() thinks that the 'lid' (location id) is an unreferenced location and then deleted the locations Location CCK just creates.
If this error happens, you will see "Deleting unreferenced location with LID X" in system DB logs.
Comment #3
rp7 CreditAttribution: rp7 commentedI can confirm this. Thanks for the solution.
Comment #4
albert9000 CreditAttribution: albert9000 commentedThis solution is not working for me. I've disabled the Node Location and User Location options, and I've uninstalled them. Still no luck. I never had Location Add Another enabled. I suppose I should try a reinstall of the module.
-------------------------------------
Update: This solution does work. I needed to clear my cache.
Comment #5
entilza72 CreditAttribution: entilza72 commentedA warning to others - I used this solution, and it wiped out all of the locations in all of my nodes. The data still shows up in the node location maps, but it is missing in the node view itself, and when editing a node.
So whilst the usual warnings apply (back up your live data), it does leave you holding the can in terms of how to migrate that data. Fortunately, my site is not live, so I've only lost test data and I do not have to worry about migrating the data. But someone will...
Cheers,
Jason.
Comment #6
entilza72 CreditAttribution: entilza72 commentedHi gang - the advice to disable "Node Locations" will have ongoing negative impacts for some Drupal sites, besides the data loss issue I highlighted above. I do not believe this is a "solution" to the problem.
With "Node Locations" disabled as suggested, the URL Aliases module no longer processes Location tokens for example. I am sure the URL Aliases module is not the only one depending on Location information in this way.
Does anyone have a suggestion for how a node can make its Location Tokens available to modules when "Node Locations" has been disabled? Otherwise, a patch/alternative solution may be needed.
A walk-through example:
1. Ensure Location fields are enabled in your node, but with "Node Locations" disabled (as above). Also ensure you have installed/use URL Aliases module.
2. Enter a valid location token into the URL Aliases module under "Automated alias settings" for your node (eg use the token [location-country_name_0] or [location-province_name_0] as a parent directory for the URL). This will successfully save (as opposed to an error if you add an incorrect token) because the location token is correct and known to the system.
3. Bulk generate your node URL (delete the alias beforehand if the node already exists).
4. Now check the node's URL. The Location token part of the URL fails to be interpreted, instead it shows up as the token name (eg "[location-country_name_0]" instead of "Japan"). All other tokens work fine. This implies URL Aliases are working as expected, but just the location tokens are failing to be interpreted.
5. Now re-enable "Node Locations", delete the existing URL Alias for the failed node, and rebuild under "Automated alias settings". You will see the URL now has correctly translated the token.
Cheers,
Jason
Comment #7
bluesherpa CreditAttribution: bluesherpa commentedI ran into this and disabling the listed modules did nothing to fix the problem. Luckily, in my case, I didn't have any data to worry about. The only way I was able to get it working again was to remove the field from the node, save, and then go back in and re-add it.
Comment #8
stefan81 CreditAttribution: stefan81 commentedsubscribe
Comment #9
Alan D. CreditAttribution: Alan D. commented@Bdragon Any work done on this? We have just effectively lost 7000 locations on a live site and will require a data mirgation or fix asap. We have not yet tried dev.
I.E. Will we be starting afresh or have you done some work on this?
For reference #857000: Migrate from node location to cck location
Comment #10
kpojeta CreditAttribution: kpojeta commentedNot sure if this helps but I am having this same issue, however, the phone and fax numbers in the address are retained. All other information is lost (Address, additional, city, state, zip, country).
Comment #11
stefan81 CreditAttribution: stefan81 commented#2 worked for me
Comment #12
adamwhite CreditAttribution: adamwhite commented#2 worked for me as well.
Comment #13
Steven_F CreditAttribution: Steven_F commentedSubscribing
Comment #14
modulist CreditAttribution: modulist commented#2 helped, but I didn't see results until I deleted the Location fields I had created in CCK.
Comment #15
sunchaser CreditAttribution: sunchaser commenteddisabled the Node Locations module as proposed in #2
Removed the CCK field "Locations"
Re-added the CCK field
works
Comment #16
Alan D. CreditAttribution: Alan D. commentedReverting the title - this should represent the active issue, not a single step in the solution!
Comment #17
IT-CruPerhaps their should be a way to set the node location to a number of 0 and then only the CCK locations would be saved? It's not fine but perhaps a possible coding work-around?
I Think many people uses first node_locations so they have many location data bindings to nodes and then activate and use CCK locations. Their should be a warning that node locations and cck locations does not realy work together yet.
Comment #18
capellicI had to remove and then re-add my CCK field. We need an upgrade path. Or we at least need to have a warning during module installation that the modules conflict.
Comment #19
rooby CreditAttribution: rooby commentedSubscribing so I remember to come back and have a look into this.
Comment #20
rooby CreditAttribution: rooby commentedI have now added information about this issue to the INSTALL.txt file in the module and to the location handbook on drupal.org.
For more details see #860820: Teach location_node how to avoid cck locations
For reference, to disable node locations for a content type set the max number of locations to zero on the content type edit page.
I have been investigating this while getting cck locations to work in the D7 version (they wouldn't work at all, even when node locations were disabled - #1048658: location_node is interfering with location_cck saving locations) and it doesn't seem like there is a nice easy solution.
It will probably require a rewrite of the location_save_locations() and location_save() functionality, which will probably not be a minor change.
So it will possibly not be addressed in 6.x-3.x and it will probably have to be done in the next major version.
Setting as non-critical because:
* Node locations and CCK locations weren't intended to work together.
* The functionality of the location module is not broken. Node locations and cck location both work, just not together.
* There is now information available to tell people about this known issue.
Comment #21
Alan D. CreditAttribution: Alan D. commentedAdd the warning to the project page. Personally haven't read one of these files for over 2 or 3 years (unless instructed to do so from the project page). Maybe throw big red warning messages during the install to make the point really clear???
Comment #22
rooby CreditAttribution: rooby commentedYeah, I'll put up a message on the project page.
I often don't read the README & INSTALL files these days either unless I have an issue, then I do.
Most issue queues will tell you if you don't read the documentation you have no cause for complaint.
Comment #23
rooby CreditAttribution: rooby commentedI can add a message when you enable the modules too.
Comment #24
js CreditAttribution: js commentedUntil I read this thread, I didn't know that "CCK location" worked without "node location" enabled. My logic error, obviously, but I had pictured the CCK field as wrapper. Obviously not. I see that now. I only comment because if this is in the documentation, I missed it completely.
Comment #25
rooby CreditAttribution: rooby commentedThe notice is only now on the project page and has only been in the handbook and INSTALL.txt for about a week so that probably explains how you missed it.
Comment #26
lukebrooker CreditAttribution: lukebrooker commentedI am having the same issue even though I have never enabled the "Node Location" Module. The CCK Location will just not save. Is there something else that could also be doing it? I am using Domain Access, Revisioning and Workflows. I haven't had any problems like this so far.
Comment #27
Danny EnglanderSubscribing, same issue. Disabling node locations enabled CCK Location to save and display the data.
Comment #28
scotwith1tThis is kind of a pain, so I've just gotten in the habit of disabling location name for collection and display, using another regular text field for location name and using that field for auto_nodetitle patterns. Would be nice to just use the built-in location name field though. I can't seem to make the location name token work unless I go back and edit and save the node again, so I'm going with my alternate method for the time being.
Comment #29
tahiticlic CreditAttribution: tahiticlic commentedThis bug is common with 7.x-3.x-dev version : even with GMap, GMap location, Location, Location CCK enabled only, location data are not saved.
Comment #30
lukebrooker CreditAttribution: lukebrooker commentedI looked at my database and for some reason their were no location tables created. I disabled and uninstalled all location modules then reinstalled them and it works fine now :)
Comment #31
drew29 CreditAttribution: drew29 commentedHej,
sorry I was wrong here is the right post for the drupal7 version http://drupal.org/node/1064666
kind regards
drew
Comment #32
spyderpie CreditAttribution: spyderpie commented#24 - I didn't realize this either, I also thought cck locations was a wrapper for node location.
#30 - disabling and uninstalling all location modules also worked for me.
Now if I could just get the markers to show on the map ........
Julie
Comment #33
alexbk66- CreditAttribution: alexbk66- commentedCan anybody please explain the difference in usage between 'node location' and 'location cck'?
If I simply want a location associated with a content type, also a map of locations, which one should I use?
Everything I read about this problem says to disable 'node locations' and use 'location cck', but then what's 'node locations' for?
Currently I realized that I have both enabled, I did notice some problems, but can't work out exactly what to do.
HobbyBlob.com
Comment #34
nags338228 CreditAttribution: nags338228 commentedI don't know wht i did. I jus tried out a trick, and it's working fine ... I jus copied this case 'update' from location_cck.module in node_location.module file line 43
if any one having issues please let me know..
Comment #35
pdrake CreditAttribution: pdrake commentedEven after location_node is disabled, locations which may be in an inconsistent state (no location record, but a location_instance record) are not saved because location_load_location returns an object with a lid even if a location does not exist with that lid. An UPDATE SQL statement is then executed although there is no record to update. Attached is a patch to fix the problem by returning false when a location does not exist - allowing the location to be inserted rather than updated.
Comment #36
pdrake CreditAttribution: pdrake commentedThis is the same as the patch in #35 except FALSE is appropriately capitalized.
Comment #37
pdrake CreditAttribution: pdrake commentedThere is another case in which an update may be attempted against a non-existent location which may have been deleted by another CCK field in the same node save. The attached patch fixes both the above case and this case.
Comment #38
pdrake CreditAttribution: pdrake commentedIf you have had Node Location and CCK Location enabled at the same time, there may be entries missing from the location_instance table, which will cause data loss if/when nodes are edited which appear to have a CCK Location entry. Below are two queries which may be used to restore these entries.
Depending on the normalization of your CCK tables, one of the following two should be used for each of your location fields. The first should be used if CCK has created a separate table for storing the location lid (if a table named content_FIELD_NAME_HERE exists). The second if CCK has included the field data in the content type table. Use at your own risk.
Comment #39
bramface CreditAttribution: bramface commentedpdrake, this was really great work on your part! Very complex problem (seems to me) and artfully solved. The SQL query was a particularly nice touch. Thank you for your thorough care!
-bram
Comment #40
ymeiner CreditAttribution: ymeiner commentedThis should be resolved in both modules.
This problem is not resolved even on 7. FYI
Maybe next week i will have time to create a patch for it.
for my website, i know i have one location to every content item. this gives me the ability to just add the following row to the update and insert functions at the end.
it is better to have some sort of checkbox in the field settings that says - sync with node location. In this case:
Yaron
Comment #41
aerozeppelin CreditAttribution: aerozeppelin commented#14 worked for me
Comment #42
aitala CreditAttribution: aitala commentedA quick question - I need to give a node (an event) a location which will be displayed on a map and a location (for the contact person) which is not displayed on a map.
I had tried using both node location (for the event) and CCK location (for the contact person) for the event content type and hit this bug.
What's the easiest way to handle this?
Thanks much,
Eric
Comment #43
doublejosh CreditAttribution: doublejosh commented@aitala
After reading through it looks like you'd need disable both the Node Location and Location Add Another modules.
Then create your CCK field of type location with the CCK Location module turned on.
OR
You can leave them both on and transfer the data over as shown in the query in #38.
Bottom line... giant pain.
Tempting to create a mySQL script that would push all the data across into the new field (with both modules on) then remove the Location module.
Comment #44
ChrisValentine CreditAttribution: ChrisValentine commentedUnder a Drupal 6 install, I have user locations working but I can't get markers to appear on my node locations map. I've tried various combinations of Location and CCK Location modules but it doesn't make any difference - but the location data always seems to stay with the node records, so I don't think its a data issue.
In GMap Location settings, I've used exactly the same value for the Macro as for user locations.
I also followed this video to create a page via Views but again I get a map with no markers:
http://www.drupalove.com/drupal-video/gmap-location-module-and-views
Permissions seem to be correct for each of my user types - each location-related field is on, apart from "administer user locations".
Comment #45
ChrisValentine CreditAttribution: ChrisValentine commentedMy mistake - I had not enabled geocoding options for the countries I was putting nodes in.
Administer › Site configuration › Location > Geocoding options
Comment #46
Alan D. CreditAttribution: Alan D. commented@ChrisValentine Please do not close active issues. I'm glad you resolved your own separate, but unrelated issue. :)
Comment #47
apoc1 CreditAttribution: apoc1 commentedI still have this bug in the lastest 7.x version; even with node location and "add another" disabled, location fields are not saved when saving the node..
Comment #48
loze CreditAttribution: loze commentedI was also having this issue of the fields not saving using the latest 6.x-3x dev branch
- I never had location_node or location_add_another enabled.
- i am using location_cck
I think I tracked it down to the sanitize $op in location_cck_field(). I Think the array_merge is backwards. and it looks like the submitted values are being overwritten by the loaded variables.
from the php manual: http://php.net/manual/en/function.array-merge.php
I switched the order of these and it appears to be working. I'm not too familiar with some of the inner workings of location, and am unsure if this would break something else, but it seems to be working correctly now on my install.
I hope this helps someone. Attached is a simple one line patch.
Comment #49
loze CreditAttribution: loze commentedComment #50
apoc1 CreditAttribution: apoc1 commentedI found out it was a bug that was caused by the field dependencies module. I gave my users the possibility to fill in the adress or select a venue (node) that was listed on our site.
Comment #51
podarok#48: cck_location_fields_do_not_save-906968.patch queued for re-testing.
Comment #52
podarok#48 pushed to 6.x-3.x-dev