Jump to:

7935 Posts in 1536 Topics by 943 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Sort Order of front end control.

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 704 Views
  • CHD
    Avatar
    Community Member
    218 Posts

    Sort Order of front end control. Link to this post

    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?

    704 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.