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

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Updating stock from checkout success page

Thread began 3/08/2012 10:28 am by dallySP | Last modified 12/09/2013 1:52 pm by dallySP | 1811 views | 13 replies

Dave W

Hi Jason,
Wondering if you can help.
I am using the latest version of Ecart 5, my poroducts list is called "items" and the stock availability in items is called "available". The code is on the confirm page and the payment gateway is PayPal Standard.
I have followed the code above (including the small change you made) but I am get two problems.
Firstly when going to the confirm with a product in the cart I get the following error:
Notice: Undefined property: eCart1_ItemDefinition::$available in C:\vhosts\cuteascandy\WA_eCart\WA_eCart_Definition_PHP.php(119) : eval()'d code on line 1
Secondly the "available" column in the items table was set to 20 available, but after it goes to the confirm page it shows -1.
My code block is below.
Hope you can help.
Dave

<?php
while (!$eCart1->EOF()) {
$_GET['available'] = $eCart1->DisplayInfo("available"); ?>
<?php
$var1_getAvailable = "-1";
if (isset($_GET['available'])) {
$var1_getAvailable = $_GET['available'];
}
mysql_select_db($database_dbCute, $dbCute);
$query_getAvailable = sprintf("SELECT ItemID, available FROM items WHERE items.ItemID=%s", GetSQLValueString($var1_getAvailable, "int"));
$getAvailable = mysql_query($query_getAvailable, $dbCute) or die(mysql_error());
$row_getAvailable = mysql_fetch_assoc($getAvailable);
$totalRows_getAvailable = mysql_num_rows($getAvailable);?>
<?php $_GET['available'] = ($row_getAvailable['available'] - $eCart1->DisplayInfo("Quantity")); ?>
<?php
// WA DataAssist Update
if ($_SERVER["REQUEST_METHOD"] == "POST") // Trigger
{
$WA_connection = $dbCute;
$WA_table = "items";
$WA_redirectURL = "";
if (function_exists("rel2abs")) $WA_redirectURL = $WA_redirectURL?rel2abs($WA_redirectURL,dirname(__FILE__)):"";
$WA_keepQueryString = false;
$WA_indexField = "ItemID";
$WA_fieldNamesStr = "available";
$WA_fieldValuesStr = "".$_GET['available'] ."";
$WA_columnTypesStr = "none,none,NULL";
$WA_comparisonStr = "=";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode($WA_AB_Split, $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);

$WA_where_fieldValuesStr = "".$eCart1->DisplayInfo("ID") ."";
$WA_where_columnTypesStr = "none,none,NULL";
$WA_where_comparisonStr = "=";
$WA_where_fieldNames = explode("|", $WA_indexField);
$WA_where_fieldValues = explode($WA_AB_Split, $WA_where_fieldValuesStr);
$WA_where_columns = explode("|", $WA_where_columnTypesStr);
$WA_where_comparisons = explode("|", $WA_where_comparisonStr);

$WA_connectionDB = $database_dbCute;
mysql_select_db($WA_connectionDB, $WA_connection);
@session_start();
$updateParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WhereObj = WA_AB_generateWhereClause($WA_where_fieldNames, $WA_where_columns, $WA_where_fieldValues, $WA_where_comparisons );
$WA_Sql = "UPDATE `" . $WA_table . "` SET " . $updateParamsObj->WA_setValues . " WHERE " . $WhereObj->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
$eCart1->MoveNext();
}
$eCart1->MoveFirst();
?>

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