Images output in wrong order...
I have a pod item with a column type file, this column can have multiple images. I need this column to send me back the images in the order they are placed in the column. They however seem to come back sorted on the id. How can i get my returned $value to show up unsorted. If i go into the pod admin, everything shows up in the correctly placed order, so i know its happening sometime before display.
Any help would be appreciated. Thanks.
4 Answers
Bring $value into an array and then write a function to perform a uasort() of $value on the post_date key. You can then loop through $value with a foreach to output the items in the order you wish.
Thanks for the suggestion, I'll see what I can make this do for me. It just seems so odd that they $value array returned from pods comes presorted by ID. You would think it would be easier to just send it back to me as I put it in.
Actually, we are using the "weight" column to track the order of file / pick relationships as they're saved, but the SELECT we get for the "real" data returns it ordered by insert ID. So actually, we're using a ID IN(1,3,5,2,6) WHERE clause, where as 1,3,5,2,6 is the order of the IDs actually saved in the UI, but MySQL doesn't follow that ordering when returned. I'll look into a quick fix, feel free to check into MySQL ORDER BY and see what you might be able to come up with too and I'll consider that for 1.12.3
added this to the end of the function rel_lookup to get it to send the array in the weighted order:
$pieces = explode(",", $tbl_row_ids); // take our correct order string and turn it into a usable array
array_multisort($pieces,$data); // take our resulted data and sort it in order based on $pieces since its currently ordered by 'ID'
}
else {
$data = $result;
}
return $data;
}


