mail depending on points of dropdown

StefanJ 14 Dec, 2011
Hey Bob,

Again I have a major issue. 😀
I don´t know if this can be done by chronoforms, so I hope you can help me.
I'm using joomla 1,7 with chronoforms 4.

I need to send 5 different mails, depending on the data chosen in drop/downs.

I have 10 dropdowns with each 3 options.
For every option, 'points' are given.
When the form is submitted, an email has to be send depending of the sum of all points.

For example:

dropdown 1:
option a (1 point)
option b (3 points)
option c (5 points)

dropdown 2:
option a (1 point)
option b (3 points)
option c (5 points)

dropdown 3:
option a (1 point)
option b (3 points)
option c (5 points)


After submitting:
0-3 points; mail 1 has to be send
4-10 points; mail 2 has to be send
10-15 points; mail 3 has to be send.

The points have to be invisible for visitors.

Can this be done with chronoforms or is this to difficult?

If you have a solution, I'll buy you 10 beer!

grtz

Stefan
GreyHead 15 Dec, 2011
Hi Stefan,

When you say 'different emails' how are they different? Is it the same addressee but a different message?

You can do the sums in a Custom code action. Once you have a total then I'd probably use a single email and add conditional PHP to the Message box (you need the Rich Editor off for this).
<?php 
if ( $total <=3 ) {
?>
// add message here
<?php } elseif ( $total <= 10 ) {
?>
// add a different message here
<?php
} else {
?>
// and the last message here
<?php
}
?>

Bob
StefanJ 19 Dec, 2011
Hi Bob,

The content of the emails is different, the addressee is the same.
I have this code on submit before e-mail:
<?php
if ( $total <=21 ) {
?>
// mail 1
<?php } elseif ( $total <=  41 ) {
?>
// mail 2
<?php 
} elseif ( $total <=  61 ) {
?>
// mail 3
<?php 
} elseif ( $total <=  86 ) {
?>
// mail 4
} else {
?>
// mail 5
<?php
}

Where do I have to add the points for the answers of the questions?
Can I use the the e-mail actions for sending e-mail in html?

thnx!

Stefan
GreyHead 19 Dec, 2011
Hi Stefan,

You probably need to switch to the Advanced Wizard to make this easier.

Use the On Submit Before Email action to total the points.

Use the Email Message box to switch the email messages.

Yes you can send the email in HTML.

Bob
StefanJ 19 Dec, 2011
Hi Bob,

I use the Advanced Wizard.
Where do I have to assign points for the answers to the questions and how do I total the points?

thnx

Stefan
GreyHead 19 Dec, 2011
Hi Stefan,

I don't know. They are really questions for your site design.

I'd either assign points (a) as values in the answer drop-downs or (b) in an array set up in the ON Submit Custom Code action.

To add them up you write some PHP to do the arithmetic.

Bob
StefanJ 19 Dec, 2011
Bob,

Although my problem isn't solved I think you've earned a six-pack for all your quick and clear help.

grtz

Stefan
This topic is locked and no more replies can be posted.