Jump to content
auzStar

[Addon] Twitter Typeahead Autocomplete Search for osC 2.3.4 (BS and nonBS)

Recommended Posts

@SuperPower09,

If you only wish to remove the space for this exact term, you can add a string_replace in ext/modules/header_tags/twitter_typeahead/autocomplete.php:

  $search_term = str_replace('My Dog', 'MyDog', $search_term);

If you have more terms which need correction, create replacement arrays and use preg_replace.

 

rgds

Rainer

Edited by raiwa

Share this post


Link to post
Share on other sites

You wouldn't want it to be absolute, but you could strip out the white spaces and create two search terms.  Where it would work on the My Dog to MyDog term, there are others that it won't work because you need the space character.  So, create a second search term and then have it search for either. 


I'm not really a dog.

Share this post


Link to post
Share on other sites

@raiwa @ArtcoInc @John W

I really appreciate your replies and thoughts.

I did have more than one brand so, with the help of Rainer's suggestion, I came up with the following:

$search_keywords = array('My Dog' => 'MyDog', 'Her Dog' => 'HerDog', 'His Dog' => 'HisDog');
$search_term = str_ireplace(array_keys($search_keywords), $search_keywords, $search_term);

Please let me know if you see any pitfalls in my code but with that said, it works.

Thinking outside the box.......I imagine this will be a somewhat rare instance but maybe something could be included on the Admin side that allows users to specify search terms in which spaces can be ignored.

Share this post


Link to post
Share on other sites

Hello!

I ran across an issue I can't quite figure out....I feel like I'm overlooking something.

We have a few products that have model names/numbers that are just three characters long and when I attempt to search for them, they don't show up in the autocomplete list results.

I've tried to change the "Min Characters Required" to the minimum (2) but this doesn't seem to help either way.

 

Any suggestions on what I can do here? I'm going to keep looking around in the meantime...

Share this post


Link to post
Share on other sites

@SuperPower09

Hi,

I wasn't able to replicate the issue. See test here: https://www.auzcommerce.com.au/index.php. Search for model "mg4" (for a test I changed the model number for the product "Matrox G400 32MB" from "MG400-32MB" to "MG4".

Is this what you are referring to? It seems to work on test site. Have you made any changes that my affect the search?

cheers


My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Share this post


Link to post
Share on other sites
18 hours ago, auzStar said:

@SuperPower09

Hi,

I wasn't able to replicate the issue. See test here: https://www.auzcommerce.com.au/index.php. Search for model "mg4" (for a test I changed the model number for the product "Matrox G400 32MB" from "MG400-32MB" to "MG4".

Is this what you are referring to? It seems to work on test site. Have you made any changes that my affect the search?

cheers

Thanks for the reply and I don't believe I've done anything to affect this functionality but I'm going to double check everything to make sure.

On my site, it's very hit or miss but on your demo, it works perfectly. I must add, I'm not using the BS version, just the standard 2.3.4.

Thanks again, I'll follow up with any further findings.

Edited by SuperPower09
Added OSC version number

Share this post


Link to post
Share on other sites

Just to confirm that here on my site 2 and 3 letter searches work without problem.

Share this post


Link to post
Share on other sites

@SuperPower09

I'll test the standard 2.3.4 version soon as I get a chance.

cheers


My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Share this post


Link to post
Share on other sites

@SuperPower09

Quick test on 2.3.4 std version also seems OK on dev site here: http://www.auzcommerce.com.au/osc234/catalog/index.php

Same as before: use "mg4" for test.

cheers


My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Share this post


Link to post
Share on other sites

Hi,

First of all I would like to say that we are very happy with the module. But lately we have discovered a pretty big problem. When I add a product to the cart and then search for a product and go to a product page from the search results, the cart empties. All the products that I have added to the cart is gone. As long as I don't search for products and click on them in the search results the cart is fine..

Please check my site here: https://goo.gl/iP5azF

We use OsC version 2.3.4 and module version 1.8. And we use https.

Module Check
Confirms correct installation of module
 The module is correctly installed

Regards,
Alex

Edited by Streamcode

Share this post


Link to post
Share on other sites

@Streamcode

Hi, wasn't able to replicate the problem here on demo site https://www.auzcommerce.com.au/, but demo site is not latest BS version, slightly older. Will have to update to latest and test again when I get a chance. But it's looks light it could be a session/cookie issue. Will let you know results when completed test.

