X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Third Party Add-Ons for X-Cart 4 (https://forum.x-cart.com/forumdisplay.php?f=45)
-   -   Dynamic Product Search (ajax) (https://forum.x-cart.com/showthread.php?t=38144)

Monarch1 03-27-2008 10:13 AM

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.

clik 04-07-2009 09:06 PM

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. :roll: Do you know what it might be wrong or missing?

Thank you in advance,
clik

PhilJ 07-23-2010 08:16 AM

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

anandat 07-23-2010 11:39 PM

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 ?

PhilJ 07-24-2010 05:44 AM

Re: Dynamic Product Search (ajax)
 
Quote:

This will work with Smart Search
Yes, I don't see why not.

Vacman 07-24-2010 07:47 AM

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.

PhilJ 07-24-2010 07:52 AM

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

Vacman 07-24-2010 07:54 AM

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.

anandat 07-24-2010 09:17 PM

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

retrtrtrytrutru 08-24-2010 04:43 AM

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


All times are GMT -8. The time now is 02:31 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.