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