Why is your osCsid always appearing in your URL? Check your admin settings.

cheers


My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Share this post


Link to post
Share on other sites

@Streamcode

Installed latest osC 2.3.4.1 BS EDGE version here: https://www.auzcommerce.com.au/osc234bs_edge/. Still wasn't able to replicate your issue.

I'm not aware of anyone else having this problem. You need to check or get help with your "SSL/session/cookie" configuration since your "osCsid" in the URL should disappear from the URL after first click on your site. Do this first and see if it rectifies the issue.

Here is another site that you can see where this add-on works fine without emptying the cart: https://www.grandpas.co.nz

cheers


My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Share this post


Link to post
Share on other sites

Thank you for your replies. I have noticed one thing, that is that osCsid is changing when I use the search. The session is getting new osCsid when I click on a searched product, that's why the products dissapear.

I tried using Force cookies, but then the site wont work in browsers that block cookie use.

Edited by StreamAlex

Share this post


Link to post
Share on other sites

I just installed the addon to my 2.3.4.1 CE shop (full package from the 234BS folder). Installation worked fine and says it is installed properly, but it does not work at all:

The search behaviour (tested with the header search field and a box search field) is like it always was. No search result show up while typing.

What can be wrong? Am I missing something?

Share this post


Link to post
Share on other sites

@inra311 

Have you got a link to your site so that I can see what the problem is. You can check the link to my test site in my post further above to see a working version.

cheers


My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Share this post


Link to post
Share on other sites

@inra311

It seems that the cookie.js file (which this add-on needs) has been removed from the latest 2.3.4.1 CE version, not sure why.

The installation routine never checked for this file as it assumed it was always there. It only checked for the files that were being uploaded for this add-on.

I have attached a zipped copy of the file. Download and extract it to "ext/jquery" folder on your server.

See if that fixes your problem.

Hopefully nothing else has been changed in the latest 2.3.4.1 CE version to break add-ons.

cheers

cookie.zip

Edited by auzStar

My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Share this post


Link to post
Share on other sites

Thanks, that was the reason.

One remaining problem: where can I change some background or text colours of the  search results shown in the box? With my current theme (from some theme switcher module) it is black text on dark grey background, not readable at all :(

Share this post


Link to post
Share on other sites

I've had a look at your site and I see what you mean. The problem is with the colours of your theme.

The add-on just uses the colours from your theme by default, to match your theme. I haven't incorporated a means to easily switch colours.

But if you want to have a play try this file: "ext\typeahead\css\ht-twitter-typeahead.css" (you need to have knowledge of css files).

Sorry but I won't be helping you with that.

Make sure you have a backup copy of original.

cheers


My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Share this post


Link to post
Share on other sites

EDIT: I just found the problems a) und b) are both only for German language, when English is selcted it is all fine) 

More problems/questions:

a) "No matches" when I search for "sc" or "sch" although it finds  45 matches for "sche"?? !! ( Min Characters Required on 2)
(works properly for "fe", "fen", "fend", just not "sch")

b) It does not seem to work at all with MS Edge / Internet Explorer here. Whatever I type into the search field: no matches
(Both your demo site and the grandpas site work with these browsers as well here)

Sorry for the many question :(
The css editing worked fine :)

Edited by inra311
addition

Share this post


Link to post
Share on other sites

Another addition: After switching languages a few times, it suddenly also works in German with Edge/IE (?!)

Share this post


Link to post
Share on other sites

@inra311

You might need to apply the fix by Moxamint at the top of the previous page.

cheers


My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Share this post


Link to post
Share on other sites

Thanks, that helped, I get results now for "sc', 'sch' ...  :)

There was one little mistake in the fix:

replace preg_with mb_ereg_replace

I guess it should be

replace preg_replace with mb_ereg_replace

I still occasionally get the mistake 'no matches' at all with German language in MS Edge, but only when I open the start page in Edge and do the search before anything else. I guess it has to do with an addon for the EU cookie acceptance ('with continuing you agree to the usage as per our cookie policy' *) as it works when I do a few clicks on my site before searching.

*Hmm, makes me think of an off-topic here: Is the cookie message still up to the latest GDPR laws as it implicitly assumes confirmation by just continuing to use the site??
(It is the header tag module called 'Cookie Compliance Message')
Everything else should be GDPR-ready on my site by now, but I did not think  about this addon.

 

 

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

×