Results 1 to 12 of 12

Thread: [solved] Sorting in MM FE list ?

  1. #1
    User
    Join Date
    04-01-10.
    Posts
    292

    Default [solved] Sorting in MM FE list ?

    Hi everyone and the best for 2017 !

    I've a MM list to display a list of peoples in FE. I'm feeling stupid to ask it but I don't find how to let visitors choose the sorting : by name or by zipcode for example.

    Thanks for this first help of 2017 ;-))
    Last edited by charled; 01/18/2017 at 17:14. Reason: solved

  2. #2
    User zonky's Avatar
    Join Date
    11-29-11.
    Location
    Berlin
    Posts
    160

    Default

    Hi,

    you should have a select field at CE-MM-List or FE-Module MM-List to sort your items e.g. name or zip as default...

    as add you can activate "Allow sort override" to change the sorting per get parameter.

    Pls look at

    http://metamodels.readthedocs.io/en/...ptions-ce-list


    [Thx at Almut for the translation!]

  3. #3
    User
    Join Date
    04-01-10.
    Posts
    292

    Default

    Ok. I'll see it. I haven't yet translated this page of Almut's translation ;-))

  4. #4
    User
    Join Date
    04-01-10.
    Posts
    292

    Default

    ok. Got it.

    So do I have to create manually two links or is it possible to integrate them in the CE_MM_list as a select button for example ?

  5. #5
    User zonky's Avatar
    Join Date
    11-29-11.
    Location
    Berlin
    Posts
    160

    Default

    I add links manualy at template e.g. in the header of a table

    you can see this at https://www.vhw-hamburg.de/wohnen/ak...-angebote.html

  6. #6
    User
    Join Date
    04-01-10.
    Posts
    292

    Default

    Ok. And how do you manage the switch between ASC and DESC ?
    Last edited by charled; 01/12/2017 at 23:58.

  7. #7
    User zonky's Avatar
    Join Date
    11-29-11.
    Location
    Berlin
    Posts
    160

    Default

    some lines as example

    PHP Code:
    ...
    $strCurrentOrderDir strtoupper(\Input::get('orderDir'));
    ...
    $strToggleOrderDir  $strCurrentOrderDir == 'ASC' 'DESC' 'ASC';
    ...
    $strHeadline '<a href="'.\Frontend::addToUrl(...&orderDir='.$strToggleOrderDir.').'">My Headline</a>'

  8. #8
    User
    Join Date
    04-01-10.
    Posts
    292

    Default

    Ok but before trying to use toggle, I still have a problem with the former part of the answer…

    I have a filter module just before the list with a select list for departments (like '01 - Ain', '06 - Alpes maritimes'...) and a tag filter for specialities.

    So, when I first load the page, the url is : http://eefic-v3-b:8888/sitev3-B3/trouver-expert.html

    If I select the department '06 - Alpes maritimes', the url becomes : http://eefic-v3-b:8888/sitev3-B3/tro...Maritimes.html

    Then I can manually add '/orderby/nom_expert/orderDir/ASC' to the url and it works : http://eefic-v3-b:8888/sitev3-B3/tro...erDir/ASC.html

    But how can I add it just before the .html in the actual url from my link ?

    I've tried with insert tags {{env::path}}, {{env::request}} and {{env::referrer}} but I don't find the solution. Does it absolutely need some php ?
    Last edited by charled; 01/12/2017 at 16:39.

  9. #9
    User zonky's Avatar
    Join Date
    11-29-11.
    Location
    Berlin
    Posts
    160

    Default

    to use the PHP with "Frontend::addToUrl" is the best way in my mind - as alternative, you can try javascript...

    http://code.contaowiki.org/api/class.../addToUrl.html

  10. #10
    User
    Join Date
    04-01-10.
    Posts
    292

    Default

    Ok. I tried but I'm very bad at PHP. So, do not speak more about switch… Just what should be my php code(s) for I need two links :
    - one for orderBy/nom_expert/orderDir/ASC
    - and the other orderBy/zip_expert/orderDir/ASC
    (and I suppose orderDir/ASC is optional as it is the default behavior).

    -- I (we) clearly miss an option in BE (or a sort module) where we could choose many sorting as we can do for input screen. I could suggest it on github ?--

  11. #11
    User
    Join Date
    04-01-10.
    Posts
    292

    Default

    I answer to myself :
    PHP Code:
    <a href=" <?php echo $this->addToUrl('orderBy=nom_expert&orderDir=ASC'); ?>">ASC</a>
    For info : if I use
    PHP Code:
    <a href=" <?php echo $this->redirect($this->addToUrl('orderBy=nom_expert&orderDir=ASC')); ?>">ASC</a>
    as indicated in the doc, I got a loop.

  12. #12
    User zonky's Avatar
    Join Date
    11-29-11.
    Location
    Berlin
    Posts
    160

    Default

    Quote Originally Posted by charled View Post
    For info : if I use
    PHP Code:
    <a href=" <?php echo $this->redirect($this->addToUrl('orderBy=nom_expert&orderDir=ASC')); ?>">ASC</a>
    as indicated in the doc, I got a loop.
    correct - you use "$this->redirect" to redirect=>redirect=>redirect=>redirect=>redirect=> redirect=>redirect=>.................... redirect on this page is an example...

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •