WordPress.org

Forums

WebLibrarian
[resolved] Default listing orderby (5 posts)

  1. terjemar
    Member
    Posted 2 years ago #

    I read in the user manual that one can use:
    [weblib_searchform]
    [weblib_itemlist holdbutton=1 inlinemoreinfo=1]

    to list a search form and the items in the library. The items appear in the default sort order, which is by barcode. I would like to change the default sort order to author. I saw the weblib_orderby option, and I tried putting weblib_orderby=author in the weblib-searchform entry and in the weblib_itemlist entry, but it doesn't change anything. I still get my items in barcode order. Please help.

    http://conlang.org/resources/lcs-lending-library/

    Thank you,
    -S

    http://wordpress.org/plugins/weblibrarian/

  2. Robert Heller
    Member
    Plugin Author

    Posted 1 year ago #

    It is current not possible to change the default search order.

  3. terjemar
    Member
    Posted 1 year ago #

    OK. Thanks. I went looking and found the bit of code in short_codes.php that determines the default search order and changed it manually. I understand that the change will go away once I update the plugin. Hopefully you'll include a way to change the default search order in an upcoming release.

    Thank you.
    -S

  4. dryice
    Member
    Posted 1 year ago #

    terjemar,

    Lines 28 - 31?

    $searchby  = isset($_REQUEST['searchby'])  ? $_REQUEST['searchby']  : 'title';
        $searchbox = isset($_REQUEST['searchbox']) ? $_REQUEST['searchbox'] : '';
        $weblib_orderby = isset( $_REQUEST['weblib_orderby'] ) ? $_REQUEST['weblib_orderby'] : 'barcode';
        if ( empty( $weblib_orderby ) ) $weblib_orderby = 'barcode';
        $weblib_order = isset( $_REQUEST['weblib_order'] ) ? $_REQUEST['weblib_order'] : 'ASC';
        if ( empty( $weblib_order ) ) $weblib_order = 'ASC';

    to this?

    $searchby  = isset($_REQUEST['searchby'])  ? $_REQUEST['searchby']  : 'title';
        $searchbox = isset($_REQUEST['searchbox']) ? $_REQUEST['searchbox'] : '';
        $weblib_orderby = isset( $_REQUEST['weblib_orderby'] ) ? $_REQUEST['weblib_orderby'] : 'title';
        if ( empty( $weblib_orderby ) ) $weblib_orderby = 'title';
        $weblib_order = isset( $_REQUEST['weblib_order'] ) ? $_REQUEST['weblib_order'] : 'ASC';
        if ( empty( $weblib_order ) ) $weblib_order = 'ASC';
  5. terjemar
    Member
    Posted 1 year ago #

    Lines 102-107

    $searchby = isset($_REQUEST['searchby']) ? $_REQUEST['searchby'] : 'title';
    $searchbox = isset($_REQUEST['searchbox']) ? $_REQUEST['searchbox'] : '';
    $weblib_orderby = isset( $_REQUEST['weblib_orderby'] ) ? $_REQUEST['weblib_orderby'] : 'barcode';
    if ( empty( $weblib_orderby ) ) $weblib_orderby = 'barcode';
    $weblib_order = isset( $_REQUEST['weblib_order'] ) ? $_REQUEST['weblib_order'] : 'ASC';
    if ( empty( $weblib_order ) ) $weblib_order = 'ASC';

    Specifically, change lines 104 and 105 to:

    $weblib_orderby = isset( $_REQUEST['weblib_orderby'] ) ? $_REQUEST['weblib_orderby'] : 'author, title';
    if ( empty( $weblib_orderby ) ) $weblib_orderby = 'author, title';

    mysql allows for multiple fields when sorting, so whichever field or fields that you want to sort by need to be specified and delimited by commas.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WebLibrarian
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic