Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Store Search Bar (BS)


tgely

Recommended Posts

Hi all,

 

my Extended Search Bar pushed out for BS stores.

 

http://oscom.hu/images/store_search/store_search_bootstrap_oscommerce.png

 

Add-On : http://addons.oscommerce.com/info/9328

 

 

  • If products are found more than 5 result then advanced search link appears in dropdown as 6th line.
  • If product is not found then advanced search link is displaying in dropdown.
  • Exception: typed single "b" or "B" has no effect.
  • Store Search field working as an origin Search bar with typed enter/return or click on button.
  • Search in description configuration mode has effect only as origin Search method.
  • File content searches are only in "OR" conditions.
  • Categories and product results are working by "AND" conditions.
Edited by Gergely

:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Link to comment
Share on other sites

Hi @@KevinMelbourne,

sorry but new technologies not supported on old systems. You could do it with "less" scripts.

:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Link to comment
Share on other sites

Coming Next..


 

:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Link to comment
Share on other sites

Thank you for the great work on this contribution!

 

There is one area where I have an issue - people frequently search on  my store by model number as well as keyword. If they use model number then they get the "No Products Found! Try Here" message instead of the relevant product. If they hit return they get taken to the Advanced Search page or if they click the magnifying glass they go directly to the product which are both fine.

 

My fear is that when they see the "No Products Found" message they will abandon the store.

 

I managed to get it working just with model number by changing line 106 of content_searches.php to this:

   $like_statement .= " p.products_model LIKE '%" . tep_db_input($g) . "%' AND ";

… but I haven't been able to get the search incorporating results from model number as well as product name.

 

 

Greg

post-103371-0-52148600-1436154165_thumb.png

Link to comment
Share on other sites

Thank you for the great work on this contribution!

 

There is one area where I have an issue - people frequently search on  my store by model number as well as keyword. If they use model number then they get the "No Products Found! Try Here" message instead of the relevant product. If they hit return they get taken to the Advanced Search page or if they click the magnifying glass they go directly to the product which are both fine.

 

My fear is that when they see the "No Products Found" message they will abandon the store.

 

I managed to get it working just with model number by changing line 106 of content_searches.php to this:

   $like_statement .= " p.products_model LIKE '%" . tep_db_input($g) . "%' AND ";

… but I haven't been able to get the search incorporating results from model number as well as product name.

 

 

Greg

 

Thanks the report. I see the problem. "AND" statement caused this in the query string. I will fix it in the next release with separated "OR" between fields in query.

:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Link to comment
Share on other sites

Great Contrib, thanks.

 

I use an older Version of OSC BS

 

How can i get the Search bar in the "boxes_header" Group?

 

I Use the Group "header" only in index with the Page Carousel Banner Slider Module

Link to comment
Share on other sites

Great Contrib, thanks.

 

I use an older Version of OSC BS

 

How can i get the Search bar in the "boxes_header" Group?

 

I Use the Group "header" only in index with the Page Carousel Banner Slider Module

 

At this moment we are in the same version. :D  In next days I will do it for myself.

 

I try to figure out for ourselves..

 

Change:

    var $group = 'header';

To:

    var $group = 'boxes_header';

Change:

 

      include(DIR_WS_MODULES . 'content/' . $this->group . '/templates/store_search.php');
      $template = ob_get_clean();

      $oscTemplate->addContent($template, $this->group);

to:

      include(DIR_WS_MODULES . 'boxes/templates/store_search.php');
      $template = ob_get_clean();

      $oscTemplate->addBlock($template, $this->group);

Find ext/modules/.../store_searches.php

change:

  include(DIR_WS_LANGUAGES . $language . '/modules/content/header/cm_header_store_search.php');

to:

  include(DIR_WS_LANGUAGES . $language . '/modules/boxes/cm_header_store_search.php');

 

Upload structure is a little bit different

catalog/includes/boxes/templates/ (here should upload template file store_search.php)

catalog/includes/boxes/ (here we should upload cm_header_store_search.php)

 

catalog/includes/langauges/english/modules/boxes/ (here we should upload cm_header_store_search.php language file)

 

 

ext directories could be origin format because all links are absolutes.

 

I think it should be all, but I will test later. Post here if something is wrong.

Edited by Gergely
more edits need

:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Link to comment
Share on other sites

.... but i have see a little Bug with the german Umlaute äö

 

attachicon.gifumlaut1.JPG

 

Whwn i click "View more products on search page.."

 

there are no Products found

attachicon.gifumlaut2.JPG

and what happening when äö is in searchbar and click on magnifying glass?

:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Link to comment
Share on other sites

then it works...

Hotfix for non-english languages

 

change code in ext/modules/content/header/content_searches.php file

 

Find both of:

 

str_replace(' ', '+', $query)

replace width:

 

urlencode(str_replace(' ', '+', $query))
Edited by Gergely
bad fix code

:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Link to comment
Share on other sites

@@blavak

 

Hi Tomas,

You have a javascript error in index.php. In these cases typahead could be broken.

 

 

TypeError: $(...).swiperight is not a function

Fix you script error and it will be ok.

:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Link to comment
Share on other sites

  • 2 weeks later...

@@Gergely Hi Gergely,

 

Tnx for nice add-on!

 

I believe I have found the hotfix .... urlencode(str_replace(' ', '+', $query)) ....gives unexpected results for a query with multiple words. Hitting the link "View more products on search page.." will give in url :

 

    For Example        keywords=model%2Bproduct_name&search_in_description=1  ... Returns No Results

    In stead of           keywords=model+product_name&search_in_description=1  ... Will give expected results

 

