Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Store Search Bar (BS)


tgely

Recommended Posts

@@milerwan

 

1) THANK YOU for all of your assistance and guidance! :thumbsup:

 

2) Once you pointed out that there was a 'known issue' with testing this on localhost, I pushed a test copy up to my host, and was able to get v1.4 to work in the header :)

 

3) I then spent some more time testing, debugging, and generally messing around with the code, and I think I've finally got it working as a box module (w00t)  I can supply the code if anyone else wants.

 

pm me, and I'll send you a link to the test site.

 

Once again, THANK YOU !

 

Malcolm

Link to comment
Share on other sites

Thanks Guys

 

Looks very nice :)

 

Is there a trick to seeing images in the dropdown? I am unable to see images??

Hi,

You have to go in the admin, modules->content->Store Search Bar, and check infobox for Image display :

 

Display Image or Icon for Product Search Result

Do you want to display product image or cart icon for product result?

 

 x Image

 o Icon

 

But this option is enable by default so if you haven't picture for products from dropdown maybe you haven't installed the right version :

Store Search with Image (BS)http://addons.oscommerce.com/info/9504

Edited by milerwan

Osc v2.3.4 BS "custom"
PHP 7.3 compatible (710 modified files => o_O')

Link to comment
Share on other sites

Hi,

You have to go in the admin, modules->content->Store Search Bar, and check infobox for Image display :

 

Display Image or Icon for Product Search Result

Do you want to display product image or cart icon for product result?

 

 x Image

 o Icon

 

But this option is enable by default so if you haven't picture for products from dropdown maybe you haven't installed the right version :

Store Search with Image (BS)http://addons.oscommerce.com/info/9504

 

I re-installed and I can see images for the products but not the categories - is that the normal behaviour?

Link to comment
Share on other sites

I've installed the latest version of the Add-On but can't seem to figure out how the change the names of the pages like shipping and condition. It takes the name of the file without the .php at the end, resulting in English names for a Dutch webshop.

 

It's this piece of code:

'title' => sprintf( MODULE_CONTENT_HEADER_STORE_SEARCH_PAGE, substr(basename($file), 0, -4)),

Tried to use a str_replace, but could't do it without breaking the whole code..

 

Someone who knows how to do this?

Link to comment
Share on other sites

I've installed the latest version of the Add-On but can't seem to figure out how the change the names of the pages like shipping and condition. It takes the name of the file without the .php at the end, resulting in English names for a Dutch webshop.

 

It's this piece of code:

'title' => sprintf( MODULE_CONTENT_HEADER_STORE_SEARCH_PAGE, substr(basename($file), 0, -4)),

Tried to use a str_replace, but could't do it without breaking the whole code..

 

Someone who knows how to do this?

 

Hi,

 

this should be selected on admin side module configuration page. Do you have Dutch filenames and different english names?

: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,

 

this should be selected on admin side module configuration page. Do you have Dutch filenames and different english names?

 

In the admin -> modules -> content there is no option to rename the pages, only to select which pages to take in the search.

 

The site is fully Dutch and the English language is deleted via the Admin as well as the language maps via FTP. The filenames are the standard ones, which are renamed in the URL with the SEO Friendly Urls PRO Edition to dutch names. These Dutch names should also be shown when searching for these pages like shipping -> verzending.

 

Thanks

Link to comment
Share on other sites

after this line:

      $file = DIR_WS_LANGUAGES . $language . '/' . $file_name;

add this:

      $newfile = 'whatever you want...';



change:

'title' => sprintf( MODULE_CONTENT_HEADER_STORE_SEARCH_PAGE, substr(basename($file), 0, -4)),

to:
 

'title' => sprintf( MODULE_CONTENT_HEADER_STORE_SEARCH_PAGE, $newfile),

: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

@@milerwan

 

In this addon, product keyword field is named "products_seo_keywords" in database structure.

So, in "content_search.php" file (ext/modules/content/header/content_search.php), you have to just replace this sentence (in line 108) :

      $like_statement_product .= " (pd.products_name LIKE '%" . tep_db_input($product) . "%' OR pd.products_head_keywords_tag LIKE '%" . tep_db_input($product) . "%') AND ";

by this one :

      $like_statement_product .= " (pd.products_name LIKE '%" . tep_db_input($product) . "%' OR pd.products_seo_keywords LIKE '%" . tep_db_input($product) . "%') AND ";

Then, in admin, go to "Store Search Bar" module and choose "Keywords" option instead of "Model" option :

Additional Search Field (Keywords needs Header Tags SEO addon)
Do you want additional product search by Model or Keywords?

o Model
x Keywords


I think you will love it. ;)

 

