Implemented
Fix Designs Search Feature - Exact Phrase and Case-Sensitive
This is less of a feature request and more an attempt for me to share code that I used to fix a problem.
The snippets below fixes the problem of searches needing to be exact phrase matches (inc. spaces) and case sensitive.
In the photos below the media library title for the clip-art is: baseball-bat
This means the following searches don't work: Baseball, Bat, Baseball Bat, baseball bat.
These snippets fixes it so that searches are not case-sensitive and search terms can be in any order:
Version: 3.3.3
assets/JS/FancyProductDesigner-all.js
Replace Line 6953-6959 with:
else { //hide all items $designsGrid.children('.fpd-item').css('display', 'none'); //only show by input value var searchq = this.value.toLowerCase().trim().split(" ");; $designsGrid.children('.fpd-item').filter(function(){ var fullsearchc = 0;var self = this; $.each( searchq, function( index, value ){fullsearchc += $(self).is("[data-title*='"+value+"']");}); if(fullsearchc==searchq.length){return 1;} }).css('display', 'block'); }
Replace Line 7076 with:
var $lastItem = $designsGrid.append('<div class="fpd-item '+lazyClass+'" data-source="'+design.source+'" data-title="'+design.title.toLowerCase()+'"><picture data-img="'+design.thumbnail+'"></picture></div>')
You'll need to use a minifying program on FancyProductDesigner-all.js to replace FancyProductDesigner-all-min.js with the updated changes.