Closed (duplicate)
Project:
Location
Version:
6.x-3.0
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 Jan 2009 at 20:03 UTC
Updated:
19 Apr 2011 at 08:33 UTC
You can't use location filters (zip code, province, country) or arguments (for example the location directory) with cck location fields. I'm temporarily getting around this problem by adding an extra row for each location instance in the location_instance table. Example:
nid vid uid genid lid
0 0 0 cck:field_home_address:347 391
347 347 0 cck:field_home_address:347 391 - added by me
It seems to need two rows to see that it is both a cck field and a location instance. The resulting nodes display in the directory. However, this is definitely a stop-gap measure. I used the code from http://drupal.org/node/363698 to fix the same issue in Drupal 5. Anyone have a solution for Drupal 6?
Comments
Comment #1
jastraat commentedPossible solution:
I changed line 163 in the location_cck.module to:
location_save_locations($items, array('nid' => $node->nid, 'vid' => $node->vid, 'genid' => $genid));
Then I deleted all my extra rows with blank nid/vids in the location_instance table. The cck locations are still showing in the location directory, and new nodes added are also displayed.
Comment #2
jastraat commentedComment #3
Chris Przybycien commentedThe patch in #1 causes a problem when you view a node with a CCK location field. The location will show up once under the normal Location heading then again under the CCK location field heading you've chosen. I changed the line as shown below:
location_save_locations($items, array('nid' => $node->nid, 'genid' => $genid));
Doing this fixes the double location display and still allows Views to see the association between nid and lid when created from the CCK location field. Forgive my ignorance if removing 'vid' is the wrong way to achieve this goal. I'm a site builder not a developer :)
Comment #4
jastraat commentedYou probably want to keep vid. If you are using Drupal's versioning abilities, the vid refers to the version id. The way I fixed the double display was just unchecking 'Display location in teaser view' and 'Display location in full view' under Locative information->Display settings for the content type.
Comment #5
Chris Przybycien commentedYour suggestion was exactly right, thanks!
By the way... should someone change the status to "patch (code needs review)"?
Comment #6
bdragon commentedThat change is wrong. genid and the rest of the fields in location_instance are mutually exclusive.
Comment #7
jastraat commentedIn that case, what solution would you propose? I'm using the code above since it's the only way I can replicate the functionality I need.
Comment #8
bdragon commentedAdding a relationship to the view.
However, I still haven't finished deciding exactly how the relationships are going to work. It's a big goal for 3.1....
In the meantime, feel free to continue using your solution, if it does what you need...
Comment #9
ntt commentedsubscribing
Comment #10
jasontanner commentedsubscribing
Comment #11
Chris Przybycien commentedIs there a discussion thread somewhere about location_cck development with respect to views? I am very excited about this functionality (it's essential to a site I'm been building) and would like to keep current and help with testing.
Comment #12
milosh commentedsubscribing
Comment #13
kristen polI do not see a relationshiip in the views ui. Can someone provide an example or the steps for getting this to show up?
...
I ditched using the cck field and just did it with the built-in locative info stuff and it works fine. Why are there both of these?
Comment #14
uprojects commentedIn the release notes of location 6.x-3.1-rc1, I see "Add relationship support for location CCK fields. This gets us most of the way to full location_cck views support" but me too, i do not see any relationshiip in the views ui !
So what is the statue of this issue ?
Comment #15
Chris Przybycien commentedI believe that entry in the 6.x-3.1-rc1 changelog simply means the framework for relationship support has been laid but the actual relationship has yet to be defined.
As bdragon stated in #8 they are still working on the location relationships.
Comment #16
uprojects commentedSorry , i had not see the comment#8
Thank for the preciseness
Comment #17
yesct commentedI'm using #1 combined with #4 to get my cck locations to show up on maps generated with views.
I hope to see a "real" solution soon. :)
Comment #18
yesct commentedI think that #391160: CCK/Views: location_instance fix might be the official solution to this.
Comment #19
lance.gliser commentedI've run into the same solution.
Not saving the NIDs and VIDs made content unsearchable.
I did the same fix:
It's a bad work around, but the second location can be themed out to hide it.
Comment #20
yesct commentedtagging
Comment #21
dieter commentedsubscribing
Comment #22
nickl commentedDuplicate #391160: CCK/Views: location_instance fix
Comment #23
modulist commentedsubscribing
Comment #24
Frederic wbase commentedany sollutions for this problem?