Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

SmartSuggest - Self-learning Ajax Search Suggestion


fur

Recommended Posts

Thank you bruyndoncx and Dan Cole

 

I got it working, just in-case anyone else has the same issue here is the line below

                            tep_draw_input_field('keywords', '', 'id="txtSearch" onkeyup="searchSuggest(event);" autocomplete="off" required placeholder="' . TEXT_SEARCH_PLACEHOLDER . '"' ) . '<div id="smartsuggest" ></div>' .  '<span class="input-group-btn"><button type="submit" class="btn btn-info"><i class="glyphicon glyphicon-search"></i></button></span>' .

The problem I have now is the display of the searched phrases, there is no mouse over although if you click it it changes the search query to that, so all is working

 

I assume its because I am using 2.3.4BS, I have added the CCS styles to the main CSS file as well as creating a new catalog/stylesheet.css, I assume the Javescript is working else it would not function

 

Forgot to add I am using the search in the header so perhaps that is the issue, any pointers would be appreciated

 

David

David

Link to comment
Share on other sites

  • 2 months later...

Great add on! But how to make the drop down list go away if I don´t want to seach for a produtc any more?

 

The list with the suggestions doesn´t go away when mouse leave.

 

Could someone put a "onmouseleave" function and show how to do it?

 

Thanks very much

Link to comment
Share on other sites

  • 3 months later...
  • 8 months later...

@@mperbeils

Great add on! But how to make the drop down list go away if I don´t want to seach for a produtc any more?

 

The list with the suggestions doesn´t go away when mouse leave.

 

Could someone put a "onmouseleave" function and show how to do it?

 

Thanks very much

 

Press the <Esc> key. Perhaps not intuitive, and obviously won't work on a touch-screen device.

 

Malcolm

Link to comment
Share on other sites

@@DAVID3733

 

If you're still working on this, here's what I came up with ...

    function execute() {
      global $oscTemplate, $request_type;
      
      $content_width = MODULE_CONTENT_HEADER_SEARCH_CONTENT_WIDTH;

      $search_box  = '<div class="searchbox-margin">';
      $search_box .= tep_draw_form('quick_find', tep_href_link('advanced_search_result.php', '', $request_type, false), 'get', 'class="form-horizontal" id="frmSearch"');

      $search_box .= '  <div class="input-group">';

      $search_box .=      tep_draw_input_field('keywords', '', 'id="txtSearch" onkeyup="searchSuggest(event);" autocomplete="off" required placeholder=" ' . TEXT_SEARCH_PLACEHOLDER . ' " ' , 'search');

      $search_box .= '    <div id="smartsuggest" ></div>';
      $search_box .=      tep_draw_hidden_field('search_in_description', '1');
      $search_box .= '    <a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH) . '"></a>' ;

      $search_box .= '    <span class="input-group-btn">' ;
      $search_box .= '      <button type="submit" class="btn btn-info">' ;
      $search_box .= '        <i class="fa fa-search"></i>' ;
      $search_box .= '      </button>' ;
      $search_box .= '    </span>' ;

      $search_box .= '  </div>';
      $search_box .=    tep_hide_session_id() . '</form>';
      $search_box .= '</div>';

      // MOD: BOF - SmartSuggest
      if (SMARTSUGGEST_ENABLED != 'false') {
        require(DIR_WS_CLASSES . 'smartsuggest.php');
        $smartsuggest = new smartsuggest();
        $smartsuggest->output($data);
      }
      // MOD: EOF - SmartSuggest

Now, a question for everyone else ...

 

In the above, after the user enters a search word, and the function returns the list of results, when the user clicks on one of the results, they are taken to the Advanced Search screen, with all of the same found results. Is it possible to change this so that they are taken directly to the selected product?

 

Thanks

 

Malcolm

Link to comment
Share on other sites

@@ArtcoInc

 

Hi Malcolm

 

I am absolutely not familiar with this SmartSuggest thing but isn't it similar to this addon by auzStar?

 

http://addons.oscommerce.com/info/9351

 

From the addon description

 

 

Clicking on or hitting enter on an item in the list will re-direct you to that product's info page.

Link to comment
Share on other sites

@@Tsimi

 

Thank you! I am exploring several different Search add-ons to see which one I like best. I'll add that one to my list.

 

One feature about -this- Search add-on is that it builds a new table of 'searched for words'. This allows me to see what people are searching for. I can then use this information to perhaps improve the wording in my product descriptions, etc.

 

Like many things in life, I'd love to be able to take one feature from one add-on, and another feature from a different one, and ... Alas, I'm not that good of a programmer.

 

Malcolm

Link to comment
Share on other sites

  • 1 month later...

Sorry for being absent and didn't solve the problem as mentioned above.

 

Unfortunately I have left my previous position as osCommerce web developer and I afraid this plugin may not be able be maintained in future...

AdWords Dynamic Remarketing Tag - Tell Google What to Advertise [2.2.x] [2.3.x]

AjaxCheckoutAddress - Change Address and Checkout in Once [2.2.x]

SmartSuggest - Self-learning Ajax Search Suggestion [2.2.x] [2.3.x]

 

More about me.

Link to comment
Share on other sites

  • 1 year later...
On 29/08/2016 at 10:22 PM, ArtcoInc said:

@@mperbeils

Press the <Esc> key. Perhaps not intuitive, and obviously won't work on a touch-screen device.

Malcolm

After 3 years I got the solution lol

/ext/javascript/smartsuggest.js

//funcao para esconder div
function esconder(div_value) {
    var esc = document.getElementById('smartsuggest');
    esc.innerHTML = '';
}

includes/boxes/search.php

add onblur="javascript:esconder(this);" into the input field (call the function when the user clicks outsite the smartsuggest/seach box)

$info_box_contents[] = array('form' => tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get', 'id="frmSearch"'),
                               'align' => 'center',
                               'text' => tep_draw_input_field('keywords', '', 'id="txtSearch" class="formbusca" onkeyup="searchSuggest(event);" onblur="javascript:esconder(this);" autocomplete="off" size="16" maxlength="30" style="width: ' . '190' . 'px"') . ' <div id="smartsuggest" ></div>  ' . tep_hide_session_id() . tep_image_submit('button_quick_find.gif', BOX_HEADING_SEARCH) . '<br><div id="search-text">Use palavras-chave ou os 5 primeiros digitos do c&oacute;digo da pe&ccedil;a</div><br>');

 

Link to comment
Share on other sites

  • 1 year later...

A recent attack on one of my shops revealed that hackers will use the search function to try and gain access to the shop and/or database. Since SmartSuggest records search inquires to a database table, there is a possibility that this could be used in an attack

Malcolm

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...