Buy Now
Sign in

Sending an email after a paypal payment

faros , October 02 2014
Answered
f
faros

Hi every body
I have configured the paypal redirect and the paypal listener in my form and almost everything works.
Now OnVerified event in paypal listener action I have a confirmation email (Email [GH]), in the body of this email I wont to print some values from the form (or from the data base), so I write like this {cfu_name} etc but when the email is sent I cannot se the value but just: {cfu_name}.
So Following this FAQ: paypal-redirect-action.html">http://www.chronoengine.com/faqs/57-cfv4/cfv4-actions/2583-how-to-use-the-paypal-redirect-action.html
I insert a DB Record Loader in the paypal listener action, but now I dont know how to call the data in the emal body.
Please some one can help me?
Many Thanks
Fabrizio

admin

Hi Fabrizio,

The "db record loader" is loading the data ? for this you need to read the last section in the FAQ link you posted, your paypal redirect should pass the record id to paypal under the "custom" parameter, and your form data should be saved before that!

Regards,
Max

Max
If your main question got answered then please mark the answer using the button!

f
faros

Hi Max
Thanks for your reply.
All seems to configured in correct way, the paypal redirect has the custom parameter, all the data are saved by a db save action before the paypal redirect.
In the paypal ipn i Olso have a db save to update a value that works correct .
Is there a way to see if the data are loaded by the db load action?
Thanks fabrizio

admin

If the "db read" in in the listener event then you can use this line of code inside an Email action which can be sent to you:

				
<?php
print_r2($form->data); // in v5 it should be pr($form->data);


Regards,
Max

Max
If your main question got answered then please mark the answer using the button!

GreyHead

Hi Fabrizio,

The simplest way to test the DB Load is to look at the email. Provided that the Email is after the DB Load and the names in the template match the column names you should be OK.

You can add PHP to the email template to out put some debug information if that helps e.g.

				<?php
echo'<div>$form->data: '.print_r($form->data, true).'</div>';
?>


In the actions I have built like this I have also included the Joomla! Logger code so that a log file is written that you can check to see what is happening.

Bob

ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much

f
faros

Hi Max And Bob
I thank you for you precious help.
I think I near to the solution, I use your code in the email and discovered that DB Load doesn't work so I add a Custom code before it with this code inside : <?php $form->data["RichiestaConsulenza"]["cf_id"] = $form->data["custom"]; ?>
Now I receive email like this

				L'utente

ha accettato il preventivo relativo alla richiesta di consulenza

Numero Consulenza: 33

con Oggetto: {RichiestaConsulenza.requestobj}

Importo iva inclusa: € {RichiestaConsulenza.price}
La modalità di pagamento prescelta è paypal.

Riceverete a breve le email relative al pagamento effettuato da paypal

Array
(
[option] => com_chronoforms
[chronoform] => Consulenza-user
[event] => ipn
[mc_gross] => 3.00
[protection_eligibility] => Ineligible

)


As you can see the DB load now is working but it give me only the cf_id data and not all the other i need in the email.
Where is my mistake?
Thanks
Fabrizio

admin

Hi Fabrizio,

I have removed some of the data for privacy!

The data you have is the data returned from paypal, you need a correctly configured "db read", in the "table" select the table you saved the data to, in the "request param" add "custom", in the "db field" add "cf_id", then try again.

Regards,
Max

Max
If your main question got answered then please mark the answer using the button!

f
faros

:-) Thanks Max the problem was that leave empty the "db_field" now it works,

Just two more questions
1) can I delete the custom code I mentioned before?
2) can I use in the same way A multi Record Loader to take the data from two different tables and use it in the email?
I need to get the customer name and email which are stored in another table linked with the previous one with a "cfu_id" field

Thanks a lot
Fabrizio

GreyHead

Hi Fabrizio,

A Multi Record Loader is used for getting multiple records from the *same* table. If you want records from two tables the simplest way is probably to use two DB Load actions, one for each table (or you could write a Custom Code action to do one compound MySQL query if you prefer).

Yes, you can probably delete the Custom code. If in doubt, comment it out and test before finally deleting it.

Bob

ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much

f
faros

Thanks Bob
I'll follow you advice.
Fabrizio