close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

using store details trigger save items with specific category into database

Thread began 4/26/2018 9:31 am by ccdantas101117 | Last modified 4/26/2018 1:21 pm by Ray Borduin | 23 views | 3 replies |

ccdantas101117

using store details trigger save items with specific category into database

BELOW CODE ON THE CONFIRM PAGE. IT WILL WORK?

<?php
// WA eCart Store Cart Details in Db
if (($_SERVER["REQUEST_METHOD"] == "POST") && (isset($_SERVER["HTTP_REFERER"]) && strpos(urldecode($_SERVER["HTTP_REFERER"]), urldecode($_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"])) > 0) && isset($_POST) && $pjCart->DisplayInfo("Category")==6) // Trigger
{
$WA_connection = $pjdbcon;
$WA_table = "tablename";
$WA_redirectURL = "";
$WA_indexField = "idord_don";
$WA_fieldNamesStr = "idord_don|idcau_don|idcst_don|idusr_don|tokenid_don|firstname_don|lastname_don|business_don|email_don|amount_don|unknown_don|showslide_don";
$WA_fieldValuesStr = WA_eCDB_ConvertNumber("".((isset($_SESSION["pjCart_OrderID"]))?$_SESSION["pjCart_OrderID"]:"") ."") . "|" . WA_eCDB_ConvertNumber("".$pjCart->DisplayInfo("Typecause") ."") . "|" . WA_eCDB_ConvertNumber("".$pjCart->DisplayInfo("Cause") ."") . "|" . WA_eCDB_ConvertNumber("".((isset($_SESSION["kt_login_id"]))?$_SESSION["kt_login_id"]:"") ."") . "|" . "".$pjCart->DisplayInfo("Tokenid") ."" . "|" . "".((isset($_POST["firstname"]))?$_POST["firstname"]:"") ."" . "|" . "".((isset($_POST["lastname"]))?$_POST["lastname"]:"") ."" . "|" . "".((isset($_POST["businessname"]))?$_POST["businessname"]:"") ."" . "|" . "".((isset($_POST["email"]))?$_POST["email"]:"") ."" . "|" . WA_eCDB_ConvertNumber("".$pjCart->DisplayInfo("Price") ."") . "|" . WA_eCDB_ConvertNumber("".$pjCart->DisplayInfo("Anonymous") ."") . "|" . WA_eCDB_ConvertNumber("".$pjCart->DisplayInfo("Showslide") ."");
$WA_columnTypesStr = "none,none,NULL|none,none,NULL|none,none,NULL|none,none,NULL|',none,''|',none,''|',none,''|',none,''|',none,''|none,none,NULL|none,none,NULL|none,none,NULL";
$WA_sql = "";
mysql_select_db($database_pjdbcon, $WA_connection);
$indexFieldIndex = -1;
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
if (!session_id()) session_start();
if ($WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos('?', $WA_redirectURL) === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
for ($i = 0; $i < sizeof($WA_fieldNames); $i++)
{
if ($WA_indexField == $WA_fieldNames[$i])
{
$indexFieldIndex = $i;
break;
}
}
$deleteFieldValue = $WA_fieldValues[$indexFieldIndex];
if (isset($deleteFieldValue) && $deleteFieldValue != "")
{
$deleteParamsObj = WA_generateInsertParams(array($WA_indexField), array($WA_columns[$indexFieldIndex]), array($deleteFieldValue), -1);
$WA_sql = "Delete from " . $WA_table . " where " . $WA_indexField . " = " . $deleteParamsObj->WA_dbValues;
$WA_editCmd = mysql_query($WA_sql, $WA_connection) or die(mysql_error());
$WA_okToDelete = false;
}
$pjCart->MoveFirst();
while (!$pjCart->EOF())
{
$WA_fieldValuesStr = WA_eCDB_ConvertNumber("".$_SESSION['pjCart_OrderID'] ."") . "|" . WA_eCDB_ConvertNumber("".$pjCart->DisplayInfo("Typecause") ."") . "|" . WA_eCDB_ConvertNumber("".$pjCart->DisplayInfo("Cause") ."") . "|" . WA_eCDB_ConvertNumber("".$_SESSION['kt_login_id'] ."") . "|" . "".$pjCart->DisplayInfo("Tokenid") ."" . "|" . "".((isset($_POST["firstname"]))?$_POST["firstname"]:"") ."" . "|" . "".((isset($_POST["lastname"]))?$_POST["lastname"]:"") ."" . "|" . "".((isset($_POST["businessname"]))?$_POST["businessname"]:"") ."" . "|" . "".((isset($_POST["email"]))?$_POST["email"]:"") ."" . "|" . WA_eCDB_ConvertNumber("".$pjCart->DisplayInfo("Price") ."") . "|" . WA_eCDB_ConvertNumber("".$pjCart->DisplayInfo("Anonymous") ."") . "|" . WA_eCDB_ConvertNumber("".$pjCart->DisplayInfo("Showslide") ."");
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$insertParamsObj = WA_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WA_sql = "insert into ".$WA_table." (".$insertParamsObj->WA_tableValues.") values (".$insertParamsObj->WA_dbValues.")";
$WA_editCmd = mysql_query($WA_sql, $WA_connection) or die(mysql_error());
$pjCart->MoveNext();
}
if ($WA_redirectURL != "") {
header("Location: ".$WA_redirectURL); exit;
}
$pjCart->MoveFirst();
}
?>

Sign in to reply to this post

Ray BorduinWebAssist

No that won't work... you would need to hand edit and add the IF statement into the loop. So use a normal trigger:

if (($_SERVER["REQUEST_METHOD"] == "POST") && (isset($_SERVER["HTTP_REFERER"]) && strpos(urldecode($_SERVER["HTTP_REFERER"]), urldecode($_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"])) > 0) && isset($_POST)) // Trigger

Then later in the while loop wrap the line that does the insert with the category check like:

if ($pjCart->DisplayInfo("Category")==6) {
$WA_editCmd = mysql_query($WA_sql, $WA_connection) or die(mysql_error());
}

Sign in to reply to this post

ccdantas101117

Ray Thanks, please see if it is on the correct place please

I place it where if found match execute the query.

$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$insertParamsObj = WA_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WA_sql = "insert into ".$WA_table." (".$insertParamsObj->WA_tableValues.") values (".$insertParamsObj->WA_dbValues.")";
if ($pjCart->DisplayInfo("Category")==6) {
$WA_editCmd = mysql_query($WA_sql, $WA_connection) or die(mysql_error());
}
$pjCart->MoveNext();

Sign in to reply to this post

Ray BorduinWebAssist

yes that looks correct

Sign in to reply to this post

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