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

eCart - Dynamic Cart button NOT pulling data from database

Thread began 8/19/2012 10:28 am by tdinetta440961 | Last modified 8/20/2012 3:55 pm by tdinetta440961 | 752 views | 3 replies

tdinetta440961

Page Code

Hi Jason,
Here is the code. Also, Is there a way form me to attach file images to my posts if needed?

Thanks, Tony

<?php
//WA eCart Include
require_once("WA_eCart/eCart1_PHP.php");
?>
<?php require_once('Connections/MySQL_eCart.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;
}
}

mysql_select_db($database_MySQL_eCart, $MySQL_eCart);
$query_rsProduct = "SELECT * FROM items WHERE ItemID = 1 ORDER BY ItemID ASC";
$rsProduct = mysql_query($query_rsProduct, $MySQL_eCart) or die(mysql_error());
$row_rsProduct = mysql_fetch_assoc($rsProduct);
$totalRows_rsProduct = mysql_num_rows($rsProduct);
?>
<?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_rsProduct) && $totalRows_rsProduct > 0) {
$row_rsProduct = WAEC_findRecordMySQL($rsProduct, "ItemID", $ATC_itemID);
if ($row_rsProduct) {
$ATC_itemName = "".$row_rsProduct['ItemName'] ."";// column binding
$ATC_itemDescription = "".$row_rsProduct['ItemShortDesc'] ."";// column binding
$ATC_itemThumbnail = "".$row_rsProduct['ItemThumb'] ."";// column binding
$ATC_itemWeight = floatval("0");// column binding
$ATC_itemQuantity = "".$_POST["eCart1_1_Quantity_Add"] ."";// column binding
$ATC_itemPrice = floatval("".$row_rsProduct['ItemPrice'] ."");// column binding
mysql_data_seek($rsProduct, 0);
$row_rsProduct = mysql_fetch_assoc($rsProduct);
}
}
$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 eCart Redirect
if ($eCart1->redirStr != "") {
header("Location: ".$eCart1->redirStr);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<style type="text/css">
#apDiv1 {
position:absolute;
left:10px;
top:23px;
width:182px;
height:138px;
z-index:1;
}
#apDiv2 {
position:absolute;
left:7px;
top:19px;
width:133px;
height:64px;
z-index:1;
}
#apDiv3 {
position:absolute;
left:211px;
top:21px;
width:276px;
height:128px;
z-index:2;
}
</style>
</head>

<body>
<div id="apDiv2">
<form name="eCart1_1_ATC_<?php echo $row_rsProduct["ItemID"]; ?>" method="POST" action="<?php echo $_SERVER["PHP_SELF"]; ?><?php echo (isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != "")?"?".$_SERVER["QUERY_STRING"]:""; ?>">
<input type="hidden" name="eCart1_1_ID_Add" value="<?php echo $row_rsProduct["ItemID"]; ?>" >
<input type="text" name="eCart1_1_Quantity_Add" value="1" size="4" >
<input type="image" src="WA_eCart/Images/Pacifica/Btn4_EN_addtocart.gif" border="0" class="eC_ImageButton" value="Add to Cart" name="eCart1_1_ATC">
</form>
</div>
</body>
</html>
<?php
mysql_free_result($rsProduct);
?>

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