CSU Library Website Customization

Documentation of CSU Primo and LibGuides customization

Provide a link to "Expand my results" when there are no results

Goal:

When No Records Found provide a customized suggestion and a link to automatically expand search result. 

Example we used to test:

  • Ageing, disability, and zombies, "The Happy Zombie Sunrise Home"
  • Learning XSLT: A Hands-On Introduction to XSLT and XPath

Click the "Try again including items available via interlibrary loan" link, the search will return with "Expand My Results" checked. 

 

Solution: 

We borrowed code from St. Olaf College:  https://github.com/SarahZum/primo-explore-custom-no-results

  • add prm-no-search-result > md-card { display:none; } to the custom1.css 
  • adding the following code to the custom.js file before the last })();
  • no space allowed between template:‘’
  • make sure change vid to your own vid. 
  • rezip the custom folder, upload, deploy.

// Enhance No Results tile
                app.controller('prmNoSearchResultAfterController', [function () {
                                var vm = this;
                                vm.getSearchTerm = getSearchTerm;
                                function getSearchTerm() {
                                               return vm.parentCtrl.term;
                               }
                }]);
 
                app.component('prmNoSearchResultAfter',{
                                bindings: {parentCtrl: '<'},
                                controller: 'prmNoSearchResultAfterController',
                                // Yongli's notes. No space nor new lines in side of template ''
                                template: '<md-card class="default-card zero-margin _md md-primoExplore-theme"><md-card-title><md-card-title-text><span translate="" class="md-headline ng-scope">No records found</span></md-card-title-text></md-card-title><md-card-content><p><span>There are no results matching your search:<blockquote><i>{{$ctrl.getSearchTerm()}}</i>.</blockquote><!-- Update to your domain and view code --><a href="https://colostate-primo.hosted.exlibrisgroup.com/primo-explore/search?query=any,contains,{{$ctrl.getSearchTerm()}}&tab=default_tab&search_scope=Everything&vid=01COLSU&offset=0&sortby=rank&pcAvailability=true"><b>Try again including items available via Interlibrary Loan?</b></a></span></p><p><span translate="" class="bold-text ng-scope">Suggestions:</span></p><ul><li translate="" class="ng-scope">Make sure that all words are spelled correctly.</li><li translate="" class="ng-scope">Try &quot;Almost Everything&quot; or another search scope.</li><li translate="" class="ng-scope">Try different search terms.</li><li translate="" class="ng-scope">Try more general search terms.</li><li translate="" class="ng-scope">Try fewer search terms.</li></ul><!-- Other helpful links --><p><b><a href="https://lib.colostate.edu/services/ask-us/">Ask us for Help Now</a></b></p><p><b><a href="https://lib2.colostate.edu/staff-directory/pub/?search=sub&subjectSearch=-1">Contact a Subject Librarian for Assistance</a></b></p></md-card-content></md-card>'
                });  
  

 

URL: https://libguides.colostate.edu/web_customization | Print Page