No. As I said in the previous post we do the test and re-direct in searchadv.aspx.cs.
Use the searchterm which is passed in as a querystring and immediately perfrom a database lookup using the searchterm as the SKUSuffix (or whatever works for you). If one record is returned then you have an exact match, and re-direct to the page.
This is the code snippet we use to match and re-direct:
Code:
private bool SearchSKU(string searchTerm)
{
using (SqlConnection dbconn = new SqlConnection(DB.GetDBConn()))
{
dbconn.Open();
string sql = "SELECT TOP 1";
sql += " [PV].[ProductID], ";
sql += " [PV].[VariantID], ";
sql += " [P].[SEName] ";
sql += "FROM ";
sql += " [ProductVariant] AS [PV] ";
sql += "INNER JOIN ";
sql += " [Product] AS [P] ON [P].[ProductID] = [PV].[ProductID] ";
sql += "WHERE ";
sql += " [PV].[SKUSuffix] = '" + searchTerm + "'";
using (IDataReader rs = DB.GetRS(sql, dbconn))
{
while (rs.Read())
{
try
{
Response.Redirect("/p-" + DB.RSFieldInt(rs, "ProductID").ToString() + "-" + DB.RSField(rs, "SEName") + ".aspx?v=" + DB.RSFieldInt(rs, "VariantID").ToString());
Response.Clear();
return true;
}
catch (Exception ex)
{
throw (ex);
}
}
}
}
return false;
}