Jump to content
fur

SmartSuggest - Self-learning Ajax Search Suggestion

Recommended Posts

@@fur

 

Thank you. The contib works great 'out of the box' :)

 

Teeny, tiny, non-issue to most people, issue for me:

 

I have FWR Media's KissER Error Handling contrib installed on my test site. When I bring up the report, I have about 17 of these type of errors:

 

Error: Undefined index: count_by

File: stats_keywords_searched.php

Line: 17

 

I realize that these are not show stoppers, by any means however, if I could fix them (not suppress them) that would be awesome. I am not a coder, by any stretch of the imagination however, I did try and fix it. Failed miserably. I messed around with isset() with no success. Any chance you could point me in the right direction?

 

Thank you for this contrib and your time.

Share this post


Link to post
Share on other sites

hi all,

 

sorry for not showing up busy with my own project, will try fix anything in a week, stay tuned.


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.

Share this post


Link to post
Share on other sites

Hi,

i have installed the latest version on osc2.3.3 and all works fine...;only i have a problem with the suggested keywords characters

��ναικεία �άν�ια

Share this post


Link to post
Share on other sites

Everything works on my 2.2 shop. How hard would it be to add a small thumbnail image in the results drop down?

Share this post


Link to post
Share on other sites

Hi all,

 

Firstly thank you got the great addon. To those of you not getting the search box up I found out that the js file is not actually being called. So you need to add the following to your template file where your other js files are called.

<script src="ext/javascript/smartsuggest.js"></script> #change the path if you put it else where

 

Also if you have an modified template you may need to edit the css for the suggestion box.

Share this post


Link to post
Share on other sites

@@IWAS

in the file catalog/smartsuggest.php

 

I did the following:

Find the first two $suggest_query queries and add the following before pd.products_name as result

p.products_image as image,

 

then find

$display_name = htmlentities($suggest['result']);

add below

$display_image = htmlentities($suggest['image']);

 

and change

echo $display_name . "\n";

to

//echo $display_name . "\n";
echo "<img src=\"" . DIR_WS_IMAGES ."". $display_image ."\" height=\"64px\"  />  ".$display_name . "\n";

Share this post


Link to post
Share on other sites

thanks glycerine,

 

was quite busy recently so didnt manage to reply...

 

I may add this to a new version in couple days :D


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.

Share this post


Link to post
Share on other sites

Great work ! Is possibile to use this extension with search field in header ?


Baterije & Akumulatorji OsCommerce store

Share this post


Link to post
Share on other sites

I don't know if it's supposed to be or not, but when I try to search with multiple keywords ("search or look"), on advanced_search_result.php page it shows "or: yellow">product model" instead of just "product model" in Model column and "or: yellow">product name" instead of just "product name" in Product Name column. Is this how this add-on works or something is wrong?

 

Also, I have osc v2.3.3.4 and admin/stats_keywords_searched.php breaks my page layout. Did anybody change it to be compatible with v2.3.3.4?

Edited by Irin

Share this post


Link to post
Share on other sites

Excellent contribution ! Still having problem with my local characters (ŠŽČščž) .... Anyone foun a solution ? In remove htmlentities from smartsuggest.php $display_name = htmlentities($suggest ['result']); and now it show correct caracters in search result (if i search SZCszc) ..... Keep on good work :)


Baterije & Akumulatorji OsCommerce store

Share this post


Link to post
Share on other sites

The PHP htmlentities() function uses different encoding depending on the PHP version. Prior to 5.4 it returns values in ISO-8859-1, after it returns UTF-8. If you are running osC 2.3 or later you need UTF-8. If you are running on an older version of PHP, change the code you posted to:

 

$display_name = htmlentities( $suggest ['result'], [i]ENT_COMPAT, 'UTF-8' [/i]); 

 

Make this change anywhere that htmlentities() is used.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Great contribution! 

 

I have some problems like other users (SQL and no function on frontpage). I am using MTS (template manager), search field use his own code and of course the changes made in bm_search.php don't function, that is the reason of problems (is not a problem of contribution)

 

I managed to modify the MTS code and now SmartSuggest works like charm.

 

I am not an expert and maybe it is obvious for experienced user, but this can help other people.

Share this post


Link to post
Share on other sites

I have extra product fields in my database for a book site, such as ISBN, author name, etc. Would this be able to search these fields?

