close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

data assist ecart & search

Thread began 11/17/2009 11:02 am by chaintm153675 | Last modified 11/19/2009 2:25 pm by chaintm153675 | 1491 views | 5 replies |

chaintm153675

data assist ecart & search

When using the below code and attempting to add a cart button, it seems to mess up the whole process. Concept here is simple, I need to add a search to a page like this...

===============================================
product_search.php

to pages that have the cart like this...

product_moonjump_gen.php

however this is the page done so and errors...

product_searchtmp.php

===============================================

which currently supports the ecart system. However, if I attempt to add a search function to this using data assist. I get nothing but errors, so then I went ahead and below started fresh with the search first then adding the cart next. From what I can tell, it seems that the cart doesn't like the fact I am using a search function within the recordset that is changed from your standard recordset. While I thought about using a different recordset, the issue then would be how to ID that with the colums and rows which as you know you can't do. So in this, how do I tie a cart to a search result? Is that even possible with webassist products? If not, I guess this means hardcoding?

Here are some pages you can look at that have the search feild intact, please ignore the graphics as well for obvious reason, search box is on top right, just enter anything and press enter. I want that type of searching (got the indexing and paging down) but with the above mentioned add item to cart button. Seems farly simple, but sadly nothing but issues.
I will be adding this search feature throughout this site.

Sign in to reply to this post

Jason ByrnesWebAssist

There are no pages attached to your post.


can you provide the text of the errors you are running into?

and a copy if the page where the errors occur.

Sign in to reply to this post

chaintm153675

well the code for each page is large, not sure what pages are not showing? You mean the one with the error? ya, it just lockes up sadly.. and this forum has limits beyond text, but for your access here is a new link with the text copy of the code.


code.txt

Sign in to reply to this post

chaintm153675

attached is some files in zip, you forums sadly is very limiting to posting stuff. So if you need certain files let me know, IE if you want a dump or a copy of scripts whatever.

product_ride.php works fine as is, that is currently whats on the site.

product_search.php has the issue after adding a cart.

product_searchbck.php has no issue when searching but has no cart.

product_searchtmp.php you know, i don't know whats on that, probably an older build but it might help by referance.

the current page... product_search.php actually on site atm works as i want the search to work, the product_search.php you have is after adding the cart, it just fubars the whole thing, also as many have posted here, when u attempt to change , add or do anything to the recordset you sometimes get the "cant change the recordset" but if you do the search first and cart addition second you can change it then but ofcourse it doesn't work because the code within is tied togather. IE the


SELECT *
FROM items
WHERE ItemName LIKE ""
ORDER BY ItemName ASC

which ofcourse dreamweaver hates. Eh, if you need any info or want to talk on the phone, im at work till 6pmcst.

Attached Files
web.zip
Sign in to reply to this post

Jason ByrnesWebAssist

I dont understand what you mean by "it just fubars the whole thing".

Does the page not run in the browser?


Do you get an error message?


can you give some mode details beyond "it just fubars the whole thing" so I can understand the issue you are experiencing to try and offer a solution.


please be as descriptive as possible. Also if you could upload the problem page to the server so I could see the issue in a browser, that would be helpful.

Sign in to reply to this post

chaintm153675

===========================
Found the issue and fixed.

The script is not placing the cart php data tie in correctly. It puts it in the location that you you select to put the "add cart button" so a section. Moving the
==============================
<?php
//WA eCart Include
require_once("WA_eCart/MoonJumpCart_PHP.php");
?>
===============
to the top of the page above the
==============
<?php
$MoonJumpCart->GetContent();
?>
====================
solved this issue, don't know why I kept missing this. so in the end...

my script looks like this now...
=====================
<?php require_once('Connections/mjconn.php'); ?>
<?php
//WA eCart Include
require_once("WA_eCart/MoonJumpCart_PHP.php");
?>
<?php
$MoonJumpCart->GetContent();
?>
<?php
//WA Database Search Include
require_once("WADbSearch/HelperPHP.php");
?>
<?php
//WA Database Search (Copyright 2005, WebAssist.com)
//Recordset: mjrslistprod;
//Searchpage: ;
//Form: ;
$WADbSearch1_DefaultWhere = "";
if (!session_id()) session_start();
if ((((isset($_POST["search"]))?$_POST["search"]:"") != "")) {
$WADbSearch1 = new FilterDef;
$WADbSearch1->initializeQueryBuilder("MYSQL","1");
//keyword array declarations
$KeyArr1 = array("ItemName");

//comparison list additions
$WADbSearch1->keywordComparison($KeyArr1,"".((isset($_POST["search"]))?$_POST["search"]:"") ."","OR","Includes",",%20","%20","%22","%22",0);

//save the query in a session variable
if (1 == 1) {
$_SESSION["WADbSearch1_product_search"]=$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_product_search"]) && $_SESSION["WADbSearch1_product_search"] != "") {
$WADbSearch1->whereClause = $_SESSION["WADbSearch1_product_search"];
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
$WADbSearch1->whereClause = str_replace("\\''", "''", $WADbSearch1->whereClause);
$WADbSearch1whereClause = '';
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$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;
}
}

