Dirty Butter Posted April 29, 2015 Author Share Posted April 29, 2015 Well, I thought, since I was able to create a text link to the Advanced Search page, that I would be able to modify the icon on the simple search box, as you suggested. But everything I tried still sent me to the simple search results page, with of course NO items found.I need help with changing the search icon behavior. Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 29, 2015 Share Posted April 29, 2015 I'll look at the code.But basically, there will need to be an edit such that, as opposed to how it operates now with accepting zero search terms to query for, we need to test for zero search terms and redirect to the advanced search display.I did not mean to imply that just changing some placeholder wording was sufficient.There is a difference between a link and a form submission. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted April 29, 2015 Author Share Posted April 29, 2015 I did understand that just the placeholder wasn't enough. It's the test for zero search I couldn't figure out for myself. Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 29, 2015 Share Posted April 29, 2015 When I click the search icon with nothing in the search field, I get a red sub-banner that says to "Please enter a search keyword".Does yours? Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 29, 2015 Share Posted April 29, 2015 So, it seems there is some javascript validation. In /foundation/js/3.cubecart.validate.js, near lines 296-307, I will comment that range of statements.Then, the field itself has a 'required' attribute. So, comment that as well.Ok, so now I get the typical red "Warning" banner: "The following errors were detected: No matching products found. Please try again." And "Search Results -- No products found."Your store's behavior is way too different. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted April 29, 2015 Author Share Posted April 29, 2015 You helped me get my search so the search terms used show as "such and such found" or not found, so no, mine is not standard. Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 29, 2015 Share Posted April 29, 2015 Oh. Thanks for the reminder. Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 29, 2015 Share Posted April 29, 2015 (edited) In addition the commenting above, try in /classes/cubecart.class.php, in the private function _category() near line 680 in CC604, insert the new content:Find near lines 715-723: if (!empty($terms)) { foreach ($terms as $term) { if (($select = $GLOBALS['db']->select('CubeCart_search', array('id', 'hits'), array('searchstr' => strtoupper($term)))) !== false) { $GLOBALS['db']->update('CubeCart_search', array('hits' => $select[0]['hits'] + 1), array('id' => $select[0]['id']), false); } else { $GLOBALS['db']->insert('CubeCart_search', array('searchstr' => strtoupper($term))); } } } /* NEW -> */ else { httpredir('?_a=search'); } Â Edited April 29, 2015 by bsmither Syntax error. Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 29, 2015 Share Posted April 29, 2015 That just leaves changing the phrase (admin, Languages, your_language, Group:Search, Phrase:input_default) to something interesting. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted April 29, 2015 Author Share Posted April 29, 2015 (edited) I tried to carefully follow your directions, but it crashed. I NO SOONER POSTED THIS THAN I REALIZED MY MISTAKE - LEFT AN EXTRA BRACEbox.search.php           {* ORIGINAL <input name="search[keywords]" type="text" placeholder="{$LANG.search.input_default}" required> *} {* BSMITHER ADVANCED SEARCH CHANGE*} <input name="search[keywords]" type="text" placeholder="{$LANG.search.input_default}"> 3.cubecart.validate.js /* BSMITHER ADVANCED SEARCH REMOVE VALIDATE    $("#search_form, #small_search_form").validate({        rules: {            'search[keywords]': {                required: true            }        },        messages: {            'search[keywords]': {                required: $('#validate_search').text()            }        }    }); END BSMITHER ADVANCED SEARCH REMOVE VALIDATE */ cubecart.class.php             if (!empty($terms)) {                foreach ($terms as $term) {                   if (($select = $GLOBALS['db']->select('CubeCart_search', array('id', 'hits'), array('searchstr' => strtoupper($term)))) !== false) {                      $GLOBALS['db']->update('CubeCart_search', array('hits' => $select[0]['hits'] + 1), array('id' => $select[0]['id']), false);                   } else {                      $GLOBALS['db']->insert('CubeCart_search', array('searchstr' => strtoupper($term)));                   }                } } else { httpredir('?_a=search'); }             } OMIT THIS BRACE          }       }       if (!empty($query)) {   Edited April 29, 2015 by Dirty Butter Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 29, 2015 Share Posted April 29, 2015 Check this line:{* BSMITHER ADVANCED SEARCH CHANGE*}There must be white space between the actual comment and the brace-star / star-brace sequences. Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 29, 2015 Share Posted April 29, 2015 Oops! I made a correction to the edit in the class file above. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted April 30, 2015 Author Share Posted April 30, 2015 Thanks for the *} reminder. I'm bad about doing that. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted April 30, 2015 Author Share Posted April 30, 2015 "Oops! I made a correction to the edit in the class file above." Not sure I follow. Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 30, 2015 Share Posted April 30, 2015 I see you edited the copy you made of my original code. So, it should all be good. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted April 30, 2015 Author Share Posted April 30, 2015 I opened a GitHub request for this - https://github.com/cubecart/v6/issues/499(I looked back through the old open issues and did not see any reference to missing Advanced Search link.) Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted May 7, 2015 Author Share Posted May 7, 2015 I reported this and now there is a GitHub fix that puts the Advanced Search Link under the Search Box, just the way it looked in v5.https://github.com/cubecart/v6/commit/ca7ca2835fe9ed122eb9594da14842c23b5ef69c Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.