For example I add:
-loc 1
-loc 2
-loc 3
in my node and save.
Then when I edit it I see them in this order:
-loc 3
-loc 2
-loc 1
It seems to me that they are saved wrong in the location_instance table. Any help?
Thanks.
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | location-6x-order-356059-12_cossme.patch | 1022 bytes | cossme |
| #8 | location-356059-8-D5.patch | 2.66 KB | agileware |
| #7 | location-356059-7-D6.patch | 2.65 KB | agileware |
| #3 | location-356059-3.diff | 3.32 KB | slip |
| #2 | location-356059-2.diff | 1.62 KB | slip |
Comments
Comment #1
dakku commentedyup, I have the same issue. Any ideas to fix it?
Comment #2
slip commented[EDIT: my patch didn't quite work after a bit more testing.]
I'm no location expert and I threw this patch together really quickly so no guarantees... but it works for me so far.
With the patch, whenever the location module reads from location_instance it sorts by lid so the lowest lid, or the one you entered in first is shown first. Seems to make sense but just a quick fix.
Comment #3
slip commentedOK, here's attempt number two and it needs some review... Again, I'm not a location expert, just a man with a deadline and just sharing my code.
This one modifies the db and adds a column to location_instance called weight, so you'll have to run update in /admin/build/modules. The weight is set on save. I've tested the mysql update code, not the install code.
Comment #4
yesct commentedseems related to #346300: Nodes with multiple locations , locations appear to "switch"
but I dont know if it is exactly a duplicate.
Comment #5
yesct commented#346300: Nodes with multiple locations , locations appear to "switch" was marked as a duplicate of this issue
Comment #6
agileware commentedThis patch #338745: Multiple locations on a single map fixes this problem in drupal 6 as it was necessary to fix it for the functionality that the patch provides.
That patch implements the $cow (copy on write) functionality that was partly in the module already but left unused. So it gives the admin the option to copy on write or not, instead of how it currently work, which is to always copy on write. It also makes it so that the location_load_location function orders by lid when it selects.
To explain the issue, copy on write means that whenever you update a nodes locations it makes a copy of the location and saves it as a new location, then deletes the old location. So you end up with a new location with a new lid. This means that even when you select locations ordered by lid they are out of order.
Seeing as this is an issue of its own now I could split that part of the code from that patch and put it here if you like. I can make a 5 and 6 version.
Comment #7
agileware commentedHere is my solution to this problem, which has been split out from my other patch referenced in #6.
It builds on the 'copy on write' functionality that is already in the module.
This is for 6.x-3.x-dev (2009-Apr-18).
Comment #8
agileware commentedHere is a D5 version of the patch in #7
It is for 5.x-3.x-dev (2009-Apr-18).
Comment #9
agileware commentedThe patch for D6 in #7 will also apply to 6.x-3.1-rc1
and the patch for D5 in #8 will also apply to 5.x-3.1-rc1
Comment #10
yesct commentedPlease check to see if the problem is in the newest official release, lots of changes have been made recently. Maybe a re-roll is necessary. Seems like a lot of work has been done here, and that if the problem still exists, and the patch can be re-rolled, we can probably get this reviewed and committed (we have a lot of support from the maintainers lately! Yeah!). Thanks.
Comment #11
harry slaughterMe Too! thought i was going nuts.
patch #7 seems to work. with d6
following....
Comment #12
cossme commentedi have attached a small patch for location.module - for me it fixes the problem of reordering, switching and displaying locations in the wrong order (in edit and display mode).
i simply adjusted the location_load_locations() function so it greps the locations from the database ordered by lid.
if it is in the wrong place: sorry, but i thought it could be helpful and did not find a better place.
the patch was applied to version 6.x-3.1 of the location module
cheers,
cossme
Comment #13
rooby commented@cossme,
This is the right issue for your patch.
However, your patch has the same changes as the patch Agileware already submitted in #7, which I think still applies, just with a little bit of an offset.
The difference being that Agileware's patch also addresses another cause of the problem with the copy on write part.
So at this stage the patch to review is still #7, which looks good. I will test it out soon.
Thanks for the patch though. Also, it is very helpful to create patches with diff's -u & -p options - See http://drupal.org/patch/create
Comment #14
guillaumeduveauSub
Comment #15
podarokbot recall
Comment #16
podarokbot
Comment #17
podarok#7 commited pushed to 6.x-3.x
Thanks!