Forums

Sending an email after a paypal payment

faros 02 Oct, 2014
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: 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
Max_admin 03 Oct, 2014
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, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
faros 05 Oct, 2014
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
Max_admin 05 Oct, 2014
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, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 05 Oct, 2014
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
faros 06 Oct, 2014
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
Max_admin 06 Oct, 2014
Answer
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, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
faros 06 Oct, 2014
:-) 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 06 Oct, 2014
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
faros 06 Oct, 2014
Thanks Bob
I'll follow you advice.
Fabrizio
This topic is locked and no more replies can be posted.