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.
i saw the discussion about gmap having problems showing the node's location, when using CCK. but i don't even get the field itself to display it's content
when i build a view with fields and insert a CCK location field, it's empty, though i know i did put an address in the field.
is this a bug or am I (doing something) wrong?
Comment | File | Size | Author |
---|---|---|---|
#18 | location_cck.field_format.patch | 954 bytes | nickl |
Comments
Comment #1
YesCT CreditAttribution: YesCT commentedTagging.
Comment #2
YesCT CreditAttribution: YesCT commentedare you getting the nodes listed in the view ok (via filter), but just not being able to add the data for display (fields)?
Comment #3
JIspahany CreditAttribution: JIspahany commentedI think I am getting the same problem. Where I create a view and try and filter the contents of the Location field (Location:City for example). It is able to find the field but the contents of the field (Location:City) shows as empty.
Comment #4
YesCT CreditAttribution: YesCT commentedThere is a patch to add a relation, ...
this one seems to be the way things are heading:
#347030: location_cck needs a views relation
Comment #5
drupaloo-1 CreditAttribution: drupaloo-1 commentedHi,
I am also having the same problem:
- I have a number of CCK location fields
- I have created a view that contains those fields
- The view shows CCK location field headings but NOT their contents - Eg: The View displays a Country field label but the actual contents of each record, eg. Canada, Netherlands, etc. is not displayed.
- I have triple checked that the Location country field does contain data eg. Canada, Netherlands, etc.
From reading various posts I am not sure if there is a final patch or if a relationship needs to be added to the view.
Could you please let me know how things stand?
Thanks!
Comment #6
YesCT CreditAttribution: YesCT commentedthere is a patch (to implement the relationship) and then you have to add the relationship.
Comment #7
drupaloo-1 CreditAttribution: drupaloo-1 commentedHi,
Thanks for getting back to me.
To be honest, I looked at applying a patch in a Windows environment, and it looked pretty complicated, and so I would rather wait till the module is revised.
Comment #8
alvinet CreditAttribution: alvinet commentedAny news or new feature for this module to implement this function?
I have the same problem. Adding Location field to a view doesn't return any value.
Comment #9
fred0 CreditAttribution: fred0 commentedI am also seeing this. I tried to describe it in another issue (http://drupal.org/node/383244#comment-2059868) but I think I did a poor job.
Now that I've done some more research, I can elaborate more clearly.
First, to respond to YesCT in #6: True, you can use the patch from http://drupal.org/node/383244#comment-1877654 and it adds the proper relationship functions but it 's more of a workaround to a bug in Location CCK.
I'll explain, but let me first describe the data storage for those unfamiliar. When you save a node with Location CCK data, it saves the location data in the tables created by the Location module. CCK modules usually rely on CCK to create and manage the required tables and then store the data in those tables. Location CCK instead stores the lid in the CCK table as a reference to the record it saved to the location table. When you view Location CCK data in a node that it has been added to, the module uses that reference to find the location in the other table and display the data.
Views then shows several fields as being available. Because the Location module is enabled, one sees a group of fields under the title Location such as Location:City. These are the individual parts of a location as provided via the Location module. One also finds a field under Content that is named for any Location CCK field you created.
Views should display the CCK field type, but adding it to a view returns empty data. It does not matter what widget format one chooses for the field (Address, Address with map, Map, Map with multiple locations), it always displays empty data. That's the bug I have been trying to figure out today without any luck (so far).
Adding any of the individual Location fields also shows empty. This is because the location data was not created by Node Locations and is not related to the node in a way that Location knows about. It's related only via the lid in the CCK record. To get around that, the patch adds the ability to create a views relationship to the CCK reference that those fields can then use. With the relationship in place, one can now use the individual Location fields and display the address or its individual components.
For myself, I want to use the latter method of using the CCK field because of its ability to display the address with a map but, as I said, that's not working.
Comment #10
hellomobe CreditAttribution: hellomobe commentedfred0 - did you just update the patch for the 7.31.09 version of location_cck.module, or did you update the entire Location package from March 2009 to the July development package?
Please explain how to set up the location relationship in views. I don't see location as an option.
Comment #11
fred0 CreditAttribution: fred0 commentedI believe I patched the 7-31-09 dev version.
Comment #12
hellomobe CreditAttribution: hellomobe commentedI'm still not seeing where I can select Relationship => Location. I have applied the patch and no luck. Please walk me through the process when you have a moment. Very grateful!
Comment #13
TKS CreditAttribution: TKS commentedSubscribing...
Comment #14
cdale CreditAttribution: cdale commentedYou can fix this issue by adding the following code into a module or theme, and naming accordingly.
The problem simply appears to be that the location is not loaded up correctly when it comes time to theme it. This will not fix the bug, but it will suppress the issue until someone has time to figure out what is really going on.
EDIT: Don't forget to flush the theme caches after adding this function. You can do this by visiting admin/build/theme, or using cache clearing functions provided by admin_menu, devel, and some themes.
Comment #15
TKS CreditAttribution: TKS commentedThanks cdale -- this works like a charm!
Comment #16
nickl CreditAttribution: nickl commentedDuplicate issue:
Moved to CCK/Views: location_instance fix with a patch for a permanent solution ready to be reviewed.
Comment #17
nickl CreditAttribution: nickl commentedMy bad! fred0 explains the bug well in #9 if I read it properly the first time round. Changed to bug report and made active again.
This does not relate to the individual location fields (city, country, street, etc) but to the cck exposed field which carries the lid (location id). The query works and returns the lid but the location information is not retrieved hence the theme_preprocess quick fix suggested by cdale in #14.
Comment #18
nickl CreditAttribution: nickl commentedI believe this bug came to be after optimizing the hook_field load so that cck can cache the location data, which allowed us to remove the location loading from the theme functions. http://drupal.org/node/383244#comment-1291018
This is all true for node fields but when views displays the field drupal_render is bypassed and views content handlers are used to render the fields and the locations are never cached for the themes.
This patch is another approach at solving the problem via hook_field sanitize, identifiable through a pseudo-node generated by the content handlers.
All but one of the formats are working; 'Multiple field values on a single map'. Any suggestions?
Comment #19
thill_ CreditAttribution: thill_ commentedsubscribe
Comment #20
light9 CreditAttribution: light9 commentedThank you cdale! your solution works for me!
Comment #21
l-r CreditAttribution: l-r commentedI don't know if my problem falls under this category...
I'm trying to set a relationship - "Content (Location)" to use with GMAP + cck + views, but I simply can't see the "Content" option. There's a few other things I can select (comment, node revision, taxonomy...) but not matter I do, they never change.
Normal?
Comment #22
Anonymous (not verified) CreditAttribution: Anonymous commentedDon't know if this is what you're after but this helped me set up a gmap + cck + views page:
- install latest dev versions of gmap and location modules
- install patch at comment #59 here http://drupal.org/node/391160
- create view using method at comment #4 http://drupal.org/node/386848
Comment #23
l-r CreditAttribution: l-r commentedThanks totsubo,
seems like the patch #59 (second link) did it!
Comment #24
Marko B CreditAttribution: Marko B commented#22 works only for block display of CCK field. If i wanted to use block, probably i wouldnt use cck fields at all. This Location CCK patches stuff is complet mess :-(
Comment #25
emilyf CreditAttribution: emilyf commentedthanks cdale; #14 works great.
Comment #26
choofins CreditAttribution: choofins commentedcdale nailed it with #14. Make sure to flush your cache by visiting your themes page.
Comment #27
frob#14 worked for me.
Nothing was loading from the location except the lid. This is still a workaround though. I have not tried the patch or the dev branch mentioned in #16
Comment #28
Jackinloadup CreditAttribution: Jackinloadup commented#14 worked for me.
Comment #29
seanrThe patch in #18 solved this problem for me. Appears to work well.
Comment #30
hm2k CreditAttribution: hm2k commentedGot a similar problem using Location 6.x-3.x-dev.
You can fill out the location details, hit preview and that will display as expected.
When you hit save, the location field is left blank.
Upon editing the node again, the location details have disappeared.
It was previously working on other nodes, but editing/saving recent nodes makes the location details disappear.
Will be disabled until a fix is proposed.
Any updates or advice?
Thanks.
Comment #31
marcxy CreditAttribution: marcxy commentedsubscribing.
Comment #32
eiland CreditAttribution: eiland commentedPatch #18 doesnt work for 3.x-dev. Neither does 14.
Comment #33
HongPong CreditAttribution: HongPong commentedSubscribing -- pretty serious
Comment #34
cha0s CreditAttribution: cha0s commentedYup... still happening.
Patch from #18 applies with fuzz on 6.x-3.1; works.
Comment #35
JayKayAu CreditAttribution: JayKayAu commented+1 Same situation, patch from #18 works on 6.x-3.1
Comment #36
glennpratt CreditAttribution: glennpratt commentedSame issue, #18 appears to work here as well.
Comment #37
nickl CreditAttribution: nickl commentedAlso been RTBC for two months already, please commit!
Comment #38
planctus CreditAttribution: planctus commentedAt last...i found this.
Cck location is now working using the patch at #18
Is there any reason why this hasn't been committed in a release here, yet?
Anyway, thanks,
Da.
Comment #39
rooby CreditAttribution: rooby commentedThanks for the patch.
I have committed a modified version of the patch in #18 to 6.x-3.x and HEAD.
Note though that this code isn't valid for drupal 7 but I committed it to keep the versions in line until the D7 version is properly ported. That way no functionality will be lost.
I changed it so it checks that the location has not been previously loaded, instead of checking for a pseudo-node from views content_handler_field because that way we cover other times when the hook_field load $op is not called, for example any modules or themes that use content_format() to output a field might not use the same sort of pseudo node.
I also made the comment more detailed to explain what the code is for.
http://drupal.org/cvs?commit=473706
http://drupal.org/cvs?commit=473708
The problem you mentioned regarding the 'Multiple field values on a single map' formatter is unrelated to this issue. It seems that formatter doesn't work properly in general at the moment.
Comment #40
rooby CreditAttribution: rooby commentedMarked #999770: CCK Location field doesn't appear in views as a duplicate of this issue.
Comment #41
rooby CreditAttribution: rooby commentedRe the problem regarding the 'Multiple field values on a single map' formatter. See this issue - #841340: Location CCK and Multiple field values on a single map