dcox
Posts: 29
|
| Posted: 10/19/2007, 11:45 AM |
|
How might one go about including all queried rows in a single, text only, email message?
I have a receipt form that displays the order date, customer name and each line item ordered.
My problem is when I put my email code in the before_show_row event, it sends the user a seperate email for each line item. I want one email with all info to go out.
Thanks!
_________________
Toshiba Satellite X205 laptop, Intel(R) Core(TM)2 Duo CPU T7300 @ 2GHz, 4gb ram, Windows Vista Ultimate 32-bit, Dual 200gb 7200rpm hard drives (no raid), NVidia GeForce 8700M GT
|
 |
 |
DonP
|
| Posted: 10/19/2007, 11:08 PM |
|
You should be able to simply concatenate the fields into a single variable,
then send the variable as the email body. You can add any necessary HTML
formatting and incidental text (thank you for your order, or whatever) too.
Don't put your code into Before Show Row, though, I generally use the On
Validate event even though that's probably not the recommended way. It
seems to work.
DonP
"dcox" <dcox@forum.codecharge> wrote in message
news:54718fb65574bb@news.codecharge.com...
> How might one go about including all queried rows in a single, text only,
> email
> message?
>
> I have a receipt form that displays the order date, customer name and each
> line
> item ordered.
>
> My problem is when I put my email code in the before_show_row event, it
> sends
> the user a seperate email for each line item. I want one email with all
> info to
> go out.
>
> Thanks!
>
>
> _________________
> Thanks for your help!
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>
|
|
|
 |
dcox
Posts: 29
|
| Posted: 10/20/2007, 6:05 AM |
|
As anyone ever accomplished this with CCS? I have contacted support and they couldn't solve it. They pointed me to several forum messages but they all seem to attach the grid as an html file. I simply want to display each record detail on a single line in the email.
So, the email would look something like this....
Customer: John Doe
Order Date: 10/20/2007
Order #: 3422
Items ordered...
"Easter 2007 DVD-Video" Unit Price: $10 Qty: 1
"It's About Time" Audio CD Unit Price:$5 Qty:2
Total Purchase: $20
I have the email sending the info but it sends a separate email for each line item. To see how it works you can visit my site at http://www.avministry.com
To test the email system, you'll need to create an account and confirm your email address.
Thanks for any help you can offer!
_________________
Toshiba Satellite X205 laptop, Intel(R) Core(TM)2 Duo CPU T7300 @ 2GHz, 4gb ram, Windows Vista Ultimate 32-bit, Dual 200gb 7200rpm hard drives (no raid), NVidia GeForce 8700M GT
|
 |
 |