I changed to code to this:

 

    //Add products_head_keywords_tag search option
//    if (MODULE_CONTENT_HEADER_STORE_SEARCH_MODEL_OR_KEYWORDS == 'Model') {
//      $like_statement_product .= " (pd.products_name LIKE '%" . tep_db_input($product) . "%' OR p.products_model LIKE '%" . tep_db_input($product) . "%') AND ";
//    } else {
//      $like_statement_product .= " (pd.products_name LIKE '%" . tep_db_input($product) . "%' OR pd.products_head_keywords_tag LIKE '%" . tep_db_input($product) . "%') AND ";
//      }
// changed above if else, so always search for products_name, products_seo_keywords, model
      $like_statement_product .= " (pd.products_name LIKE '%" . tep_db_input($product) . "%' OR p.products_model LIKE '%" . tep_db_input($product) . "%' OR pd.products_seo_keywords LIKE '%" . tep_db_input($product) . "%') AND ";
      }

 

 

seems to work ok for me, and this makes difference if 'model' or 'keyword' is selected in admin.

do you agree or do you suggest something different?

 

Regards

Mike

osC CE live - developing osC Phoenix adding modules with no core changes(awesome and easy!)

Link to comment
Share on other sites

@@Mikepo

With your sentence the search is done into "products_name", "products_model" and "products_seo_keywords" together.
So the admin choice between "Model/Keyword" is
 no longer active.

Otherwise, in keywords, you could input the real manufacturer model of the product, it will be more interesting than the osc model of the product.

Edited by milerwan

