Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Dynamic Product Search (ajax)

 
Reply
   X-Cart forums > X-Cart 4 > Third Party Add-Ons for X-Cart 4
 
Thread Tools
  #11  
Old 03-27-2008, 10:13 AM
 
Monarch1 Monarch1 is offline
 

Advanced Member
  
Join Date: Mar 2003
Posts: 30
 

Default Re: Dynamic Product Search (ajax) - FIX

This mod will work with XC 4.1.8 with the Fashion Mosaic skin.

Follow in the mod installation file, with the following changes:

STEP 1) SKIP THIS STEP

STEP 2) EDIT /dsearch.php.

REMOVE LINES 2 - 5

// SET MYSQL INFORMATION
$conn = mysql_connect("LOCALHOST","USERNAME","PASSWORD");
// CONNECT TO MYSQL DATABASE
mysql_select_db("DATABASE",$conn);

ADD:

require "./auth.php";

FIND THIS FOLLOWING LINE. (The search list will not display products with 0 available. If you are not using inventory tracking or want to display products no in stock in the search list make this change. Otherwise, skip this step.)

$res = mysql_query("select productid,product from xcart_products where forsale='Y' AND avail>0 AND product like '".$letters."%'") or die(mysql_error());

REPLACE WITH THIS UPDATED LINE

$res = mysql_query("select productid,product from xcart_products where forsale='Y' AND avail>=0 AND product like '".$letters."%'") or die(mysql_error());


STEP 3) Upload all files, then rename dsearch[v4.0.x].tpl or dsearch[v4.1.x].tpl to dsearch.tpl, according to your version.

STEP 4) Add this code to /skin1/customer/home.tpl before </head>

<link rel="stylesheet" href="{$SkinDir}/dsearch/dsearch.css">
<script type="text/javascript" src="{$SkinDir}/dsearch/ajax.js"></script>
<script type="text/javascript" src="{$SkinDir}/dsearch/dsearch.js"></script>

STEP 5) SKIP THIS STEP

STEP 6) Modify 'skin1/dsearch/dsearch.js" file:

CHANGE ajax_list_MSIE from true to false:

ORIGINAL LINE:
if(navigator.userAgent.indexOf('MSIE')>=0 && navigator.userAgent.indexOf('Opera')<0)ajax_list_M SIE=true;

CHANGED LINE:
if(navigator.userAgent.indexOf('MSIE')>=0 && navigator.userAgent.indexOf('Opera')<0)ajax_list_M SIE=false;

STEP 7) Copy dsearch.tpl to "skin1/customer" directory
Back-up skin1/customer/search.tpl (cp search.tpl search.tpl.old)
Copy dsearch.tpl to search.tpl (cp dsearch.tpl search.tpl)

NOTE
====

To reduce the load on your server, in "skin1/dsearch/dsearch.js", modify...

var minimumLettersBeforeLookup = 2; // Number of letters entered before a lookup is performed.

YOU'RE DONE.
__________________
:::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::
X-Cart Pro 4.1.8 (Linux) (4.1.10 upgrade pending)
Reply With Quote

The following user thanks Monarch1 for this useful post:
am2003 (07-25-2010)
  #12  
Old 04-07-2009, 09:06 PM
  clik's Avatar 
clik clik is offline
 

Advanced Member
  
Join Date: Mar 2006
Location: Canada
Posts: 30
 

Question Re: Dynamic Product Search (ajax) - FIX

Quote:
Originally Posted by Monarch1

STEP 2) EDIT /dsearch.php.

REMOVE LINES 2 - 5

// SET MYSQL INFORMATION
$conn = mysql_connect("LOCALHOST","USERNAME","PASSWORD");
// CONNECT TO MYSQL DATABASE
mysql_select_db("DATABASE",$conn);

ADD:

require "./auth.php";


Hi,
when I installed this Dynamic Product Search (ajax) mod as it was instructed originally, everything worked fine but I wanted to illuminate $conn from dsearch.php code. I did it like you suggested by replacing it with require "./auth.php";. Also I changed "=true" to "=false". My x-cart is 4.0.11. Do you know what it might be wrong or missing?

Thank you in advance,
clik
__________________
__________________
XC5: 5.3.4.4
PHP: 7.0.26
MySQL server: 5.5.56-MariaDB
Reply With Quote
  #13  
Old 07-23-2010, 08:16 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default Re: Dynamic Product Search (ajax)

Mod updated and tested working fine with v4.3.x
Info - http://www.xcartmods.co.uk/x-cart-ajax-dynamic-product-search.html
Demo - http://www.xcartmods.co.uk/demos/43x/home.php
__________________
xcartmods.co.uk
Reply With Quote
  #14  
Old 07-23-2010, 11:39 PM
 
anandat anandat is offline
 

X-Adept
  
Join Date: Jan 2004
Posts: 914
 

