I would like to send the "E-Mail Payment Receipt to user" email only on second and every following payment. But not after 1. payment because at this time i send the payment details in the "singup email". ...so maybe i could check if the user has some previous purchases...how could i code this?
You need to modify /amember/application/default/models/EmailTemplate.php : PHP: static function onPaymentWithAccessAfterInsert(Am_Event_PaymentWithAccessAfterInsert $event) { /** * This e-mail is sent for first payment in invoice only * another template must be used for the following payments */ // if ($event->getInvoice()->getPaymentsCount() != 1) return; if ($event->getDi()->config->get('send_payment_mail') && $event->getInvoice()->getPaymentsCount()>1)
Ok. I think this will work for every next payment for the same product/invoice. What if I have multiple products (all are just one time paments) and i want to send out the payment confirmation emails only on second+ product purchases?
if you want to check all payments for user: PHP: if ($event->getDi()->config->get('send_payment_mail') && ($event->getDi()->db->selectCell('select count(*) from ?_invoice_payment where user_id=?', $event->getInvoice()->user_id)>1))