Osc v2.3.4 BS "custom"
PHP 7.3 compatible (710 modified files => o_O')

Link to comment
Share on other sites

 

after this line:

      $file = DIR_WS_LANGUAGES . $language . '/' . $file_name;

add this:

      $newfile = 'whatever you want...';

 

change:

'title' => sprintf( MODULE_CONTENT_HEADER_STORE_SEARCH_PAGE, substr(basename($file), 0, -4)),

to:

 

'title' => sprintf( MODULE_CONTENT_HEADER_STORE_SEARCH_PAGE, $newfile),

 

 

Thank you for your response.

 

This does change the result name, but it gives every page the same name. So changing it to $newfile = 'verzending'; means that it will name every page "verzending". instead of the dutch name for that page.

 

I tried changing it so it will take the name of the HEADING_TITLE for that particular page, like this:

include(DIR_WS_LANGUAGES . $language . '/' . $file_name);

$newfile = HEADING_TITLE;

Unfortunately, this will take the HEADING_TITLE of only one page, in my case for conditions.php, and not the HEADING_TITLE of the page it is referring to.

 

Maybe you know how to code it, so it will take the HEADING_TITLE. If that is not possible, maybe there is a way to code it so instead of $newfile = 'whatever you want...'; for every page, I can put something there for the pages each.

Link to comment
Share on other sites

v2.4 will be your friend. v2.3.x has no way to use HEADING_TITLE.

But now you could use an associative array to figure out whatever you want.

//have to figure out for yourself
$example['condition'] => array('dutch' => 'Verzending',
                               'english' => 'Conditions');

//get the translated filename
if (isset($example[substr(basename($file), 0, -4)][$language])) {
  $newfile = $example[substr(basename($file), 0, -4)][$language];
} else {
  $newfile = $file;
}

: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

 

v2.4 will be your friend. v2.3.x has no way to use HEADING_TITLE.

 

But now you could use an associative array to figure out whatever you want.

//have to figure out for yourself
$example['condition'] => array('dutch' => 'Verzending',
                               'english' => 'Conditions');

//get the translated filename
if (isset($example[substr(basename($file), 0, -4)][$language])) {
  $newfile = $example[substr(basename($file), 0, -4)][$language];
} else {
  $newfile = $file;
}

 

Thanks again for replying.

 

I wasn't able to get your code to work, but find another way that did the job.

$example = array('shipping.php', 'conditions.php', 'advanced_search.php');
$example2 = array(MODULE_CONTENT_HEADER_STORE_SEARCH_PAGE_SHIPPING, MODULE_CONTENT_HEADER_STORE_SEARCH_PAGE_CONDITIONS, MODULE_CONTENT_HEADER_STORE_SEARCH_PAGE_SEARCH, );
      
$newfile = str_replace($example, $example2, $file_name);

 

define('MODULE_CONTENT_HEADER_STORE_SEARCH_PAGE_SHIPPING', 'Verzending');
define('MODULE_CONTENT_HEADER_STORE_SEARCH_PAGE_CONDITIONS', 'Algemene Voorwaarden');

Now when searching for "verzending", the search bar nicely shows "Verzending" instead of "shipping.php".

 

I'm pretty proud of myself, since I'm not really a PHP coder and still learning.

 

Maybe this is something to code in the new version of the Add On, since I'm probably not the only one to want to change the names. This way, anyone is free to fill in their own page names. 

Edited by Howmessages
Link to comment
Share on other sites

Thanks again for replying.

 

I wasn't able to get your code to work, but find another way that did the job.

$example = array('shipping.php', 'conditions.php', 'advanced_search.php');
$example2 = array(MODULE_CONTENT_HEADER_STORE_SEARCH_PAGE_SHIPPING, MODULE_CONTENT_HEADER_STORE_SEARCH_PAGE_CONDITIONS, MODULE_CONTENT_HEADER_STORE_SEARCH_PAGE_SEARCH, );
      
$newfile = str_replace($example, $example2, $file_name);

 

define('MODULE_CONTENT_HEADER_STORE_SEARCH_PAGE_SHIPPING', 'Verzending');
define('MODULE_CONTENT_HEADER_STORE_SEARCH_PAGE_CONDITIONS', 'Algemene Voorwaarden');

Now when searching for "verzending", the search bar nicely shows "Verzending" instead of "shipping.php".

 

I'm pretty proud of myself, since I'm not really a PHP coder and still learning.

 

Maybe this is something to code in the new version of the Add On, since I'm probably not the only one to want to change the names. This way, anyone is free to fill in their own page names. 

The matter with this trick is the search result for the pages only covers the occurrence of page filename "xxx.php" and not its translation in the appropriate language.

Edited by milerwan

Osc v2.3.4 BS "custom"
PHP 7.3 compatible (710 modified files => o_O')

Link to comment
Share on other sites

The matter with this trick is the search result for the pages only covers the occurrence of page filename "xxx.php" and not its translation in the appropriate language.

 

This is where the define('MODULE_CONTENT_HEADER_STORE_SEARCH_PAGE_SHIPPING', 'Verzending'); in the language folder comes to use. Anyone can translate it to the languages used.

Link to comment
Share on other sites

Maybe this is something to code in the new version of the Add On, since I'm probably not the only one to want to change the names. This way, anyone is free to fill in their own page names. 

Sure, you could find the new version below.

Store Search with Image (BS) v1.5http://addons.oscommerce.com/info/9504

 

Thank you for your contribution. ;)

Edited by milerwan

Osc v2.3.4 BS "custom"
PHP 7.3 compatible (710 modified files => o_O')

Link to comment
Share on other sites

  • 2 weeks later...

Hi Guys,

 

I'm new to oscommerce v2.3.4 and when installing the store search bar i get this kind of warning :

Warning: include(DIR_WS_MODULEScontent/header/templates/store_search.php): failed to open stream: No such file or directory in C:\xampp\htdocs\oscommerce_test_a\includes\modules\content\header\cm_header_store_search.php on line 45

Warning: include(): Failed opening 'DIR_WS_MODULEScontent/header/templates/store_search.php' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\oscommerce_test_a\includes\modules\content\header\cm_header_store_search.php on line 45

 

can anyone help!

 

Thanks

Link to comment
Share on other sites

Hi Guys,

 

I'm new to oscommerce v2.3.4 and when installing the store search bar i get this kind of warning :

 

Warning: include(DIR_WS_MODULEScontent/header/templates/store_search.php): failed to open stream: No such file or directory in C:\xampp\htdocs\oscommerce_test_a\includes\modules\content\header\cm_header_store_search.php on line 45

 

Warning: include(): Failed opening 'DIR_WS_MODULEScontent/header/templates/store_search.php' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\oscommerce_test_a\includes\modules\content\header\cm_header_store_search.php on line 45

 

can anyone help!

 

Thanks

 

As you can see, your DIR_WS_MODULES is not well configured in your "includes/configure.php" file.

 

You need to have this :

  define('DIR_WS_INCLUDES', 'includes/');
  define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');

Make the changes or add the lines above in this file.

 

Furthermore, take a look in "admin/includes/configure.php" file and do the same if these lines are wrong too.

Osc v2.3.4 BS "custom"
PHP 7.3 compatible (710 modified files => o_O')

Link to comment
Share on other sites

I have installed this addon and made the changes to use Milerwan's nav bar version however I am getting the below error. I'm 99% certain it's me that's missed something but I have no idea what.

 

Fatal error: Call to undefined method nb_store_search::execute() in \includes\classes\osc_template.php on line 101

Link to comment
Share on other sites

I have installed this addon and made the changes to use Milerwan's nav bar version however I am getting the below error. I'm 99% certain it's me that's missed something but I have no idea what.

 

Fatal error: Call to undefined method nb_store_search::execute() in [/size]\includes\classes\osc_template.php on line [/size]101

 

In  original "cm_header_search_bar.php", the class called "cm_header_store_search" started like this: 

  class cm_header_store_search {
    var $code = 'cm_header_store_search';
    var $group = 'header';
    var $title;
    var $description;
    var $sort_order;
    var $enabled = false;

    function cm_header_store_search() {
      $this->title = MODULE_CONTENT_HEADER_STORE_SEARCH_TITLE;
      $this->description = MODULE_CONTENT_HEADER_STORE_SEARCH_DESCRIPTION;

      if ( defined('MODULE_CONTENT_HEADER_STORE_SEARCH_STATUS') ) {
        $this->sort_order = MODULE_CONTENT_HEADER_STORE_SEARCH_SORT_ORDER;
        $this->enabled = (MODULE_CONTENT_HEADER_STORE_SEARCH_STATUS == 'True');
      }
    }

    function execute() {
      global $request_type, $oscTemplate;

      $content_width = MODULE_CONTENT_HEADER_STORE_SEARCH_CONTENT_WIDTH;

      $search_box = tep_navbar_store_search('btn-info', (MODULE_CONTENT_HEADER_STORE_SEARCH_FUNCTIONS == 'Descriptions'));

      // define typeahead scripts
      $script = '<script src="' . tep_href_link('ext/bootstrap-plugins/typeahead/bootstrap3-typeahead.min.js', null, $request_type) . '"></script>';
      $script .= '<script src="' . tep_href_link('ext/modules/content/header/store_search/content_searches.min.js', null, $request_type) . '"></script>';

      $oscTemplate->addBlock($script, 'footer_scripts');

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

      $oscTemplate->addContent($template, $this->group);
    }
If you want to adapt the script to navbar, be sure to change all the "cm_header_store_search" sentences by "nb_store_search" if it's like this you have renamed them and add specific "function getOutput" instead of "function execute".

 

This should be changed like this: 

  class nb_store_search {
    var $code = 'nb_store_search';
    var $group = 'navbar_modules_home';
    var $title;
    var $description;
    var $sort_order;
    var $enabled = false;

    function nb_store_search() {
      $this->title = MODULE_NAVBAR_STORE_SEARCH_TITLE;
      $this->description = MODULE_NAVBAR_STORE_SEARCH_DESCRIPTION;

      if ( defined('MODULE_NAVBAR_STORE_SEARCH_STATUS') ) {
        $this->sort_order = MODULE_NAVBAR_STORE_SEARCH_SORT_ORDER;
        $this->enabled = (MODULE_NAVBAR_STORE_SEARCH_STATUS == 'True');

        switch (MODULE_NAVBAR_STORE_SEARCH_CONTENT_PLACEMENT) {
          case 'Home':
          $this->group = 'navbar_modules_home';
          break;
          case 'Left':
          $this->group = 'navbar_modules_left';
          break;
          case 'Right':
          $this->group = 'navbar_modules_right';
          break;
        }
      }
    }

    function getOutput() {
      global $request_type, $oscTemplate;

      $content_width = MODULE_NAVBAR_STORE_SEARCH_CONTENT_WIDTH;

      $search_box = tep_navbar_store_search('btn-info', (MODULE_NAVBAR_STORE_SEARCH_FUNCTIONS == 'Descriptions'));

      // define typeahead scripts
      $script = '<script src="' . tep_href_link('ext/bootstrap-plugins/typeahead/bootstrap3-typeahead.min.js', null, $request_type) . '"></script>';
      $script .= '<script src="' . tep_href_link('ext/modules/content/header/store_search/content_searches.min.js', null, $request_type) . '"></script>';

      $oscTemplate->addBlock($script, 'footer_scripts');

      ob_start();
      require(DIR_WS_MODULES . $this->group . '/templates/store_search.php');
      $data = ob_get_clean();

      $oscTemplate->addBlock($data, $this->group);
    }
And don't forget to add in "function install" the "Content placement" for the store search bar :

      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Placement', 'MODULE_NAVBAR_STORE_SEARCH_CONTENT_PLACEMENT', 'Right', 'Should the module be loaded in the Left or Right or the Home area of the Navbar?', '6', '1', 'tep_cfg_select_option(array(\'Left\', \'Right\', \'Home\'), ', now())");
And in "function keys":

'MODULE_NAVBAR_STORE_SEARCH_CONTENT_PLACEMENT',
Edited by milerwan

Osc v2.3.4 BS "custom"
PHP 7.3 compatible (710 modified files => o_O')

Link to comment
Share on other sites

  • 2 months later...

[deleted]

Edited by peterpil19

CE PHOENIX SUPPORTER

Support the Project, go PRO and get access to certified add ons

Full-time I am a C-suite executive of a large retail company in Australia. In my spare time, I enjoying learning about web-design.

Download the latest version of CE Phoenix from gitHub here

Link to comment
Share on other sites

Hi,

 

For anyone that has installed the (very useful) related contribution by @@LeeFoster (http://addons.oscommerce.com/info/9531) and have noticed your server logs displaying a File Not Found error continuously (in my case twice a minute) for public_html/ext/modules/content/header/store_search/content_searches.min.js, the solution is to download the original search contribution by @Gergley and install that missing file.

 

I noticed this by chance when checking my server logs.

 

Peter

CE PHOENIX SUPPORTER

Support the Project, go PRO and get access to certified add ons

Full-time I am a C-suite executive of a large retail company in Australia. In my spare time, I enjoying learning about web-design.

Download the latest version of CE Phoenix from gitHub here

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