Question Re: Dynamic Product Search (ajax)

Quote:
Originally Posted by PhilJ
Hi Phil,
This will work with Smart Search or only works with default x-cart search ?
__________________
X-Cart: 4.7.7 LIVE
Skin:Ultra by xcartmods.co.uk
X-cart Modules: | ACR, Rich Google Search, Customer Testimonials | Cloud Search, | Websitecm: CDSEO (2.1.9)
---------------
Server: Linux
php: 5.3
mysql: 5.0.89
----------------
Reply With Quote
  #15  
Old 07-24-2010, 05:44 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default Re: Dynamic Product Search (ajax)

Quote:
This will work with Smart Search
Yes, I don't see why not.
__________________
xcartmods.co.uk
Reply With Quote
  #16  
Old 07-24-2010, 07:47 AM
  Vacman's Avatar 
Vacman Vacman is offline
 

X-Adept
  
Join Date: Sep 2005
Location: Torrance, CA
Posts: 792
 

Default Re: Dynamic Product Search (ajax)

Question - This instructions are written the following way:
Code:
1) If you are running v4.0.x, in search.php, below...

However; there does not appear to be instructions for all other versions? I could probably figure it out, but rather play it safe.
__________________
Carl Tice

X-Cart 4.6.6
X-Payments 3.0
ReBOOT 3.4.1

PHP 5.6.30
MySQL 5.6.35
Linux 2.6.32-042stab120.18
ionCube PHP Loader v4.7.3
Perl 5.10.1
Reply With Quote
  #17  
Old 07-24-2010, 07:52 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default Re: Dynamic Product Search (ajax)

Skip that part, as you're using v4.3.2.

I'm taking that part out of the install.txt
__________________
xcartmods.co.uk
Reply With Quote
  #18  
Old 07-24-2010, 07:54 AM
  Vacman's Avatar 
Vacman Vacman is offline
 

X-Adept
  
Join Date: Sep 2005
Location: Torrance, CA
Posts: 792
 

Default Re: Dynamic Product Search (ajax)

Show just move on to step 2 then... Cool. Checking out some of your other freebee stuff on your site. Very nice! Have downloaded a few of them and can't wait to check them out.
__________________
Carl Tice

X-Cart 4.6.6
X-Payments 3.0
ReBOOT 3.4.1

PHP 5.6.30
MySQL 5.6.35
Linux 2.6.32-042stab120.18
ionCube PHP Loader v4.7.3
Perl 5.10.1
Reply With Quote
  #19  
Old 07-24-2010, 09:17 PM
 
anandat anandat is offline
 

X-Adept
  
Join Date: Jan 2004
Posts: 914
 

Default Re: Dynamic Product Search (ajax)

Quote:
Originally Posted by PhilJ
Yes, I don't see why not.
Phil,
Thanks for the answer.
Very glad to know that it will work with Smart Search also.

But can you please tell me how to configure this mod for Smart Search since the installation guide you provided is only for default x-cart search only.

Thanks in advance for any help
__________________
X-Cart: 4.7.7 LIVE
Skin:Ultra by xcartmods.co.uk
X-cart Modules: | ACR, Rich Google Search, Customer Testimonials | Cloud Search, | Websitecm: CDSEO (2.1.9)
---------------
Server: Linux
php: 5.3
mysql: 5.0.89
----------------
Reply With Quote
  #20  
Old 08-24-2010, 04:43 AM
 
retrtrtrytrutru retrtrtrytrutru is offline
 

Senior Member
  
Join Date: Aug 2007
Posts: 101
 

Default Re: Dynamic Product Search (ajax)

Dear PhilJ,

I installed this free mod on our website (4.2.0) and it's working perfect, thanks. One question though, when you enter a search term with a hyphen in it, followed by a character, the search doesn't seem to work anymore (read: doesn't display any results). For example, when I enter (I set the search trigger to only 2 characters):

SP it gives me results like SP-LAMP-007 (a product name)
SP- gives the same result
SP-L no results anymore, while it should still display SP-LAMP-007
LAMP (no hypen) gives the SP-LAMP-007 result again, as it should.

Any idea how to change this behavior? I suspect it has something to do with the preg_replace function ($letters = preg_replace("/[^a-z0-9 ]/si","",$letters); but no idea how to edit it)?

Thanks a lot,
Dennis
__________________
www.qualitylamps.eu
X-Cart Gold 4.1.8, PHP 5.2.6, MySQL 5.0.51a, Apache 2.2.9

www.vervangjelamp.nl
X-Cart Gold 4.2.0, PHP 5.2.6, MySQL 5.0.37-standard, Apache/2

Sorry for the weird user name, I registered it by mistake
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Third Party Add-Ons for X-Cart 4



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 12:23 AM.

   

 
X-Cart forums © 2001-2020