Ecommerce software home
Shopping Cart Software Forum for Ecommerce Templates
 
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

Find us on Facebook Follow us on Twitter View our YouTube channel
Search our site
Forum Search
Google Site Search
Next Page
Author « Topic »
Page: of 2

RJB
Ecommerce Template Expert

United Kingdom
789 Posts

Posted - 06/26/2019 :  13:52:28  
Hi, I've just updated to 7.1.2 and have the new autosearch feature working on the search page. I really like this feature, but it doesn't currently work with the search box on the site-wide page header which is the one I think most people use. ..Is it possible to implement this?

Richard.

dbdave
ECT Moderator

USA
10406 Posts

Posted - 06/26/2019 :  13:56:19  
I was thinking the same thing... I haven't updated, but when I do, I thought I might have a look to see how difficult it might be to get that working on an external search box.
I'll try to check it out this weekend.

Positivek9
Ecommerce Template Guru

USA
4061 Posts

Pre-sales questions only
(More Details...)

Posted - 06/26/2019 :  14:09:45  
I agree....

Most of my visitors start from the search box... not the search page.

Keeping fingers crossed Dave will work his magic.

Julie
Owned & loved by 7 German Shepherds

dbdave
ECT Moderator

USA
10406 Posts

Posted - 06/26/2019 :  14:24:43  
Well, considering I hide the search box on the search page, I won't be able to use that feature unless I get it going.
I think it might be an easy solution after having looked at the demo Andy posted.

RJB
Ecommerce Template Expert

United Kingdom
789 Posts

Posted - 06/27/2019 :  10:35:55  
Thank you Dave ..hope you can work out a solution.

Richard.

dbdave
ECT Moderator

USA
10406 Posts

