Jump to content

Foundation Advanced Search, plus an errant link issue


Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by bsmither
Syntax error.
Link to comment
Share on other sites

I tried to carefully follow your directions, but it crashed. I NO SOONER POSTED THIS THAN I REALIZED MY MISTAKE - LEFT AN EXTRA BRACE

box.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 by Dirty Butter
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...