Removing urlencode() again solves this problem and interestingly enough still works for specials characters like ä and ü.

 

Furthermore the html in function tep_navbar_store_search() is incorrect:

$search_link = '<div class="searchbox-margin">';
$search_link .= tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', $request_type, false), 'get', 'class="form-horizontal"');
$search_link .= ' <div class="input-group">' .
tep_draw_input_field('keywords', '', 'required placeholder="' . MODULE_CONTENT_HEADER_STORE_SEARCH_PLACEHOLDER . '" id="quick_search" data-provide="typeahead" autocomplete="off" style="margin-right:-2px;"', 'search') .
' <span class="input-group-btn"><button type="submit" class="btn ' . $btnclass .'" style="border-top-left-radius: 0px; border-bottom-left-radius: 0px;"><i class="glyphicon glyphicon-search"></i></button></span>';
if (tep_not_null($description) && ($description === true)) {
$search_link .= tep_draw_hidden_field('search_in_description', '1');
}
$search_link .= ' </div>' .
' </div>';

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

Should be :

$search_link = '<div class="searchbox-margin">';
$search_link .= tep_draw_form('quick_find', tep_href_link('advanced_search_result.php', '', $request_type, false), 'get', 'class="form-horizontal"');
$search_link .= ' <div class="input-group">' .
tep_draw_input_field('keywords', '', 'required placeholder="' . MODULE_CONTENT_HEADER_STORE_SEARCH_PLACEHOLDER . '" id="quick_search" data-provide="typeahead" autocomplete="off" style="margin-right:-2px;"', 'search') .
' <span class="input-group-btn"><button type="submit" class="btn ' . $btnclass .'" style="border-top-left-radius: 0px; border-bottom-left-radius: 0px;"><i class="glyphicon glyphicon-search"></i></button></span>';
if (tep_not_null($description) && ($description === true)) {
$search_link .= tep_draw_hidden_field('search_in_description', '1');
}
$search_link .= ' </div>';
$search_link .= tep_hide_session_id() . '</form>';
$search_link .= ' </div>';

Maybe you can confirm! Tnx!

Edited by azpro
Link to comment
Share on other sites

@@azpro

Thank Arjan your bug report! Nice catch!

urlencode syndrome depends on superglobals so I have to edit my advanced_search_result.php to fix this problem finaly. I hope this wont be a problem in v2.4..

 

    if (isset($HTTP_GET_VARS['keywords'])) {
      $keywords = tep_db_prepare_input(urldecode($HTTP_GET_VARS['keywords']));
    }

:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Link to comment
Share on other sites

:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Link to comment
Share on other sites

Any one else getting the following error in the error_log?

 

[25-Jul-2015 17:48:31 America/New_York] PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/directd8/public_html/ext/modules/content/header/store_search/content_searches.php:1) in /home/directd8/public_html/includes/functions/general.php on line 1279
[25-Jul-2015 17:48:31 America/New_York] PHP Warning:  session_start(): Cannot send session cache limiter - headers already sent (output started at /home/directd8/public_html/ext/modules/content/header/store_search/content_searches.php:1) in /home/directd8/public_html/includes/functions/sessions.php on line 97

Link to comment
Share on other sites

@@directdepot could you see the previous errors? Its looks like this was the outcome.

:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Link to comment
Share on other sites

  • 2 weeks later...

hello

 

like the contrib and i have already integrated in my shop

 

 

i am trying to port this addon to a contrib for edit order with bootstrap

 

in order to add products to the order i trying to add products via a modal popup

 

with this input :

<div class="form-group">
  <label for="search" class="col-xs-3">
      <b>- Of geef zoekopdracht in om matches te zien -</b>
   </label>
   <div class="col-xs-9">
         <input class="form-control" data-provide="typeahead" autocomplete="off" type="text" name="search" id="search" placeholder="" />
   </div>
</div>

 

the script for typeahead :

 

<script  type="text/javascript">
    $("#search").typeahead({
        source: function( query, process ) {
            $.ajax({
                url: '<?php echo DIR_FS_ADMIN ; ?>search.php',
                type: 'post',
                data: 'query='+ query,
                datatype: 'JSON',
                async: true,
                success: function(data) {
                       process(data) ;
                }       
            } )
        }
    });
</script>

 

the search.php :

 

<?php
  require('includes/application_top.php');
   $like_statement = $HTTP_POST_VARS[ "query" ] ;  // also tried $_POST and $_REQUEST

   $results= array() ;
 
     $autoComplete = tep_db_query("SELECT distinct(p.products_id), pd.products_name, p.products_price, p.products_tax_class_id
                                             FROM products_description pd, products p
                                                WHERE  pd.products_name like '%".$term ."%' AND pd.products_id = p.products_id
                                                   and pd.language_id = '" . (int)$languages_id . "' and p.products_status limit 6");   
   $list = tep_db_num_rows($autoComplete);
   if($list > 0) {
     while($value = tep_db_fetch_array($autoComplete)){
 
        $row_array['mmsi'] = $row['products_id'];
        $row_array['name'] = $row['products_name'];      

        array_push($results,$row_array);  
     }
  }

 echo json_encode($results, JSON_FORCE_OBJECT);  

?>

 

 

 

i have typeahead 0.11.1 js and css include in template_top.php

 

do you have a idea what is wrong ??

 

greet

eric

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...