Posted - 06/27/2019 :  11:13:41  
Looking at the demo Andy posted ( https://www.ecommercetemplates.com/support/topic.asp?TOPIC_ID=111606 ), (I checked his .asp link) this is the input line
<input type="search" name="stext" id="stext" size="20" maxlength="1024" value="" onkeydown="return ectAutoSrchKeydown(this,event,'asp')" onblur="ectAutoHideCombo()" autocapitalize="off" autocomplete="off" spellcheck="false" autocorrect="off">


The first thing I would try is to replace my custom search box input line to that (change the asp in red there to php if you are on a .php version), and be sure the ectcart.js file is called on all pages that have the form.
In theory, it should work. I think....

Positivek9
Ecommerce Template Guru

USA
4061 Posts

Pre-sales questions only
(More Details...)

Posted - 06/27/2019 :  12:07:03  
Bummer, tried it, doesn't work:

Before with:
<form id="form-search" method="post" action="search.asp">
<input type="hidden" name="posted" value="1"/>
<input type="text" id="input-keywords" name="stext" value="Search our store..." onfocus="if(this.value == 'Search our store...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search our store...';}" class="searchInput" />
<input type="submit" value="Search" id="form_submit_button" class="searchBtn" />

[img]https://www.pawtasticpet.com/search2.jpg[/img]

After input line changed:
[img]https://www.pawtasticpet.com/search1.jpg[/img]

Julie
Owned & loved by 7 German Shepherds

Edited by - Positivek9 on 06/27/2019 12:08:43

DLSS
ECT Moderator

Canada
3956 Posts

Posted - 06/27/2019 :  13:06:37  
Try changing the id of the search box to "stext" and the form name to "searchform"



Mike Beebe
President,
DataLinks Software Solutions
www.dlss.ca

Rate Me Here

ASP and PHP mods - www.dlss.ca/products.asp
A Tremendous Home - Home Decor and Design, D-I-Y Projects, Home Life, Recipes - www.ATremendousHome.com

Edited by - DLSS on 06/27/2019 13:08:45

dbdave
ECT Moderator

USA
10406 Posts

Posted - 06/27/2019 :  13:38:59  
Julie, Mike is on track there. I did take a moment and look at the js file on the demo store Andy linked to and there are a few things that are going to be dependent on the form name and a few id's there.
I will try this out soon and likely write it up as a tip. I believe it's not going to be too difficult and will not require any mods to the core files.

If you try it again, and hit F12 on your keyboard (or right click>inspect) you can view the "console" to see what javascript errors are showing.

Edited by - dbdave on 06/27/2019 13:40:37

dbdave
ECT Moderator

USA
10406 Posts

Posted - 06/27/2019 :  21:40:40  
Ok, the big missing piece of this is you will need this line in your form. A hidden div that becomes active when suggestions are made.

<div class="autosearch" style="z-index:1000;position:absolute;display:none;" id="selectstext"></div>

I have this working on a test page, but it needs to be cleaned up, but so far, here are a few relevant bits.

The new search form, on the search page uses this important line as I mentioned before, with the part in red there changed to "php" for .php versions.
<input type="search" name="stext" id="stext" size="20" maxlength="1024" value="" onkeydown="return ectAutoSrchKeydown(this,event,'asp')" onblur="ectAutoHideCombo()" autocapitalize="off" autocomplete="off" spellcheck="false" autocorrect="off">

As Mike mentioned before, it's critical that your form have the "id" of "searchform".
Without this, you might get suggestions, but upon selection the form will not submit automatically.
So the opening form tag for your search bar should look something like this. Note the id in blue there has been added.
<form id="searchform" class="searchbox" method="post" action="search.asp">


Next, we need the hidden div that Julie needed.
<div class="autosearch" style="z-index:1000;position:absolute;display:none;" id="selectstext"></div>


Lastly, you will need to have the ectcart.js file linked in all pages that have this custom search form. Although that's likely already the case.

There are lots of ways to customize a form so everyone may have slight variations for a custom search form. You can create and style a custom submit button, and so on.
Below I have a very generic form that should be a starting point. change the asp to php if needed.
<form id="searchform" class="searchbox" method="post" action="search.asp">
<input type="hidden" name="posted" value="1"/>
<input type="search" name="stext" id="stext" size="20" maxlength="1024" value="" onkeydown="return ectAutoSrchKeydown(this,event,'asp')" onblur="ectAutoHideCombo()" autocapitalize="off" autocomplete="off" spellcheck="false" autocorrect="off"/>
<div class="autosearch" style="z-index:1000;position:absolute;display:none;" id="selectstext"></div>
<input type="submit" class="search-button" value="GO"/>
</form>


One potential issue is if you show the search box in the header of your search page and a user enters a new search there, the suggestion will likely populate on the search box below in the search page. You might consider not using a header search box on your search page, or do not modify your existing header search for the search.asp/php page only.

There may be more info or issues, but in my initial testing, it seems to work fine.
In a few days, I can probably setup a working demo to show and write it up as a tip and post in that forum.

David

Edited by - dbdave on 06/27/2019 21:45:16

Vince
Administrator

42750 Posts

Posted - 06/28/2019 :  04:50:01  
Ok, changes ready and what I've done, just in case you all have any more great suggestions is make a Beta available which you can download here...
https://www.ecommercetemplates.com/updaters.asp?betas=true
You can only see the Betas if the parameter ?betas=true is included

To set up your search box after installing the updater (you need the new ectcart.js and ectcart.css) you can do something like this...

<form method="post" action="search.php" id="ecttextform">
<input type="hidden" name="posted" value="1">
<div style="position:relative">
<input type="text" maxlength="128" class="search_look" value="" name="stext" id="ecttext" onkeydown="return ectAutoSrchKeydown(this,event,'php')" onblur="ectAutoHideCombo(this)" autocomplete="off" />
</div>
<div class="autosearch" style="position:absolute;display:none" id="selectecttext"></div>
<button class="search_btn" title="Search" type="submit">Search</button>
</form>

The important bits are...
The form which now has the id="ecttextform"
The text input which has the name="stext" BUT id="ecttext"
The text input must be in a div. . . <div style="position:relative">
The actions onkeydown="return ectAutoSrchKeydown(this,event,'php')" onblur="ectAutoHideCombo(this)" (and please note, ectAutoHideCombo now has the parameter "this".
The autosearch DIV . . . <div class="autosearch" style="position:absolute;display:none" id="selectecttext"></div>

You can use any id you like (to have more than two searches on the page) as long as the id you give the text input (ecttext in this case) uses that name with "form" after it for the form (ecttextform) and that name preceeded by "select" for the DIV (selectecttext here).

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater

dbdave
ECT Moderator

USA
10406 Posts

Posted - 06/28/2019 :  05:16:15  
Well there you have it, right from the source.

RJB
Ecommerce Template Expert

United Kingdom
789 Posts

Posted - 06/28/2019 :  12:54:14  
Thank you Dave & Vince for the update and instructions. I have now got this working on a test page, but I have a couple of issues.

1- A lot of my product names include a dash '-' and I think this is causing the search to fail as the products are not found.

2- On the main search page when I click an item from the autosearch list it doesn't trigger the search unless I click the search button on the page.

Richard.

dbdave
ECT Moderator

USA
10406 Posts

Posted - 06/28/2019 :  13:06:17  
Hi Richard, while I cannot comment on number 1 at the moment, number 2 might just be that the js file is cached and you need a hard refresh. Make sure you uploaded the new one with the last updater.

quote:
On the main search page when I click an item from the autosearch list it doesn't trigger the search unless I click the search button on the page.


I like to use firefox and when I first installed this, I actually had to view source, click the link to the js file and refresh that to get the new file. In the last year or so, it seems like firefox caching relentlessly.

Vince
Administrator

42750 Posts

Posted - 06/29/2019 :  03:15:49  
Hi Richard
quote:
On the main search page when I click an item from the autosearch list it doesn't trigger the search unless I click the search button on the page.
Did you change the id for the form?

<form method="post" action="search.php" id="ecttextform">

quote:
A lot of my product names include a dash '-' and I think this is causing the search to fail as the products are not found.
Are the dashes entered as HTML entities, like...
&dash;

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater

RJB
Ecommerce Template Expert

United Kingdom
789 Posts

Posted - 06/29/2019 :  04:35:35  
Hi Vince,

The dashes were entered as normal text in the product admin. I have just tried changing them to ‐ but I get the same 'not found' result.

I haven't changed the form id yet, but as I haven't implemented this feature on the page header search box on the live site yet I don't think this should be an issue. My search.php page only has one instance of the autosearch feature.

I'll email you links to my site to demonstrate the issues in case you want to take a look.

Richard.

Vince
Administrator

42750 Posts

Posted - 06/29/2019 :  06:07:00  
Hi Richard
I see what the problem is. It's not the new incremental search that is the problem but rather that it's always been the case that dashes are used for "not" in the search. The trouble with the incremental search is that instead of searching for just say "Arched" you are searching for everything including the dash. If you think your customers don't use this feature however of being able to specify a "NOT", then open incsearch.php in notepad and just comment this line...
if(substr($Xstext, 0, 1)=='-'){ $relsql[$relindex].='NOT '; $Xstext=substr($Xstext, 1); $isnot=TRUE; }else $isnot=FALSE;
...with a double slash like this...
//if(substr($Xstext, 0, 1)=='-'){ $relsql[$relindex].='NOT '; $Xstext=substr($Xstext, 1); $isnot=TRUE; }else $isnot=FALSE;

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater

RJB
Ecommerce Template Expert

United Kingdom
789 Posts

Posted - 06/29/2019 :  14:02:08  
Hi Vince,
I doubt if my customers would use the dash to exclude search terms so I think it should be ok to remove that feature. I have tried commenting out the code as suggested, but unfortunately this doesn't appear to solve the problem. I also tried deleting that line of code but the result was the same.

Richard.

Vince
Administrator

42750 Posts

Posted - 06/29/2019 :  14:50:53  
Hi Richard
Ok, search for this function...
function getlike($fie,$t,$tjn){
...then comment out these 3 lines...
if(substr($t, 0, 1)=='-'){ // pSKU excluded to work around NULL problems
if($fie!='pSKU' && $fie!='pSearchParams') $sNOTSQL.=$fie." LIKE '%".substr($t, 1)."%' OR ";
}else

like this
// if(substr($t, 0, 1)=='-'){ // pSKU excluded to work around NULL problems
// if($fie!='pSKU' && $fie!='pSearchParams') $sNOTSQL.=$fie." LIKE '%".substr($t, 1)."%' OR ";
// }else
If that doesn't work, send me the FTP login.

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater

RJB
Ecommerce Template Expert

United Kingdom
789 Posts

Posted - 06/29/2019 :  16:37:22  
Hi Vince,

Thank you, that seems to have solved the problem and it's working nicely now. Will that change be included in future updates or will I need to make this modification each time?

Richard.

Vince
Administrator

42750 Posts

Posted - 06/30/2019 :  03:07:29  
Hi Richard,
I doubt most people even know there is a feature to exclude keywords in the search (I'd even forgotten myself ) so what I've done is put that functionality under control of a parameter...
usenotsearch=TRUE
$usenotsearch=TRUE;
That way if anyone really does want to keep the feature they can, but you won't have to make any modifications in the future, no.

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater
Page: of 2 « Topic »  
Next Page
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2022 ecommercetemplates.com
This page was generated in 0.05 seconds. Snitz Forums 2000