Unfortunately it won't. My company didn't use product attributes so I didn't add those in the search.

 

But I guess it can be easily implemented.


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.

Share this post


Link to post
Share on other sites

@@Irin

 

Also, I have osc v2.3.3.4 and admin/stats_keywords_searched.php breaks my page layout. Did anybody change it to be compatible with v2.3.3.4?

 

Try this ...

 

I have some areas commented out as I am still testing it. This *seems* to work :)

<?php
/*
  $Id: stats_keywords_searched.php,v 1.29 2013/10/04 22:50:52 fur Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/

  require('includes/application_top.php');
  require(DIR_WS_INCLUDES . 'template_top.php');
 
  $count_by = $_GET['count_by'] ? $_GET['count_by'] : 'newest';
  $date_from = $_GET['date_from'] ? $_GET['date_from'] : '';
  $date_to = $_GET['date_to'] ? $_GET['date_to'] : date('Y-m-d');

?>

<!--
<script type="text/javascript" src="includes/general.js"></script>
<script type="text/javascript" src="ext/jquery/jquery-1.8.0.min.js"></script>
-->

<link rel="stylesheet" type="text/css"  href="includes/javascript/spiffyCal/spiffyCal_v2_1.css">
<script type="text/javascript" src="includes/javascript/spiffyCal/spiffyCal_v2_1.js"></script>


<script  type="text/javascript"><!--
  var dateFrom = new ctlSpiffyCalendarBox("dateFrom", "filter", "date_from", "btnDate1", "<?php echo $date_from; ?>",

scBTNMODE_CUSTOMBLUE);
  var dateTo = new ctlSpiffyCalendarBox("dateTo", "filter", "date_to", "btnDate2", "<?php echo $date_to; ?>",

scBTNMODE_CUSTOMBLUE);
//--></script>

  <div id="spiffycalendar" class="text" style="z-index:100"></div>

  <table border="0" width="100%" cellspacing="0" cellpadding="0">
    <tr>
      <td>
        <table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
            <td class="pageHeading" align="center">

<?php
              echo tep_draw_form('filter', FILENAME_STATS_KEYWORDS_SEARCHED, '', 'get');
?>

              <table style="border: 1px dashed black;">
                <tr>
                  <td class="main">Count By:</td>
                  <td class="main" colspan="2">

<?php
                    echo '<label><input type="radio" name="count_by" value="newest" ' . ($count_by == 'newest' ? 'CHECKED ' :

'') . 'onchange="this.form.submit();"/> Newest</label>';
                    echo '<label><input type="radio" name="count_by" value="keywords" ' . ($count_by == 'keywords' ? 'CHECKED

' : '') . 'onchange="this.form.submit();"/> Keywords</label>';
                    echo '<label><input type="radio" name="count_by" value="customers_id" ' . ($count_by == 'customers_id' ?

'CHECKED ' : '') . 'onchange="this.form.submit();"/> Customer</label>';
                    echo '<label><input type="radio" name="count_by" value="ip" ' . ($count_by == 'newest' ? 'ip ' : '') .

'onchange="this.form.submit();"/> IP</label>';

?>
                  </td>
                </tr>

                <tr>
                  <td class="main">Date:</td>
                  <td class="main" colspan="2">
                    <script language="javascript">dateFrom.writeControl(); dateFrom.dateFormat="yyyy-MM-dd";</script>
                    to
                    <script language="javascript">dateTo.writeControl(); dateTo.dateFormat="yyyy-MM-dd";</script>
                  </td>
                </tr>

                <tr>
                  <td class="main">Pages:</td>
                  <td>
<?php
                    foreach(range(1,30) as $i)
                      $pages_options[] = array('id' => $i, 'text' => '>=' . $i);
                      echo tep_draw_pull_down_menu('pages', $pages_options, $_GET['pages'],

'onchange="this.form.submit();"');
?>

                  </td>
                  <td align="right">
                    <?php echo tep_image_submit('button_search.gif', 'Search'); ?>
                  </td>
                </tr>
              </table>
<?php
              echo '</form>';
?>
            </td>
          </tr>
        </table>

      </td>
    </tr>
  </table>

<!--
      </td>
    </tr>
    <tr>
      <td>
-->

  <table border="0" width="100%" cellspacing="0" cellpadding="0">
    <tr>
      <td valign="top">
        <table border="0" width="100%" cellspacing="0" cellpadding="2">
          <tr class="dataTableHeadingRow">
            <td class="dataTableHeadingContent">No.</td>

<?php

            if ($_GET['keywords'] || $_GET['customers_id'] || $_GET['ip'])
              $count_by = 'newest';
                
              switch($count_by){

                case 'keywords':
                  $headings = array(TABLE_HEADING_KEYWORDS, TABLE_HEADING_NUM_RESULTS, TABLE_HEADING_LAST_SEARCHED_DATE,

TABLE_HEADING_NUM_SEARCHED);
                  break;

                case 'customers_id':
                  $headings = array(TABLE_HEADING_CUSTOMERS, TABLE_HEADING_LAST_SEARCHED_DATE,

TABLE_HEADING_LAST_SEARCHED_DATE, TABLE_HEADING_NUM_SEARCHED);
                  break;

                case 'ip':
                  $headings = array(TABLE_HEADING_IP, TABLE_HEADING_LAST_SEARCHED_DATE, TABLE_HEADING_LAST_SEARCHED_DATE,

TABLE_HEADING_NUM_SEARCHED);
                  break;

                case 'newest';
                  $headings = array(TABLE_HEADING_KEYWORDS, TABLE_HEADING_NUM_RESULTS, TABLE_HEADING_CUSTOMERS,

TABLE_HEADING_IP, TABLE_HEADING_PAGES, TABLE_HEADING_PRODUCT_IDS, TABLE_HEADING_ORDER_ID, TABLE_HEADING_DATE_SEARCHED);
                  break;

              }

              foreach($headings as $heading) {

?>
                <td class="dataTableHeadingContent">
                  <?php echo $heading; ?>
                </td>

<?php
              }
?>

          </tr>

<?php

          if (isset($_GET['page']) && ($_GET['page'] > 1))
            $rows = $_GET['page'] * MAX_DISPLAY_SEARCH_RESULTS - MAX_DISPLAY_SEARCH_RESULTS;
                              
          if ($_GET['keywords']) {
            $where_str = "where keywords = '" . tep_db_input($_GET['keywords']) . "' ";
          } elseif ($_GET['customers_id']) {
            $where_str = "where customers_id = '" . tep_db_input($_GET['customers_id']) . "' ";
          } elseif ($_GET['ip']) {
            $where_str = "where ip = '" . tep_db_input($_GET['ip']) . "' ";
          } else {
            $where_str = "where 1 ";
          }
                
          switch($count_by){
            case 'newest':
              $select_str = "select * ";
              $from_str = "from " . TABLE_SEARCHED_KEYWORDS . " ";
              $order_by_str = "order by date_added desc ";
              $columns = array('keywords', 'number_of_results', 'customers_id', 'ip', 'pages', 'products_ids', 'orders_id',

'date_added');
              break;


            default:
              if($count_by == 'keywords'){
                $select_str = "select keywords, number_of_results, date_added, count ";
                $columns = array('keywords', 'number_of_results', 'date_added', 'count');
              }else{
                $select_str = "select $count_by, keywords, date_added, count ";
                $columns = array($count_by, 'keywords', 'date_added', 'count');
              }

              $from_str = "from " . TABLE_SEARCHED_KEYWORDS . " sk right join (select $count_by as group_$count_by, count(*)

as count, max(date_added) as last_date from " . TABLE_SEARCHED_KEYWORDS . " GROUP BY $count_by) skg on sk.$count_by =

skg.group_$count_by and sk.date_added = skg.last_date ";
              $where_str .= "and $count_by is not null ";
              $order_by_str = "order by count desc ";
              break;

          }
                
          if ($_GET['date_from'])
            $where_str .= "and date_added >= '" . tep_db_input($_GET['date_from']) . "' ";

          if ($_GET['date_to'])
            $where_str .= "and date_added <= '" . tep_db_input($_GET['date_to']) . " 23:59:59' ";
                
          if ($_GET['pages'] > 1)
            $where_str .= "and (length(pages) - length(replace(pages, ',', '')) >= " . ((int)$_GET['pages'] - 1) . ") ";
               
          $searched_keywords_query_raw = $select_str . $from_str . $where_str . $order_by_str;

          $searched_keywords_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS,

$searched_keywords_query_raw, $searched_keywords_query_numrows);
          $searched_keywords_query = tep_db_query($searched_keywords_query_raw);
          while ($searched_keywords = tep_db_fetch_array($searched_keywords_query)) {
            $rows++;

?>

          <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" <?php if($count_by !=

'newest'){ ?>onclick="document.location.href='<?php echo tep_href_link(FILENAME_STATS_KEYWORDS_SEARCHED,

tep_get_all_get_params() . $count_by . '=' . $searched_keywords[$count_by], 'NONSSL'); ?>'"<?php }?>>

            <td class="dataTableContent"><?php echo str_pad($rows, 3, '0', STR_PAD_LEFT); ?></td>

<?php

              foreach($columns as $column) {
                $column_text = $searched_keywords[$column];
                  if($column == 'keywords') {
                    $column_text = '<a href="' . tep_href_link('../advanced_search_result.php', 'keywords=' . $column_text,

'NONSSL') . '" target="_blank">' . $column_text . '</a>';
                  } elseif($column == 'customers_id') {
                    $customer_query = tep_db_query("select customers_id, customers_firstname, customers_lastname from " .

TABLE_CUSTOMERS . " where customers_id = '" . (int)$column_text . "'");
                    $customer = tep_db_fetch_array($customer_query);
                    $column_text = '<a href="' . tep_href_link(FILENAME_CUSTOMERS, 'action=edit&cID=' .

$customer['customers_id']) . '" target="_blank">' . $customer['customers_firstname'] . ' ' . $customer['customers_lastname']

. '</a>';
                  } elseif($column == 'ip') {
                    $column_text = '<a href="http://ipshark.net/?domain=' . $column_text . '" target="_blank">' .

$column_text . '</a>
                                    <a href="http://www.infosniper.net/index.php?ip_address=' . $column_text . '"

target="_blank">' . tep_image(DIR_WS_ICONS . 'preview.gif', 'Location Map of IP') . '</a>';
                  }

?>

            <td class="dataTableContent"><?php echo $column_text; ?></td>

<?php
              }
?>

          </tr>

<?php
          }
?>

        </table>
      </td>
    </tr>

    <tr>
      <td colspan="3">
        <table border="0" width="100%" cellspacing="0" cellpadding="2">
          <tr>
            <td class="smallText" valign="top">

<?php
              echo $searched_keywords_split->display_count($searched_keywords_query_numrows, MAX_DISPLAY_SEARCH_RESULTS,

$_GET['page'], TEXT_DISPLAY_NUMBER_OF_KEYWORDS);

?>

            </td>
            <td class="smallText" align="right">

<?php
              echo $searched_keywords_split->display_links($searched_keywords_query_numrows, MAX_DISPLAY_SEARCH_RESULTS,

MAX_DISPLAY_PAGE_LINKS, $_GET['page'], tep_get_all_get_params(array('pages')));
?>

            </td>
          </tr>
        </table>
      </td>
    </tr>

<?php
    if ($_GET['keywords'] || $_GET['customers_id'] || $_GET['ip']) {
?>

    <tr>
      <td>
        <a href="<?php echo tep_href_link(FILENAME_STATS_KEYWORDS_SEARCHED, tep_get_all_get_params(array('keywords',

'customers_id', 'ip'))); ?>">
          <?php echo tep_image_button('button_back.gif', 'Back'); ?>
        </a>
      </td>
    </tr>

<?php
    }
?>

  </table>



<!--
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
-->


<script type="text/javascript">
$(document).ready(function(){
  $('td.dataTableContent a').click(stopPropagation);
});
function stopPropagation(e){
  e.stopPropagation();
}
</script>


<?php
  require(DIR_WS_INCLUDES . 'template_bottom.php');
  require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

Malcolm


Get the latest Responsive osCommerce CE (community edition) here .

Share this post


Link to post
Share on other sites

@@fur

 

I'm working on osC 234bs. There is no catalog/ext/javascript directory in which to put the smartsuggest.js file. Instead, the directory is catalog/ext/js/  I put the smartsuggest.js file in there.

 

In catalog/includes/classes/smartsuggest.php, there's two calls for smartsuggest.js in the javascript directory. I have *not* modified the calls in catalog/includes/classes/smartsuggest.php. Clearly, this means that the smartsuggest.js file is not being loaded.

 

*BUT*

 

Before I installed this, if I searched for anything other than the exact part number, the search result came up empty. Now, when I do a 'regular' search on terms that are in the part description, I *AM* getting the search results I want! I am also seeing the searched terms in the Keywords Searched report (after making the changes that I listed in my prior post).

 

So, in other words, I'm not using smartsuggest.js, but I am getting the results I want. Can you explain this?

 

Thanks!

 

Malcolm


Get the latest Responsive osCommerce CE (community edition) here .

Share this post


Link to post
Share on other sites

@@fur

 

During a recent conversation in chat, we were discussing how to improve the search function. I tested this add-on to see if it recorded search terms that were not found in either the title or description. I'm pleased that these terms are recorded. So, if I see that customers are often searching for a term that I currently do not have in the title or description, I can add that term to one of them.

 

In addition, I am using Burt's SEO Header Tags - Reloaded add-on ...

 

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

 

This add-on adds additional SEO tables and fields to the database. One such new field for a product is 'Meta Keywords'. This is another place that we can add keywords. So, my question is ..  Can your search be modified to include this field in it's search?

 

Malcolm


Get the latest Responsive osCommerce CE (community edition) here .

Share this post


Link to post
Share on other sites

Compared to catalog/advanced_search_result.php, there are missing brackets in catalog/smartsuggest.php.

When one types in more than one keyword, actually the searchquery will not separate them and results are screwed:

WHERE p.products_status = '1' and pd.language_id = '2' and (pd.products_name like '%needle1%' or p.products_model like '%needle1%' and pd.products_name like '%needle2%' or p.products_model like '%needle2%')

adding brackets in the catalog/smartsuggest.php:

  if (isset($search_keywords) && (sizeof($search_keywords) > 0)) {
    $where_str .= " and (";
    for ($i=0, $n=sizeof($search_keywords); $i<$n; $i++ ) {
      switch ($search_keywords[$i]) {
        case '(':
        case ')':
        case 'and':
        case 'or':
          $where_str .= " " . $search_keywords[$i] . " ";
          break;
        default:
          $where_str .= "(";
          if (SMARTSUGGEST_RESULT == 'Product Names') {
            $where_str .= "pd.products_name like '%" . tep_db_input($search_keywords[$i]) . "%' or p.products_model like '%" . tep_db_input($search_keywords[$i]) . "%'";
          } else {
            $where_str .= "keywords LIKE '%". tep_db_input($search_keywords[$i]) . "%'";
          }
          $where_str .= ")";
          break;
      }
    }
    $where_str .= ")";
  }

will break down the result to items matching both keywords and the query is ok:

WHERE p.products_status = '1' and pd.language_id = '2' and ((pd.products_name like '%needle1%' or p.products_model like '%needle1%') and (pd.products_name like '%needle2%' or p.products_model like '%needle2%'))

Share this post


Link to post
Share on other sites

HI 

 

This seems to be a great addon but need some help.

My site's search box is at header and even if i tryed i did not manage to install it corectly so the suggest did not show up.

my header whith show the search box is:

 

          <div  class="fl_right"> <div class="cl_both ofh">
                    <div class="sub fl_right">
                    <ul class="navigation cl_both">
                        <li class="navigation_item un <?php if ($tab_sel == tep_href_link(FILENAME_ADVANCED_SEARCH)) echo "selected"?>"><a onClick="document.location='<?php echo tep_href_link(FILENAME_ADVANCED_SEARCH);?>'"><?php echo ITEM_ADVANCED_SEARCH;?></a></li>
    <?php if (tep_session_is_registered('customer_id')) { 
    
     $login_link = tep_href_link('logoff.php');
     $login_title= HEADER_TITLE_LOGOFF;
    } else{ 
     $login_link = tep_href_link('login.php');
     $login_title= HEADER_TITLE_LOGIN;
    } 
    ?>                                                                                             
                         <li class="navigation_item <?php if (($tab_sel == tep_href_link(FILENAME_LOGIN)) || ($tab_sel == tep_href_link(FILENAME_LOGOFF))) echo "selected"?>"><a onClick="document.location='<?php echo $login_link;?>'"><?php echo $login_title;?></a></li>                                                                                             
    <?php if (tep_session_is_registered('customer_id')) { 
    
     $acc_link = tep_href_link('account.php');
     $acc_title= HEADER_TITLE_MY_ACCOUNT;
    } else{ 
     $acc_link = tep_href_link('create_account.php');
     $acc_title= HEADER_TITLE_CREATE_ACCOUNT;
    } 
    ?>                                              
                        <li class="navigation_item <?php if (($tab_sel == tep_href_link(FILENAME_CREATE_ACCOUNT)) || ($tab_sel == tep_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS)) || ($tab_sel == tep_href_link(FILENAME_ACCOUNT))) echo "selected"?>"><a onClick="document.location='<?php echo $acc_link;?>'"><?php echo $acc_title;?></a></li>
                        <li class="navigation_item <?php if ($tab_sel == tep_href_link(FILENAME_SHIPPING)) echo "selected"?>"><a onClick="document.location='<?php echo tep_href_link(FILENAME_SHIPPING);?>'"><?php echo ITEM_INFORMATION_SHIPPING?></a></li>  
                    </ul>
                </div>
                                </div>
                    <div class="bg_search fl_right ofh"><div class="search ">
   
    <?php echo tep_draw_form('search',tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false),'get','id="frmSearch"') ?>
    <label class="fl_left"><?php echo MODULE_BOXES_SEARCH_TITLE?> </label>
<div class="input-width fl_left">
<div class="width-setter">        
        <input type=text name="keywords" class="go"  value="<?php echo TEXT_INPUT_SEARCH?>" onblur="if(this.value=='') this.value='<?php echo TEXT_INPUT_SEARCH?>'" onfocus="if(this.value =='<?php echo TEXT_INPUT_SEARCH?>' ) this.value=''">
</div>
        </div>
 
<?php echo tep_image_submit('button_search_prod.gif', '', ' class="button_search_prod fl_left"')?></form>                                        
    </div></div>
                
</div>
 
 
can anyone explain what changes should i do?
 
Also i have a problem with greek characters its not recognize them at all

regards

Lazaros

Share this post


Link to post
Share on other sites

Hi, I have a strange problem with smartsuggest. Everything is working fine, except the smartsuggest doesn't work on product_info.php file.

 

does any one know why?

Share this post


Link to post
Share on other sites

Hi, Thanks for this great contribution- I am using Smart Suggest it seems to work perfectly;

Just one small issue -
That if someone searches for example 'dresses' and i have products listed by name of 'dress' the results appear as 0;

Similarly like 'crown' results in 10 products but 'crowns' results in 0

Could you please help me sort it that even if a partial part of the word that is 'dress' from 'dresses' is included in product name then the search results are displayed for the customers.

Awaiting your earliest help and response....

Share this post


Link to post
Share on other sites

Hi there

 

Have installed this on 2.3.4BS

 

I have the search terms being stored in the data base as it should

 

The problem I am having is trying to work out how to search , which is in the header , to accept the code its coming back with a Parse error, unexpected T-String on line 44

 

here is the code so far, I think I am close but no coconut yet

    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', 'id="frmSearch"', 'class="form-horizontal"');
      $search_box .= '  <div class="input-group">' .
 //                         tep_draw_input_field('keywords', '', 'required placeholder="' . TEXT_SEARCH_PLACEHOLDER . '"') . '<span class="input-group-btn"><button type="submit" class="btn btn-info"><i class="glyphicon glyphicon-search"></i></button></span>' .
                            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>' .

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

If I remove

. 'id="txtSearch" onkeyup="searchSuggest(event);" autocomplete="off" .

It completes the search and stores the keyword, but the main point of the install is so it search's for the keyword on key down in the search box

 

Any help would be gratefully received

 

Thank you

 

David


David

Share this post


Link to post
Share on other sites

On the line in the middle

 

te="off" . 're

 

should be

te="off" re

 

for it to parse correctly,

 

but it might not do what you need,

 

if you look for the comma's separating the parameters, put each parameter on a separate line, it should become clear where you went wrong

Edited by bruyndoncx

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Share this post


Link to post
Share on other sites

@@DAVID3733

 

Looks like you might be missing a closing quote in that line...ie. required placeholder=".

 

I couldn't see a closing quote for that placeholder.

 

Dan

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×