View Single Post
  #10  
Old 03-26-2008, 07:17 PM
 
Monarch1 Monarch1 is offline
 

Advanced Member
  
Join Date: Mar 2003
Posts: 30
 

Default Re: Dynamic Product Search (ajax)

*** UPDATED STEP 2 ***
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) SORRY HERE"S THE HACK

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.

DONE..

ALERT: AN MS IE Security message will pop-up. Answer yes or no, it doesn't matter.
The search will work. Once I find the cause of the pop-up, I'll post the fix.
__________________
:::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::
X-Cart Pro 4.1.8 (Linux) (4.1.10 upgrade pending)
Reply With Quote