While testing my store with paypal sandbox I noticed that if I bought the same item twice (two seperate transactions) I did not receive the invoice email the second time. I have found it is to do with the $is_new boolean in the paypal_ipn function. I cannot figure out why it does not work however, as each transaction does have a new ppid.

Comments

bones’s picture

Found the problem.
Line 336:
$is_new = (db_result(db_query('SELECT COUNT(txnid) FROM {ec_paypal} WHERE ppid = %d', $ppid))) ? false : true;
Should be:
$is_new = (db_result(db_query("SELECT COUNT(txnid) FROM {ec_paypal} WHERE ppid = '%s'", $ppid))) ? false : true;
Because the paypal id is alpha numeric.

Bevan’s picture

Version: 4.7.x-3.x-dev » 5.x-3.0
Status: Active » Needs review

Great spotting. I'm testing this out now...

skelly’s picture

Version: 5.x-3.0 » 4.7.x-3.x-dev

I'm pretty sure this is still a problem with all the current 3.x source trees and the above fix does seem warranted from my testing...

skelly’s picture

Version: 4.7.x-3.x-dev » 5.x-3.x-dev

My bad. Accidentally changed version in last post.

Bevan’s picture

Works for me on EC 4

gordon’s picture

Status: Needs review » Fixed

Fixed in ec4

Anonymous’s picture

Status: Fixed » Closed (fixed)
Bevan’s picture

Title: Invoice email not sent when transaction is repeated » Customer Invoice not sent on completed paypal transaction via IPN

Damn! I've just spent hours RE-debugging this one. Renaming to something that I will find next time. Grumble.