Sort Order

Has something changed in the Sort order since the 1.4.5.7 update?

My sort no longer seems to work.

Under Options>Image I have "Sort Images By" set to Custom, and my custom fields set to date,filename

This has always displayed my new images first in the albums, but since the last update images seem to appear in random order.

Comments

  • fretzl Administrator, Developer
    You're sure the option on admin=>options=>image is not overridden by the sort option on the album edit page ?
  • I do have problems with the image sort order as well (since i did an update to 1.4.5.8).

    Case:
    I do have images in manual order like: A,B,C

    When i do upload new images (1,2,3) i would expect the new order to be: A,B,C,1,2,3

    In fact the new order looks like this 1,A,2,B,3,C

    Changes on the admin->options-> page doe's not affect my image sort order in the album at all (i tried every possible value, even sort by db field 'sort_order,date') . The order in the album is set to "manually".

    I did an update to 1.4.5.9. but it did not solve the problem.
    Inside the database the "sort_order" field for the new images (1,2,3) ist set to "NULL".

    Help appreciated :-)
  • acrylian Administrator, Developer
    The expected sortorder would be numbers first actually. I quickly tried with jpgs with the filename 1,2,3,a,b,c sorting title and filename (no special title set).

    Sorting by filename was correct 1, 2, 3, a, b, c but by title it was 2, 3, a, b, c, 1. Both on 1.4.5.9 support build and 1.4.6.

    So something seems wrong. Best open a ticket.
  • Please try this with the 1.4.6 development release. There are a number of issues with sortorder being set "too late" and therefore objects coming in a different sort order.

    Also please describe exactly how you have set things. For instance, if by "admin->options->page" you mean the global sort order it can be overridden by sort order of a particular album.
  • acrylian Administrator, Developer
    I have tried with both builds and with the options of the particular album itself. Title = filename. Since filename works maybe related to the serialized storing of titles?
  • I am not seeing this at all. Both filename and title(when same as file name) give the same sort order and it is as expected. (1.4.6 build)
  • Just for grins I tried this on the 1.4.5.9 release and it worked there correctly as well.
  • Ok i did another testing. The behaviour only appears once you've saved a manual image order. Adding images to an album with it's images already having a "sort_order" number is causing new images to be sorted in between the old images like 1,A,2,B,3,C (as i've mentioned above).

    If there is no "sort_order" value stored for the images, new images are put in order behind the older images.

    Options->Images->Order is set to: custom(sort_order,date) (but no changes do occur, whatever i choose here!. Albums sort order is "manually".

    I did update the site from 1.4.4. to 1.4.5.8 (then to 1.4.5.9)

    Let me know if you do need any further information.

    Thank you for your help!
  • So would you recommend to install the 1.4.6. development build??
    This strange behaviour occured on a live website with a big image database and in every folder were images have been uploaded after i did the update to 1.4.5.8 the manual sort order is now incorrect. This is causing me a lot of trouble, so any help is really appreciated.

    Thank you for your patience!
  • acrylian Administrator, Developer
    No, we don't recommend 1.4.6 on a production site (see the post about testers for 1.4.6) yet.

    As I could reproduce it on both installs there must be some detail that is going wrong. But that will require more testing. I haven't looked into the database for example. Still interesting that it works with ordering filename but not titles. Especially as they are the same in my case.
  • Okay i did manually override the code on zp-core/admin-albumsort.php with my custom order:
    "getImages(NULL,NULL,'sort_order,id')" and did the same on all my template parts where "next_image()" occurs. Now it works as it should.

    I know editing core files is not recommended. But i guess that within the next update the problem will be fixed, so that i can easily replace the core file with the original one.

    So if anyone is experiencing the same problem, this might be a solution for now.

    Thanks for your support!
  • Perhaps I am confused:

    Are you sorting by ID as above or by filename as first stated?

    The code you put in `admin-albumsort.php` will have no impact on anything (except the order of that display) unless you save the sort. Then the sort will be "manual". If the sort is manual new images do indeed go at the end. They have to go somewhere and that seemed reasonable.

    You should read the release notes for the next release. Placing the sort order in the `next_image()` loop is deprecated (and often does not work anyway) because any "fetch" if images prior to the loop probably will be in a different order. So such things as pagination will fail.

    You can set the album object sort order at the start of your script with object methods. This is available in the 1.4.5.9 release already. If this is done before any other reference to the images then all is consistent.
Sign In or Register to comment.