close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Add to cart help

Thread began 2/02/2011 9:02 am by sabastian130416448 | Last modified 2/04/2011 9:45 am by Jason Byrnes | 1015 views | 5 replies |

sabastian130416448

Add to cart help

Hey guys.

I bought Data Assist With the Dynamic Suit. I have created my product_result and product_detail pages and everything is working great.

The problem I know have is this. When I add a "Add to Cart" button, I am using Ecart 5.0.3,
and I test the page every time I go to view cart it keeps on telling me the cart is empty.

My page above the <head> tag looks like this.

<?php
//WA eCart Include
require_once("../WA_eCart/eCart1_PHP.php");
?>
<?php require_once('../Connections/Shop.php'); ?>
<?php require_once("../WA_DataAssist/WA_AppBuilder_PHP.php"); ?>
<?php
$eCart1->GetContent();
?>
<?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;
}
}
?>
<?php
if (!session_id()) session_start();
?>
<?php
$Paramid_tb_WADAcastaic = "-1";
if (isset($_GET['id_tb'])) {
$Paramid_tb_WADAcastaic = (get_magic_quotes_gpc()) ? $_GET['id_tb'] : addslashes($_GET['id_tb']);
}
$ParamSessionid_tb_WADAcastaic = "-1";
if (isset($_SESSION['WADA_Insert_castaic'])) {
$ParamSessionid_tb_WADAcastaic = (get_magic_quotes_gpc()) ? $_SESSION['WADA_Insert_castaic'] : addslashes($_SESSION['WADA_Insert_castaic']);
}
$Paramid_tb2_WADAcastaic = "-1";
if (isset($_GET['id_tb'])) {
$Paramid_tb2_WADAcastaic = (get_magic_quotes_gpc()) ? $_GET['id_tb'] : addslashes($_GET['id_tb']);
}
mysql_select_db($database_Shop, $Shop);
$query_WADAcastaic = sprintf("SELECT id_tb, name_tb, desc_tb, price_tb, image_tb, link_tb, keywords_tb, group_tb, fulldesc_tb, fulldesc2_tb FROM castaic WHERE id_tb = %s OR ( -1= %s AND id_tb= %s)", GetSQLValueString($Paramid_tb_WADAcastaic, "int"),GetSQLValueString($Paramid_tb2_WADAcastaic, "int"),GetSQLValueString($ParamSessionid_tb_WADAcastaic, "int"));
$WADAcastaic = mysql_query($query_WADAcastaic, $Shop) or die(mysql_error());
$row_WADAcastaic = mysql_fetch_assoc($WADAcastaic);
$totalRows_WADAcastaic = mysql_num_rows($WADAcastaic);?>
<?php
// WA eCart AddToCart
if (isset($_POST["eCart1_1_ATC"]) || isset($_POST["eCart1_1_ATC_x"])) {
$ATC_itemID = $_POST["eCart1_1_ID_Add"];
$ATC_AddIfIn = 0;
$ATC_RedirectAfter = "";
$ATC_RedirectIfIn = "";
if (isset($totalRows_WADAcastaic) && $totalRows_WADAcastaic > 0) {
$row_WADAcastaic = WAEC_findRecordMySQL($WADAcastaic, "id_tb", $ATC_itemID);
if ($row_WADAcastaic) {
$ATC_itemName = "".$row_WADAcastaic['name_tb'] ."";// column binding
$ATC_itemDescription = "".$row_WADAcastaic['desc_tb'] ."";// column binding
$ATC_itemThumbnail = "";// column binding
$ATC_itemWeight = floatval("0");// column binding
$ATC_itemQuantity = "".$_POST["eCart1_1_Quantity_Add"] ."";// column binding
$ATC_itemPrice = floatval("".$row_WADAcastaic['price_tb'] ."");// column binding
mysql_data_seek($WADAcastaic, 0);
$row_WADAcastaic = mysql_fetch_assoc($WADAcastaic);
}
}
$ATC_itemQuantity = floatval($ATC_itemQuantity);
if (is_numeric($ATC_itemQuantity) && $ATC_itemQuantity != 0) {
$eCart1->AddToCart($ATC_AddIfIn, $ATC_RedirectIfIn, $ATC_itemID, $ATC_itemName, $ATC_itemDescription, $ATC_itemThumbnail, $ATC_itemWeight, $ATC_itemQuantity, $ATC_itemPrice);
if ($ATC_RedirectAfter != "" && $eCart1->redirStr == "") {
$eCart1->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 Application Builder Delete
if (isset($_POST["Delete_x"])) // Trigger
{
$WA_connection = $Shop;
$WA_table = "castaic";
$WA_redirectURL = "castaic_Results.php";
if (function_exists("rel2abs")) $WA_redirectURL = $WA_redirectURL?rel2abs($WA_redirectURL,dirname(__FILE__)):"";
$WA_keepQueryString = false;
$WA_fieldNamesStr = "id_tb";
$WA_columnTypesStr = "none,none,NULL";
$WA_fieldValuesStr = "".((isset($_POST["WADADeleteRecordID"]))?$_POST["WADADeleteRecordID"]:"") ."";
$WA_comparisonStr = "=";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_comparisions = explode("|", $WA_comparisonStr);
$WA_connectionDB = $database_Shop;
mysql_select_db($WA_connectionDB, $WA_connection);
if (!session_id()) session_start();
$deleteParamsObj = WA_AB_generateWhereClause($WA_fieldNames, $WA_columns, $WA_fieldValues, $WA_comparisions);
$WA_Sql = "DELETE FROM `" . $WA_table . "` WHERE " . $deleteParamsObj->sqlWhereClause;
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
if ($WA_redirectURL != "") {
if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
header("Location: ".$WA_redirectURL);
}
}
?>
<?php
// WA eCart Redirect
if ($eCart1->redirStr != "") {
session_commit();
header("Location: ".$eCart1->redirStr);
}
?>

Before I was using Ecart 5.0.2 and I added my product_id manually but now that I want to get the Info from the database to populate it automatically it doesn't want to work.

Can anybody please give me some advice on how to fix my problem.

Thanx

Sign in to reply to this post

Jason ByrnesWebAssist

First, we need to make sure that your server is properly set to store session information.

use the sessionTest page from the following post to test the servers session management settings;
showpost.php?p=23826&postcount=2


If yoou are still having a problem, please compress the page into a zip archive and send the zip file instead of pasting the code into the message, also if you could provide a link where i could see the problem, that would be helpfull.

Sign in to reply to this post

sabastian130416448

Hallo Jason.

I did the test and I am sending two screen captures with to show you what happen when I press the two links. They seem to be workin fine.

I uploaded the page you requested as I am still working on the site on my pc. The link is
castaic_Detail.php

I also am sending the page in a zip file like you asked.

I hope there isn't a major problem.

Thanx

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

Jason ByrnesWebAssist

try changing:

php:
<?php

// WA eCart Redirect
if ($eCart1->redirStr != "")     {
  
header("Location: ".$eCart1->redirStr);
}
?>




to:

php:
<?php

// WA eCart Redirect
if ($eCart1->redirStr != "")     {
  
session_commit();
  
header("Location: ".$eCart1->redirStr);
}
?>
Sign in to reply to this post

sabastian130416448

Hey Jason.

Got the problem fixed.

Had two e-carts and the buttons and my cart page weren't linked to the same one.

Thanx

Sign in to reply to this post

Jason ByrnesWebAssist

Ok, Glad to hear it is working.

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