[Koha-bugs] [Bug 7520] json script to return advanced search types

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Jun 9 05:41:05 CEST 2016


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7520

Liz Rea <liz at catalyst.net.nz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |liz at catalyst.net.nz

--- Comment #14 from Liz Rea <liz at catalyst.net.nz> ---
An example of how one could use this, is as follows - example is of a drop down
that shows recent acquisitions by item type:

In your OpacMainUserBlock:

Something like

<div id="new_orders">
        <form name="searchform" method="get"
action="/cgi-bin/koha/opac-search.pl">
            <input type="hidden" name="sort_by" value="acqdate_dsc">

            <input type="hidden" name="do" value="OK">
            <input type="hidden" name="idx" value="location">
            <input type="hidden" name="q" value="ORD">
            <select name="limit" id="new_orders_limit"
onChange="this.form.submit()">
                <option>-- Please choose --</option>
            </select>
        </form>
</div>



In your OpacUserJS, to fetch the list:

$(document).ready(function() {
    $.getJSON("/cgi-bin/koha/advanced_search_types.json", function(data){
        $.each(data.types, function (index, value) {
            var opt = $('<option value="mc-ccode:' + value.code +
'">').text(value.description).appendTo("#new_orders_limit");
        }); 
    });

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list