Jump to content

Cannot sort pagearray after adding items


cpx3
 Share

Recommended Posts

I have the following selector:

$ps = wire("pages")->find("parent=/veranstaltungen/, !promo_start_date>$time, !promo_end_date<$time, limit=3, sort=start_date");

 

that works perfectly. But when I add pages from another query with $a->add() function, the two page arrays seem to get sorted separatedly when I sort them with $array->sort(), but I need the whole array to be sorted... Any ideas what I am doing wrong? 

 

Link to comment
Share on other sites

Please check if you have a page item added twice in your PageArray after the add operation. Had a similar issue with sorting in one of my projects due to one page item added twice as result of an add call. Just output the PageArray e.g. with Tracy dump methods for a quick check. If there are duplicated page items, PageArray is sorted by page ids by default. See this thread for additional infos.

  • Thanks 1
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...