close ad
 
Important WebAssist Announcement
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 7:28 am by dallySP | Last modified 12/09/2013 10:52 am by dallySP | 5093 views | 13 replies

dallySP

Thats really helpful - thank you so much for your very comprehensive reply.
I've given it a go, but I think I've missed something or got some code snippet slightly wrong. My recordset is inventory. I'm looking up the record via the unique barcode (InvBarcode) and the Stock Field is InvInStock. I also called the url variable InvInStock. My code looks like this, but I'm getting a blank page in the browser. There are server behavious after this in the code, but when I strip this code chunk out the page still works, so I'm guessing its in here somewhere:

<?php
while (!$OkeefeCart->EOF()) {
?>
<?php
$BarcodeParam_rsInventory = "-1";
if (isset($OkeefeCart->DisplayInfo("Barcode"))) {
$BarcodeParam_rsInventory = (get_magic_quotes_gpc()) ? $OkeefeCart->DisplayInfo("Barcode") : addslashes($OkeefeCart->DisplayInfo("Barcode"));
}
mysql_select_db($database_cmsconn, $cmsconn);
$query_rsInventory = sprintf("SELECT * FROM inventory WHERE inventory.InvBarcode = %s", GetSQLValueString($BarcodeParam_rsInventory, "int"));
$rsInventory = mysql_query($query_rsInventory, $cmsconn) or die(mysql_error());
$row_rsInventory = mysql_fetch_assoc($rsInventory);
$totalRows_rsInventory = mysql_num_rows($rsInventory);?>
<?php $_GET['InvInStock'] = ($row_rsInventory['InvInStock'] - $OkeefeCart->DisplayInfo("Quantity")); ?>

<?php
// WA Application Builder Update
if (!$OkeefeCart->IsEmpty()) // Trigger
{
$WA_connection = $cmsconn;
$WA_table = "inventory";
$WA_redirectURL = "";
if (function_exists("rel2abs")) $WA_redirectURL = $WA_redirectURL?rel2abs($WA_redirectURL,dirname(__FILE__)):"";
$WA_keepQueryString = false;
$WA_indexField = "InvBarcode";
$WA_fieldNamesStr = "InvInStock";
$WA_fieldValuesStr = "".$_GET['InvInStock'] ."";
$WA_columnTypesStr = "none,none,NULL";
$WA_comparisonStr = "=";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);

$WA_where_fieldValuesStr = "".$OkeefeCart->DisplayInfo("Barcode") ."";
$WA_where_columnTypesStr = "',none,''";
$WA_where_comparisonStr = "=";
$WA_where_fieldNames = explode("|", $WA_indexField);
$WA_where_fieldValues = explode("|", $WA_where_fieldValuesStr);
$WA_where_columns = explode("|", $WA_where_columnTypesStr);
$WA_where_comparisons = explode("|", $WA_where_comparisonStr);

$WA_connectionDB = $database_cmsconn;
mysql_select_db($WA_connectionDB, $WA_connection);
if (!session_id()) 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
$OkeefeCart->MoveNext();
}
$OkeefeCart->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...