Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Sort Order of front end control.


Reply


793 Views

Avatar
CHD

Community Member, 218 Posts

30 August 2010 at 1:52am

I have a table that displays a list of products uploaded through ModelAdmin.
all is working well so far, but i cant seem to get the sort/order to work.

My client needs to be able to manage the order the list as they require, first i hoped they could arrange it in the CSV file, then upload it and the order would be displayed on the front end. but that failed.
then i tried using:

class Catalogue extends Page {
public function ProductList ($filter = null){
if(!isset($_REQUEST['start'])) $_REQUEST['start'] = 0;
$limit = $_REQUEST['start'].",25";
$order = 'Title DESC';
return DataObject::get('Product', $filter, $order, null, $limit);
}

this ALMOST works, but the order isn't consistent!
I can't figure out why it's doing this?
it seems like it only orders by the first character? so my results are something like:

A
AZ
AA
AT
B
BB
BA

does that make sense?

ideally, i have a column in my CSV file called DisplayOrder, that the user can number all parts in the order he wishes them to appear and upload it. but again, it only seems to order by the first digit of the number, and there are over 700 products so its useless!

can anyone help?