$currentPage = $_SERVER["PHP_SELF"];

$maxRows_mjrslistprod = 6;
$pageNum_mjrslistprod = 0;
if (isset($_GET['pageNum_mjrslistprod'])) {
$pageNum_mjrslistprod = $_GET['pageNum_mjrslistprod'];
}
$startRow_mjrslistprod = $pageNum_mjrslistprod * $maxRows_mjrslistprod;

mysql_select_db($database_mjconn, $mjconn);
$query_mjrslistprod = "SELECT * FROM items";
setQueryBuilderSource($query_mjrslistprod,$WADbSearch1,false);
$query_limit_mjrslistprod = sprintf("%s LIMIT %d, %d", $query_mjrslistprod, $startRow_mjrslistprod, $maxRows_mjrslistprod);
$mjrslistprod = mysql_query($query_limit_mjrslistprod, $mjconn) or die(mysql_error());
$row_mjrslistprod = mysql_fetch_assoc($mjrslistprod);

if (isset($_GET['totalRows_mjrslistprod'])) {
$totalRows_mjrslistprod = $_GET['totalRows_mjrslistprod'];
} else {
$all_mjrslistprod = mysql_query($query_mjrslistprod);
$totalRows_mjrslistprod = mysql_num_rows($all_mjrslistprod);
}
$totalPages_mjrslistprod = ceil($totalRows_mjrslistprod/$maxRows_mjrslistprod)-1;

$queryString_mjrslistprod = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_mjrslistprod") == false &&
stristr($param, "totalRows_mjrslistprod") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_mjrslistprod = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_mjrslistprod = sprintf("&totalRows_mjrslistprod=%d%s", $totalRows_mjrslistprod, $queryString_mjrslistprod);
?>
<?php
// WA eCart AddToCart
if (isset($_POST["MoonJumpCart_1_ATC"]) || isset($_POST["MoonJumpCart_1_ATC_x"])) {
$ATC_itemID = $_POST["MoonJumpCart_1_ID_Add"];
$ATC_AddIfIn = 0;
$ATC_RedirectAfter = "cart.php";
$ATC_RedirectIfIn = "";
if (isset($totalRows_mjrslistprod) && $totalRows_mjrslistprod > 0) {
$row_mjrslistprod = WAEC_findRecordMySQL($mjrslistprod, "ItemID", $ATC_itemID);
if ($row_mjrslistprod) {
$ATC_itemName = "".$row_mjrslistprod['ItemName'] ."";// column binding
$ATC_itemDescription = "".$row_mjrslistprod['ItemShortDesc'] ."";// column binding
$ATC_itemWeight = floatval("".$row_mjrslistprod['ItemWeight'] ."");// column binding
$ATC_itemQuantity = "".$_POST["MoonJumpCart_1_Quantity_Add"] ."";// column binding
$ATC_itemPrice = floatval("".$row_mjrslistprod['ItemPrice'] ."");// column binding
$ATC_itemSize = "".$row_mjrslistprod['ItemSize'] ."";// column binding
$ATC_itemThumbpic = "".$row_mjrslistprod['ItemThumb'] ."";// column binding
mysql_data_seek($mjrslistprod, 0);
$row_mjrslistprod = mysql_fetch_assoc($mjrslistprod);
}
}
$ATC_itemQuantity = floatval($ATC_itemQuantity);
if (is_numeric($ATC_itemQuantity) && $ATC_itemQuantity != 0) {
$MoonJumpCart->AddToCart($ATC_AddIfIn, $ATC_RedirectIfIn, $ATC_itemID, $ATC_itemName, $ATC_itemDescription, $ATC_itemWeight, $ATC_itemQuantity, $ATC_itemPrice, $ATC_itemSize, $ATC_itemThumbpic);
if ($ATC_RedirectAfter != "" && $MoonJumpCart->redirStr == "") {
$MoonJumpCart->redirStr = $ATC_RedirectAfter;
}
if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] != "") {
$_SESSION['WAEC_ContinueRedirect'] = $_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING'];
}
else {
$_SESSION['WAEC_ContinueRedirect'] = $_SERVER['PHP_SELF'];
}
}
}
?>
<?php
// WA eCart Redirect
if ($MoonJumpCart->redirStr != "") {
header("Location: ".$MoonJumpCart->redirStr);
}
?>


=================================
Which is correct and works perfectly.
==========================

Sign in to reply to this post

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