close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

eCart product options (older)

Thread began 3/15/2010 3:59 am by julie.skelton390139 | Last modified 5/13/2010 5:51 pm by julie.skelton390139 | 5782 views | 39 replies

julie.skelton390139

Sorry I must have missed that my post had been moved so have only just found your reply.

I am still confused! I don't understand when you say about having a recordset that filters by the id of the size? Is this by the urlparameter??? and is this on the product details page or the cart page?

My recordset code is as follows:

<?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;
}
}

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;
}
}

$colname_prints = "-1";
if (isset($_GET['ProductID'])) {
$colname_prints = (get_magic_quotes_gpc()) ? $_GET['ProductID'] : addslashes($_GET['ProductID']);
}
mysql_select_db($database_framed, $framed);
$query_prints = sprintf("SELECT * FROM products WHERE ProductID = %s", GetSQLValueString($colname_prints, "int"));
$prints = mysql_query($query_prints, $framed) or die(mysql_error());
$row_prints = mysql_fetch_assoc($prints);
$totalRows_prints = mysql_num_rows($prints);

$paramOptionID_optionsframed = "-1";
if (isset($_GET['ProductID'])) {
$paramOptionID_optionsframed = (get_magic_quotes_gpc()) ? $_GET['ProductID'] : addslashes($_GET['ProductID']);
}
mysql_select_db($database_framed, $framed);
$query_optionsframed = sprintf("SELECT options.* FROM options INNER JOIN productoptions ON options.OptionID = productoptions.OptionID WHERE options.OptionGroupID = 1 AND productoptions.ProductID = %s", GetSQLValueString($paramOptionID_optionsframed, "int"));
$optionsframed = mysql_query($query_optionsframed, $framed) or die(mysql_error());
$row_optionsframed = mysql_fetch_assoc($optionsframed);
$totalRows_optionsframed = mysql_num_rows($optionsframed);

$colname_productoptions = "-1";
if (isset($_GET['ProductID'])) {
$colname_productoptions = (get_magic_quotes_gpc()) ? $_GET['ProductID'] : addslashes($_GET['ProductID']);
}
mysql_select_db($database_framed, $framed);
$query_productoptions = sprintf("SELECT * FROM productoptions WHERE ProductID = %s", GetSQLValueString($colname_productoptions, "int"));
$productoptions = mysql_query($query_productoptions, $framed) or die(mysql_error());
$row_productoptions = mysql_fetch_assoc($productoptions);
$totalRows_productoptions = mysql_num_rows($productoptions);
?>


I don't know if any of the above is correct, especially the bit about joining the tables as this was taken from another forum thread when I was following a different route. I have tried setting the bindings of the add to cart price column to the field I added to the size options table - this field is called PriceIncrements (although now it is the actual price rather than an addition to the base price). I then went into my ecart options and on the calculations I have changed the TotalPrice to read [PriceIncrement] * [Quantity] - I have the same recordsets in my cart page (I think!) see following:

<?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;
}
}

$colname_photosales = "-1";
if (isset($_GET['ProductID'])) {
$colname_photosales = (get_magic_quotes_gpc()) ? $_GET['ProductID'] : addslashes($_GET['ProductID']);
}
mysql_select_db($database_framed, $framed);
$query_photosales = sprintf("SELECT * FROM products WHERE ProductID = %s", GetSQLValueString($colname_photosales, "int"));
$photosales = mysql_query($query_photosales, $framed) or die(mysql_error());
$row_photosales = mysql_fetch_assoc($photosales);
$totalRows_photosales = mysql_num_rows($photosales);

$colname_productoptions = "-1";
if (isset($_GET['ProductOptionID'])) {
$colname_productoptions = (get_magic_quotes_gpc()) ? $_GET['ProductOptionID'] : addslashes($_GET['ProductOptionID']);
}
mysql_select_db($database_framed, $framed);
$query_productoptions = sprintf("SELECT * FROM productoptions WHERE ProductOptionID = %s", GetSQLValueString($colname_productoptions, "int"));
$productoptions = mysql_query($query_productoptions, $framed) or die(mysql_error());
$row_productoptions = mysql_fetch_assoc($productoptions);
$totalRows_productoptions = mysql_num_rows($productoptions);
?>
<?php
// WA eCart Update
if (isset($_POST["eCart1_Update_100"]) || isset($_POST["eCart1_Update_100_x"])) {
$eCart1->UpdateCart();
$Redirect_redirStr="";
if ($Redirect_redirStr != "") {
$eCart1->redirStr = $Redirect_redirStr;
}
$eCart1->cartAction = "Update";
}
?>


However no price is being taken over to the cart page it is displaying as £0 and also the size is not displaying in the cart? Please help! Getting really lost in this and need a solution quickly.

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