Jump to content
landitus

Issue with manual (or default) sorting in the Admin

Recommended Posts

Hello! I'm having a strange issue in only one of my PW sites with the manual sorting of pages. I can't sort pages manually in the admin anymore! I have a group of pages in the site that have manual sorting in their parent's settings and PW let's me drag drop pages around. Everything stays in place the way I want, and no errors arise, but when I reload the page the sort change are not saved and everything stays in the same same.

Maybe I'm missing something here cause I'm stuck!! I had some issues with this server provider (in my last two forum messages) so I am betting this can be the cause. I'm using PW 2.2.0 (should I try an upgrade?) Any clues?

post-72-0-03357400-1334847938_thumb.png

Share this post


Link to post
Share on other sites

Just to confirm, the sort settings in your screenshot are for the parent page of those you are trying to sort?

If you can, turn on your developer tools (Firebug in FF or Dev Inspector in Chrome). Watch what it does when you finish the sort. Do you see any JS errors? If you click on the network request, do you see any messages in the response that look like errors?

Share this post


Link to post
Share on other sites

Ryan, thanks for answering. The parent is called "Banners" and has manual sort (that's the screenshot). It has 12 "banner" children/pages which I'm trying to sort. Turning Developer tools shows everything is fine: the console it silent and the network request POST is perfomed and shows:

  • error: false
  • message: "Updated sort for 12 pages"

Share this post


Link to post
Share on other sites

I've been testing this and found yet another odd thing... The desired order is showed on the front-end though it's not updated in the admin page tree. I guess it's just a problem in my admin panel.

Share this post


Link to post
Share on other sites

Landitus, try adding this to one of your templates somewhere, view a page using it, and see what it says. Replace '/path/to/parent/' with the path to the parent page of the children that aren't getting the correct sort in the admin.

$children = $pages->get('/path/to/parent/')->children();
echo "<ul>"; 
foreach($children as $child) echo "<li>{$child->sort}: {$child->url}</li>"; 
echo "</ul>";

What you should see is a list of a child pages with the number on the left starting at 0 and incrementing by one for each. But let me know if you see something different.

Another thing to try would be to change your parent to have some specific sort, save it, then change it back to no sort. I can't say as though I've ever had to do that before, but it seems like one way to just reset things there, just in case.

Share this post


Link to post
Share on other sites

Ryan, my results where diferent. Actually the numbers are my desired order, and the order showed here is exactly what's shown in the admin. I've tried re-setting the sorting orden with no luck!

  • 3: /pw/promos/promo.../
  • 4: /pw/promos/promo.../
  • 5: /pw/promos/promo.../
  • 6: /pw/promos/promo.../
  • 7: /pw/promos/promo.../
  • 8: /pw/promos/promo.../
  • 9: /pw/promos/promo.../
  • 10: /pw/promos/promo.../
  • 11: /pw/promos/promo.../
  • 0: /pw/promos/renova.../

Share this post


Link to post
Share on other sites

Do try a table repair... :) (could be)

Adit:

- or try opening a childpage and change something and save it.

- or sort the last page to first place

Also try trace 1 page (id) in the db table where the sort field is. Before and after you sort change one page in the admin, what happens in the db table? Does it change anything?

  • Like 1

Share this post


Link to post
Share on other sites

I agree with Soma on all points. The first thing I would try is his suggestion to drag/sort the last page to the first spot. That would force it to re-populate the 'sort' field from all the pages in the list. But if that doesn't do it, I think a table repair would be the next step. Any time MySQL is producing some unexplainable behavior, a repair is a good way to go. But luckily that's not often. :)

Share this post


Link to post
Share on other sites

Well, thanks for the suggestions. I couldn't fix the problem, yet.

Do try a table repair... :) (could be)

I've repaired two tables (pages and images) that had overhead. The repair was successful, but no change. I followed this tutorial

- or try opening a childpage and change something and save it.

- or sort the last page to first place

No change either.

Also try trace 1 page (id) in the db table where the sort field is. Before and after you sort change one page in the admin, what happens in the db table? Does it change anything?

This was interesting. The table is getting the right values. I've traced a page via phpmyadmin and It gets the position I'm giving it. Also, the other pages change their positions as well. I went to the admin, but there, the order is still the same stuck order. Looking closer, I think it's stuck in a "created at" order. And that order is also showing in the front-end.

I'm stuck :( I'm trying to trace the problem, but sorting did use to work for a while. It's weird, cause in have 2 other sites with this same host provider. The only mayor difference is that this DB is shared with some tables from Codeigniter, which are prefixed CI. This PW installation is inside a pw folder. And that's it. So I'm out of leads with this.

Share this post


Link to post
Share on other sites

If you want, email or PM me a copy of your database (SQL dump) and I can try to load it here to see what the issue might be.

Also, I think it would be worthwhile to grab the latest source code (2.2.0.1) to replace your /wire/ dir with the latest, just in case.

Share this post


Link to post
Share on other sites

Ryan, I've sent you a PM with the mysql dump!

Share this post


Link to post
Share on other sites

Thanks Landitus--got it. I'll take a look and let you know what I find.

Share this post


Link to post
Share on other sites