DonB
|
| Posted: 10/20/2007, 7:56 AM |
|
It's pretty straightforward.
1. Select an event that fires once per submit (a Button with server OnClick
is my preference. Ensure the button has no 'operation' (e.g. Insert). You
want the button to do NOTHING except trigger it's event.
2. In the OnClick event, step through the $_POST data and pull out each
line of data that you want to send.
3. Assemble the lines of data into the email body, and send it - only one
email will be sent.
(Oh, and the button MUST be in a <form>. It may be convenient to use an
Editable Grid, but have only labels (no editable data) and turn off the
Insert, Update, Delete options. That gets you the form in which to place
your button. You can simply use the Submit button that all Ed Grids have by
default, and remove the Operation property from it.
--
DonB
"dcox" <dcox@forum.codecharge> wrote in message
news:54719fd0abf183@news.codecharge.com...
> As anyone every accomplished this with CCS? I have contacted support and
they
> couldn't solve it. They pointed me to several forum messages but they all
seem
> to attach the grid as an html file. I simple want to display each record
detail
> on a single line in the email.
>
> So, the email would look something like this....
>
> Customer: John Doe
> Order Date: 10/20/2007
> Order #: 3422
>
> Items ordered...
> "Easter 2007 DVD-Video" Unit Price: $10 Qty: 1
> "It's About Time" Audio CD Unit Price:$5 Qty:2
>
> Total Purchase: $20
>
>
> I have the email sending the info but it sends a separate email for each
line
> item. To see how it works you can visit my site at http://www.avministry.com
>
> To test the email system, you'll need to create an account and confirm
your
> email address.
>
> Thanks for any help you can offer!
>
> _________________
> Thanks for your help!
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>
|
|
|
 |
Waspman
Posts: 948
|
| Posted: 10/20/2007, 8:28 AM |
|
This is how I build my emails; (HTML)
global $emailBody;
$emailBody = "";
$emailBody = $emailBody."A quote has been submitted for your job/project -- ".$Component->JobTitle->GetText()." --";
$emailBody = $emailBody."To see the details of the quote logon to the site.";
$emailBody = $emailBody."<br><br>";
$emailBody = $emailBody."<a href=".$Component->url->GetText().">Click here to go to the site</a>";
$to = $Component->OwnerEmail->GetText();
$subject = "Quote submitted for job/project -- ".$Component->JobTitle->GetText();
$message = $emailBody;
$from = "TheTeam@SiteName.com";
$additional_headers = "From: $from\nReply-To: $from\nContent-Type: text/html";
mail ($to, $subject, $message, $additional_headers);
T
_________________
http://www.waspmedia.co.uk |
 |
 |
dcox
Posts: 29
|
| Posted: 10/20/2007, 8:34 AM |
|
Waspman,
In which event do you place this code?
Thanks!
_________________
Toshiba Satellite X205 laptop, Intel(R) Core(TM)2 Duo CPU T7300 @ 2GHz, 4gb ram, Windows Vista Ultimate 32-bit, Dual 200gb 7200rpm hard drives (no raid), NVidia GeForce 8700M GT
|
 |
 |
Waspman
Posts: 948
|
| Posted: 10/20/2007, 9:08 AM |
|
I put it in after insert...
Tony
_________________
http://www.waspmedia.co.uk |
 |
 |
JimmyCrackedCorn
Posts: 583
|
| Posted: 10/20/2007, 11:56 AM |
|
here is how I would do this,
- set up a string variable at the top of the code page (like Waspman said)
- in before_show_row event concatenate the row values onto what is already in variable
- send email in after_insert (again as Waspman said)
_________________
Walter Kempees...you are dearly missed. |
 |
 |
dcox
Posts: 29
|
| Posted: 10/20/2007, 12:01 PM |
|
J.C.C. - Would you be so kind as to show a simple example of performing the concatenate on say three fields so that I may better understand? I need to understand how to show the result in a variable.
Thanks you!
_________________
Toshiba Satellite X205 laptop, Intel(R) Core(TM)2 Duo CPU T7300 @ 2GHz, 4gb ram, Windows Vista Ultimate 32-bit, Dual 200gb 7200rpm hard drives (no raid), NVidia GeForce 8700M GT
|
 |
 |
JimmyCrackedCorn
Posts: 583
|
| Posted: 10/20/2007, 1:44 PM |
|
I'm not a PHP guy but I'll try! the example assumes you want three fields per row and each will be separated from the next with a dash and each line will need a linebreak at the end.
on your code page outside of any function put the following,
global $emailBody;
$emailbody = "WhateverMessageYouWantAtTopOfBody" . "\n\n";
in before_show_row event put the following,
$emailBody = $emailBody . Field1 . "-" . Field2 . "-" . Field3 . "-" . "\n";
in after_insert event put the following,
$emailbody = $emailBody . "\n" . "WhateverMessageYouWantAtBottomOfBody";
and send the email with $emailBody as the body
_________________
Walter Kempees...you are dearly missed. |
 |
 |
datadoit
|
| Posted: 10/20/2007, 2:38 PM |
|
JimmyCrackedCorn wrote:
> I'm not a PHP guy but I'll try! the example assumes you want three fields per
> row and each will be separated from the next with a dash and each line will need
> a linebreak at the end.
>
> on your code page outside of any function put the following,
> global $emailBody;
> $emailbody = "WhateverMessageYouWantAtTopOfBody" . "\n\n";
>
> in before_show_row event put the following,
> $emailBody = $emailBody . Field1 . "-" . Field2 . "-" . Field3 . "-" . "\n";
>
> in after_insert event put the following,
> $emailbody = $emailBody . "WhateverMessageYouWantAtBottomOfBody";
>
> and send the email with $emailBody as the body
> ---------------------------------------
Recognize that if your web server is on Winderz, you'll probably want
your line breaks to include a carriage return (\r\n). I like to:
if ($_ENV['OS'] == 'Windows_NT') {
$NewLine = "\r\n";
}
else {
$NewLine = "\n";
}
$emailBody .= Field1 . "-" . Field2 . "-" . Field3 . $NewLine;
|
|
|
 |
JimmyCrackedCorn
Posts: 583
|
| Posted: 10/20/2007, 2:42 PM |
|
wait a minute...I just reread your original posts and I think I misunderstood what you are doing. you are displaying a grid, not inserting a record? correct? if so, there won't be any after_insert event. so you want an email to be sent every time someone views this page?
in this case I guess you would do something like I show below BUT I'm not sure if this would work and if it does whether this is the best way to do it! just something for you to try!
on your code page outside of any function put the following,
global $emailBody;
global $TotalPurchase;
in component's before_show event put the following
$emailbody = CustomerInfo . "\n\n";
$emailbody = "Items ordered..." . "\n";
in component's before_show_row event put the following,
$emailBody = $emailBody . Video . "-" . Price . "-" . Qty . "-" . "\n";
$TotalPurchase = $TotalPurchase + Price;
in the page's before_output event put the following,
$emailbody = $emailBody . "\n" . "WhateverMessageYouWantAtBottomOfBody";
and send the email with $emailBody as the body
_________________
Walter Kempees...you are dearly missed. |
 |
 |
|