View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Main DWT Template

Thread began 7/24/2009 3:44 pm by larsentim278054 | Last modified 7/25/2009 9:06 am by larsentim278054 | 6444 views | 14 replies

larsentim278054

Here's the page that's not working now (part 1 of 2):

<?php require_once( "WA_Globals/WA_Globals.php" ); ?>
<?php require_once('Connections/localhost.php'); ?>
<?php require_once("WA_ValidationToolkit/WAVT_Scripts_PHP.php"); ?>
<?php require_once("WA_ValidationToolkit/WAVT_ValidatedForm_PHP.php"); ?>
<?php
//WA eCart Include
require_once("WA_eCart/WA_Store_Cart_PHP.php");
?>
<?php
$WA_Store_Cart->GetContent();
?>
<?php
if (isset($_GET["Search"])) {
$WAFV_Redirect = "Products_Search.php";
$_SESSION['WAVT_ProductsResults_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateNM(((isset($_GET["S_ProductPrice"]))?$_GET["S_ProductPrice"]:"") . "",0,"","",",.",false,1);
$WAFV_Errors .= WAValidateNM(((isset($_GET["S_ProductPrice2"]))?$_GET["S_ProductPrice2"]:"") . "",0,"","",",.",false,2);

if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"ProductsResults");
}
}
?>
<?php
//WA Database Search Include
require_once("WADbSearch/HelperPHP.php");
?>
<?php
//WA Database Search (Copyright 2005, WebAssist.com)
//Recordset: WADAProducts;
//Searchpage: ;
//Form: ;
$WADbSearch1_DefaultWhere = "";
if (!session_id()) session_start();
if ((((isset($_GET["Search"]))?$_GET["Search"]:"") != "")) {
$WADbSearch1 = new FilterDef;
$WADbSearch1->initializeQueryBuilder("MYSQL","1");
//keyword array declarations
$KeyArr1 = array("ProductSKU", "CategoryName", "ProductName", "ProductCartDesc", "ProductShortDesc", "ProductLongDesc");

//comparison list additions
$WADbSearch1->keywordComparison($KeyArr1,"".((isset($_GET["S_ProductName"]))?$_GET["S_ProductName"]:"") ."","AND","Includes",",%20","%20","%22","%22",0);
$WADbSearch1->addComparison("ProductCategoryID","".((isset($_GET["CategoryID"]))?$_GET["CategoryID"]:"") ."","AND","=",1);

//save the query in a session variable
if (1 == 1) {
$_SESSION["WADbSearch1_Products_Results"]=$WADbSearch1->whereClause;
}
}
else {
$WADbSearch1 = new FilterDef;
$WADbSearch1->initializeQueryBuilder("MYSQL","1");
//get the filter definition from a session variable
if (1 == 1) {
if (isset($_SESSION["WADbSearch1_Products_Results"]) && $_SESSION["WADbSearch1_Products_Results"] != "") {
$WADbSearch1->whereClause = $_SESSION["WADbSearch1_Products_Results"];
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
$WADbSearch1->whereClause = str_replace("\\''", "''", $WADbSearch1->whereClause);
$WADbSearch1whereClause = '';
?>
<?php
//WA Database Search (Copyright 2005, WebAssist.com)
//Recordset: WADAProducts;
//Searchpage: ;
//Form: ;
$WADbSearch2_DefaultWhere = "";
if (!session_id()) session_start();
if ((((isset($_GET["Search"]))?$_GET["Search"]:"") != "")) {
$WADbSearch2 = new FilterDef;
$WADbSearch2->initializeQueryBuilder("MYSQL","1");
//keyword array declarations

//comparison list additions
$WADbSearch2->addComparison("ProductPrice","".((isset($_GET["S_ProductPrice"]))?$_GET["S_ProductPrice"]:"") ."","AND",">=",1);
$WADbSearch2->addComparison("ProductPrice","".((isset($_GET["S_ProductPrice2"]))?$_GET["S_ProductPrice2"]:"") ."","AND","<=",1);

//save the query in a session variable
if (1 == 1) {
$_SESSION["WADbSearch2_Products_Results"]=$WADbSearch2->whereClause;
}
}
else {
$WADbSearch2 = new FilterDef;
$WADbSearch2->initializeQueryBuilder("MYSQL","1");
//get the filter definition from a session variable
if (1 == 1) {
if (isset($_SESSION["WADbSearch2_Products_Results"]) && $_SESSION["WADbSearch2_Products_Results"] != "") {
$WADbSearch2->whereClause = $_SESSION["WADbSearch2_Products_Results"];
}
else {
$WADbSearch2->whereClause = $WADbSearch2_DefaultWhere;
}
}
else {
$WADbSearch2->whereClause = $WADbSearch2_DefaultWhere;
}
}
$WADbSearch2->whereClause = str_replace("\\''", "''", $WADbSearch2->whereClause);
$WADbSearch2whereClause = '';
?>
<?php
$currentPage = $_SERVER["PHP_SELF"];
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<?php
$maxRows_WADAProducts = 12;
$pageNum_WADAProducts = 0;
if (isset($_GET['pageNum_WADAProducts'])) {
$pageNum_WADAProducts = $_GET['pageNum_WADAProducts'];
}
$startRow_WADAProducts = $pageNum_WADAProducts * $maxRows_WADAProducts;

mysql_select_db($database_localhost, $localhost);
$query_WADAProducts = "SELECT *, (ProductStock - (SELECT Coalesce(Sum(DetailQuantity),0) FROM orderdetails INNER JOIN orders ON OrderID = DetailOrderID WHERE DetailProductID = ProductID AND OrderDate > ProductUpdateDate)) AS NumLeft, (SELECT MAX(ProductPrice) FROM products as prod2 INNER JOIN productoptions ON productoptions.ProductID = prod2.ProductID WHERE productoptions.GroupingID = products.ProductID AND prod2.ProductLive <> 0) AS TopPrice, (SELECT MIN(ProductPrice) FROM products as prod2 INNER JOIN productoptions ON productoptions.ProductID = prod2.ProductID WHERE productoptions.GroupingID = products.ProductID AND prod2.ProductLive <> 0) AS BottomPrice FROM products LEFT OUTER JOIN productcategories ON ProductCategoryID = CategoryID WHERE ProductLive <> 0 AND COALESCE((SELECT GroupingID FROM productoptions WHERE productoptions.ProductID = products.ProductID LIMIT 1), ProductID) = ProductID";
setQueryBuilderSource($query_WADAProducts,$WADbSearch2,false);
setQueryBuilderSource($query_WADAProducts,$WADbSearch1,false);
$query_WADAProducts.= preg_replace("/ AND /", " HAVING ", $WADbSearch2->whereClause, 1);
$query_limit_WADAProducts = sprintf("%s LIMIT %d, %d", $query_WADAProducts, $startRow_WADAProducts, $maxRows_WADAProducts);
$WADAProducts = mysql_query($query_limit_WADAProducts, $localhost) or die(mysql_error());
$row_WADAProducts = mysql_fetch_assoc($WADAProducts);

if (isset($_GET['totalRows_WADAProducts'])) {
$totalRows_WADAProducts = $_GET['totalRows_WADAProducts'];
} else {
$all_WADAProducts = mysql_query($query_WADAProducts);
$totalRows_WADAProducts = mysql_num_rows($all_WADAProducts);
}
$totalPages_WADAProducts = ceil($totalRows_WADAProducts/$maxRows_WADAProducts)-1;
?>
<?php
$queryString_WADAProducts = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_WADAProducts") == false &&
stristr($param, "totalRows_WADAProducts") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_WADAProducts = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_WADAProducts = sprintf("&totalRows_WADAProducts=%d%s", $totalRows_WADAProducts, $queryString_WADAProducts);
?>
<?php
// WA eCart Redirect
if ($WA_Store_Cart->redirStr != "") {
header("Location: ".$WA_Store_Cart->redirStr);
}
?>


Originally Said By: larsentim278054
  Okay I seem to be having more problems. I'm not sure when this started happening (I think it was when I added the quick cart, but I'm not sure). Now - when I select a category, it's not showing those results - it just shows all of them. and the quick cart in the right column -- it displayed the correct # of items - but the clear button doesn't work - it doesn't clear it (it does reload the page) - and the same with view cart button... Not working... Something is seriously wrong. What do you think it is?

Oh - and I inputed my recordset (which was WadaProducts) and the columnName i think was CategoryName - but when I entered that - it just displayed the last category, regardless of what category I was looking at. But that's probably because it's not showing the correct category's products - it is just showing all of them...  

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...