Just got a chance to test this here. Unfortunately I can't seem to reproduce it though. I tried drag-sorting child pages in both /tester/ and /promos/, but the order is retained regardless of what I try. I'm starting to wonder if we're looking in the wrong place. What web browser and version are you using?

Share this post


Link to post
Share on other sites

Ryan, thanks for testing. I use both Firefox and Chrome latest versions, and both show the same. I didn't understand what you mean with "the order is retained regardless of what I try". The order should change, right? I want to clarify that both the backend and front end show the pages/records in the wrong order (I presume is created-at) in my installation, but the DB shows the right number, which is the manual order. Where you able to re-sort everything correctly?

Share this post


Link to post
Share on other sites

What I mean by "the order is retained" is that it was consistent with how I ordered it. I was able to re-sort everything without any unexpected results. I tried about a dozen times just to be sure. Since I can't reproduce it here, is it something I could login to there?

Share this post


Link to post
Share on other sites

I've been trying lots of different things, I think I found something interesting. I tried installing a brand new PW in a subfolder and in a diferent database on the same server my site is in. I did the install on the server (not in my local machine) and found some warnings (see attached screenshot). Then, having a brand new PW installation, I tried to sort the About pages, and to my surprise, the same happens. The sort looks fine, reload and bam, same problem, the sort is not reflected in the admin.

So, this could be a server issue? Are those errors any indication?

PD: Ryan, I can definitely give you access. Do you need a PW user? FTP access?

post-72-0-02281300-1335403354_thumb.png

Share this post


Link to post
Share on other sites

Which MySQL version do you use? There was a problem with 5.0.51 (afair) which had a sorting issue.

  • Like 1

Share this post


Link to post
Share on other sites

I can't believe it was that... I have 5.0.51!! I was able to upgrade to a later version and the sorting works fine! I want to thank everyone for helping me out here! :)

Share this post


Link to post
Share on other sites

Glad the answer turned up! I was really confused about this one. :) I'm surprised that any web hosts would be using a MySQL version with this issue. It seems like this would affect almost anything that uses MySQL.

Share this post


Link to post
Share on other sites

This web host never ceases to surprise me! Time to look for another one I guess... :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By opalepatrick
      Hi, trying to order pages by modified date, date. I can do 'sort=-date_modified, sort=-date' but that will always put the modified date first regardless of actual date order. I just want to coalesce the two fields and sort. Any ideas would be appreciated.
    • By ttttim
      Is there a way to add a (new or existing) page to the top of the asmSelect list? By default they're added at the bottom. 
    • By Leftfield
      Hi,

      First, this is production realestate site, big one. So please, if any chanse to fix this without touching database, it would be great

      I have field "pstatus" as a PageReference,
      In the tree under Status as children:
      sold unavailable paused In the template "property" I have dropdown were I choose: empty (nothing); sold; unavailable or paused. If you do not choose anything, property will have active selling status.

      I need help sorting property template in this order: show all empty and than show all sold.

      1031 is Status, parent of the sold unavailable and paused.
       
      $status = $pages->get('1031')->children('sort=pstatus'); $selector[] = "sort=price, pstatus!=$status"; But I got there all except from status. I need to list "sold" too.

       
    • By louisstephens
      I have done a bit of searching, but I can not seem to find an actual answer. I have a list of services as child pages under "Services". I can output the services just fine, but I cant wrap my head around how to group them "alphabetically" like:
      Services A - Service "A" 1 - Service "A" 2 - Service "A" 3 B - Service "B" 1 - Service "B" 2 - Service "B" 3 C - Service "C" 1 - Service "C" 2 - Service "C" 3 Has anyone achieved this type of functionality before?
    • By j__
      On a site that lists events, I am using a repeater field 'event_time', which contains two Inputfield Time fields 'event_time_start' and 'event_time_end'. Some events take place multiple times, others just once. Here's an example for the data structure:
      event1 title: First Event event_time (1): event_time_start: 08:00 event_time_end: 09:00 event2 title: Second Event event_time (1): event_time_start: 08:00 event_time_end: 09:00 event_time (2): event_time_start: 14:00 event_time_end: 18:00 event3 title: Third Event event_time (1): event_time_start: 07:00 event_time_end: 09:30 First, I'd like to generate a list of all events, sorted by event_time_start, with every repeater item added as an actual event (similar to a SQL JOIN clause). The desired output would be:
      07:00-09:30 Third Event 08:00-09:00 First Event 08:00-09:00 Second Event 14:00-18:00 Second Event A selector like
      $pages->find('template=event,event_time.event_time_start!=,sort=event_time.event_time_start'); would only return each event page once:
      07:00-09:30 Third Event 08:00-09:00 First Event 08:00-09:00 Second Event without
      14:00-18:00 Second Event Is there a possible alteration of the selector to take all different occurrences into account?
      Also I'd like to filter for events taking place in the morning, using a selector like:
      $pages->find('template=event,event_time.event_time_start>=06:00,event_time.event_time_start<=12:00,sort=event_time.event_time_start'); However, this would only return each 'event' page, which then contains also the afternoon version of event2.
      While I have the impression these are rather simple tasks, I struggle finding a selector-based solution to it. In this example on opening times are some similarities, but it does not deal with multiple occurrences. I'd appreciate your ideas to it.
×
×
  • Create New...