close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Main DWT Template

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

larsentim278054

Main DWT Template

Hi -

I added a quick cart to the right column1 of the main template for PowerStore v2.
When I save it - it now tells me that I've added something outside of the HTML and I need to add some template outside html locked code in the header.

Should I do this? I want the quick cart to be on the other pages I think. Would it not be there if I don't do this?

Sign in to reply to this post

Ray BorduinWebAssist

No don't change the template. It is because the cart object was added to the top of that page. I think the cart object is already on all of the subpages so you don't have to worry about the template... in fact be sure not to do that.

Sign in to reply to this post

larsentim278054

Okay - thanks..

Regarding the product category views.. When someone clicks on a category and it shows all the product listings in that category - I want to title that page with the product category name. What is the html or php text I would put in the h1 tag (or whatever I decide to use) to display the current category?

Thanks!

Also - to make it look nicer, is it possible to have it show an image depending on what category it's showing? So instead of an h1 tag, I'd like it to show... say Product Category 1 image if it's showing category 1's listings... I'm guessing that would take a little more work? Is this easy enough to do?

Originally Said By: Ray Borduin
  No don't change the template. It is because the cart object was added to the top of that page. I think the cart object is already on all of the subpages so you don't have to worry about the template... in fact be sure not to do that.  
Sign in to reply to this post

Ray BorduinWebAssist

I'm not familiar enough to tell you the code offhand. It should be available in one of the recordsets in the bindings panel. Most likely you can drag and drop it from there.

You would have to add a field to the category table to store an associated image.. and you would probably want to update the add a category page so that you could upload that image when you create the category. Easy is in the eye of the beholder.

Sign in to reply to this post

larsentim278054

That's not working for me. When I click on Recordsets in Bindings panel, I get this error:

MySQL Error#: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 2
---------------------

What should I do??


Originally Said By: Ray Borduin
  I'm not familiar enough to tell you the code offhand. It should be available in one of the recordsets in the bindings panel. Most likely you can drag and drop it from there.

You would have to add a field to the category table to store an associated image.. and you would probably want to update the add a category page so that you could upload that image when you create the category. Easy is in the eye of the beholder.  
Sign in to reply to this post

Ray BorduinWebAssist

it will use the syntax: <?php echo($row_RecordsetName['columnName']); ?>

You will have to look at the query and see if the column name is already available and if not you may even need to add an INNER JOIN to the sql statement to include the category name from the category table.

Sign in to reply to this post

larsentim278054

Are you saying to replace "columnName" with the column name in the table of the data that I want displayed? So if it was called CategoryName - it would be:

<?php echo($row_RecordsetName['CategoryName']); ?>

Right?

And if it's not already in the sql statement that's in that page, I'll have to add it using an inner join statement? Did I understand you correctly?

I don't know how to add that INNER JOIN statement you mentioned. You wouldn't happen to know the syntax for that, would you?

Sorry to be so much trouble.

Originally Said By: Ray Borduin
  it will use the syntax: <?php echo($row_RecordsetName['columnName']); ?>

You will have to look at the query and see if the column name is already available and if not you may even need to add an INNER JOIN to the sql statement to include the category name from the category table.  
Sign in to reply to this post

Ray BorduinWebAssist

What is the SQL statement it is currently using?

I would need that to suggest how to change it.

you would also replace "RecordsetName" with your recordset name in my example.

Sign in to reply to this post

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. oh and the checkout button doesn't do anything either... 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...

Originally Said By: Ray Borduin
  What is the SQL statement it is currently using?

I would need that to suggest how to change it.

you would also replace "RecordsetName" with your recordset name in my example.  
Sign in to reply to this post

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...  
Sign in to reply to this post
loading

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...