MX Kollection Forum :: Email Page Section Dynamic Address
This thread was displayed: 0 times
Starting with 17th May 2007, Adobe Systems will stop offering support for any version of the discontinued InterAKT products. As a result, we will not answer to new support incidents starting with May 17th, 2007. Pending support incidents will still be followed in order to be closed. The product forums will remain open and be transformed in user-to-user forums. The general forums will be made read-only and not allow new posts or comments.
For more information about the affected products visit: www.interaktonline.com/Support/
Timespider
10-26-2009 02:27:06 GMT +2
|
Hello, hope someone still answers here.
Any way, i have applied the send page section by email & it all works fine except it will only accecpt a static address like me@mysite.com but I want it from the data base as well as its a receipt. The value exixts in the data base as it is sent wiyh the static email & i've test that it exists. but the email trigger won't pick it up. An Ideas?
<?php
$sectemailObj = new tNG_EmailPageSection();
$sectemailObj->getCSSFrom(__FILE__);
$sectemailObj->setTo({rsOrder.email_ord}me@mysite.com);
$sectemailObj->setFrom("theteam@onlinemotorcycles.co.nz");
$sectemailObj->setSubject("Order Confirmation From Online Motorcycles");
$sectemailObj->setFormat("HTML/Text");
$sectemailObj->setEncoding("ISO-8859-1");
$sectemailObj->setImportance("Normal");
$sectemailObj->BeginContent();
?>
Thanks for any help
|
|
|
Fred at ExelWebs.com
10-26-2009 11:15:42 GMT +2
|
Did you create a recordset filtered by the kt_login_id to get the email address?
If so then it should be as simple as clicking the lightning bolt next to the "to" field to insert the dynamic data.
If you used the email address as the username, you can insert {SESSION.kt_login_user} in the "To" field and it should work.
|
|
|
Timespider
10-26-2009 12:18:36 GMT +2
|
Hi Fred, I don't want to use the login session as the site will send a receipt when also not logged in. Its for a cart checkout.
It just seems weird that it won't pick up these addresses in the wizard but at the same time send it in the body of the email well the page section, so you can see it exists, & everything that's sent in the email is pulled from the same recordset including this address. Ive tried rebuilding the trigger but still nothing. At least at present it does send the important hard coded email to the site owner for processing but I really need a confirmation sent along with it. Any other ideas?
Thanks Chris
|
|
|
Lee Reynolds
10-26-2009 15:13:33 GMT +2
|
I can't tell you whether this will work or not work, but you might try creating a unique recordset specifically to get this value for this instance (you can even duplicate rsOrder and call it rsOrder2). I don't know why, but often -- in PHP (CF I've never had to worry about) -- if I've used results from a recordset, I can't use them again on the same page. Duplicating the RS has always worked.
HTH -LR
|
|
|
Fred at ExelWebs.com
10-26-2009 15:17:03 GMT +2
|
The sequence in what things are happening and being defined are very important in php.It could be that by the time the transaction is executed the email address is not available as a variable anymore.
Try setting the email as a variable;
$email = {rsOrder.email_ord}
and then use a global variable in the SB
{GLOBALS.$email}
|
|
|
Timespider
10-26-2009 23:28:44 GMT +2
|
Hi Fred, could you explain the approach with global a bit more. I have tried Lee Reynolds idea below with the extra record set but thats not working either.
Thanks Chris
|
|
|
Fred at ExelWebs.com
10-27-2009 11:49:05 GMT +2
|
Hi Chris
You will need to do a bit of hand coding to achive this.
I don't know what your code looks like but what is probably happening is that the value of {rsOrder.email_ord} is outside the scope of the SB. In other words your page "forgets" the value and can not use it in the SB.
By setting a new variable equal to the value of {rsOrder.email_ord} ,while you still have the value, you can retain the value.
i.e. at some point in the page where you are able to echo {GLOBALS.$email} on the page just add $email = {GLOBALS.$email};
Now the value is in the $email variable.
To use this variable in other section of the page where it usually will not be available you use it in this format {GLOBALS.$email}
So create your "Send page section" SB and switch to code view and set the "To" value as {GLOBALS.$email}
|
|
|
Timespider
10-27-2009 12:29:16 GMT +2
|
Hi again Fred, thanks for responding(& Lee).
I don't mean to sound lazy but I'm not quite understanding what & where i'm suposed to write. Here is my send email page that gets all the info from the DB(2 Tables).
Could you elaborate on what you are saying.
<?php require_once('Connections/onlinemo_onlinemc.php'); ?>
<?php
// Load the tNG classes
require_once('includes/tng/tNG.inc.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_rsOrder = "-1";
if (isset($_SESSION['order_number_ref'])) {
$colname_rsOrder = $_SESSION['order_number_ref'];
}
mysql_select_db($database_onlinemo_onlinemc, $onlinemo_onlinemc);
$query_rsOrder = sprintf("SELECT orders2cn_ord.firstname_ord, orders2cn_ord.lastname_ord, orderproduct2cn_opr.quanty_opr, orderproduct2cn_opr.productname_opr, orderproduct2cn_opr.productprice_opr, orders2cn_ord.address_ord, orders2cn_ord.region_reg, orders2cn_ord.country_ord, orders2cn_ord.postcode_ord, orders2cn_ord.receiptsession_ord, orders2cn_ord.totalorderprice_ord, orders2cn_ord.gst_ord, orders2cn_ord.date_ord, orders2cn_ord.email_ord FROM ((orderproduct2cn_opr LEFT JOIN orders2cn_ord ON orders2cn_ord.id_ord=orderproduct2cn_opr.idorder_opr) LEFT JOIN provinces_prv ON provinces_prv.id_prv=orders2cn_ord.region_reg) WHERE idorder_opr = %s", GetSQLValueString($colname_rsOrder, "text"));
$rsOrder = mysql_query($query_rsOrder, $onlinemo_onlinemc) or die(mysql_error());
$row_rsOrder = mysql_fetch_assoc($rsOrder);
$totalRows_rsOrder = mysql_num_rows($rsOrder);
ob_start();
?><!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" c />
<title>Untitled Document</title>
<style type="text/css">
<!--
body,td,th {
font-family: Arial, Helvetica, sans-serif;
}
.style1 {
color: #0000FF;
font: bold;
}
.style2 {color: #FF0000}
.style3 {color: #FE0000; }
-->
</style></head>
<body>
<?php
$sectemailObj = new tNG_EmailPageSection();
$sectemailObj->getCSSFrom(__FILE__);
$sectemailObj->setTo("theteam@onlinemotorcycles.co.nz");
$sectemailObj->setFrom("theteam@onlinemotorcy
View full message
|
|
|
Fred at ExelWebs.com
10-27-2009 12:49:33 GMT +2
|
I assume line 123 displays the email address successful.
<td>Email: <a href="/src/compose.php<?php echo $row_rsOrder['email_ord']; ?>"><strong><?php echo $row_rsOrder['email_ord']; ?></strong></a></td>
Change line 123 to this;
<td>Email: <a href="/src/compose.php<?php echo $row_rsOrder['email_ord']; ?>"><strong><?php echo $row_rsOrder['email_ord']; $email = $row_rsOrder['email_ord']; ?></strong></a></td>
You can add this code just below the sql query string as well, but by adding it in line 123 you know it is there. For ease of readability you can move it somewhere else at a later stage.
You can test if you have the value by adding <?php echo $email;?> just after the <body> tag.
Now you have the email address in a php variable and can use it where you want.
Next change line 69 from;
$sectemailObj->setTo("theteam@onlinemotorcycles.co.nz");
to
$sectemailObj->setTo("{GLOBALS.$email}");
By using it as a GLOBAL variable it is available in all the different scopes in your code.
You can read more about variable scopes here
P.s. Drop me an email at my forum name.
|
|
|
Timespider
10-28-2009 06:24:43 GMT +2
|
Hi Fred, I just don't know whats going on. I tried what you suggested but still no luck. I echoed it & it was there on the page but the send email just doesn't pick it up. I need the static address to, so the owner gets a copy, & when he gets it the email says in the to field"{GLOBALS.$email},theteam@onlinemotorcycles.co.nz" not the email address.
Do you have any other ideas.
Here's the code I used.
<?php require_once('Connections/onlinemo_onlinemc.php'); ?>
<?php
// Load the tNG classes
require_once('includes/tng/tNG.inc.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_rsOrder = "-1";
if (isset($_SESSION['order_number_ref'])) {
$colname_rsOrder = $_SESSION['order_number_ref'];
}
mysql_select_db($database_onlinemo_onlinemc, $onlinemo_onlinemc);
$query_rsOrder = sprintf("SELECT orders2cn_ord.firstname_ord, orders2cn_ord.lastname_ord, orderproduct2cn_opr.quanty_opr, orderproduct2cn_opr.productname_opr, orderproduct2cn_opr.productprice_opr, orders2cn_ord.address_ord, orders2cn_ord.region_reg, orders2cn_ord.country_ord, orders2cn_ord.postcode_ord, orders2cn_ord.receiptsession_ord, orders2cn_ord.totalorderprice_ord, orders2cn_ord.gst_ord, orders2cn_ord.date_ord, orders2cn_ord.email_ord FROM ((orderproduct2cn_opr LEFT JOIN orders2cn_ord ON orders2cn_ord.id_ord=orderproduct2cn_opr.idorder_opr) LEFT JOIN provinces_prv ON provinces_prv.id_prv=orders2cn_ord.region_reg) WHERE idorder_opr = %s", GetSQLValueString($colname_rsOrder, "text"));
$rsOrder = mysql_query($query_rsOrder, $onlinemo_onlinemc) or die(mysql_error());
$row_rsOrder = mysql_fetch_assoc($rsOrder);
$totalRows_rsOrder = mysql_num_rows($rsOrder);
ob_start();
//set $email = to email_ord
$email = $row_rsOrder['email_ord'];
?><!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" c />
<title>Untitled Document</title>
<style type="text/css">
<!--
body,td,th {
font-family: Arial, Helvetica, sans-serif;
}
.style1 {
color: #0000FF;
font: bold;
}
.style2 {color: #FF0000}
.style3 {color: #FE0000; }
-->
</style></head>
<body
View full message
|
|
|
Fred at ExelWebs.com
10-28-2009 10:48:56 GMT +2
|
Feeling very stupid right now...
You should use {GLOBALS.email} and not {GLOBALS.$email}
Without the $
|
|
|
|
|