I would like to make IP.Nexus send an email to my users with their license key as soon as they buy something from my store..
I've tried to achieve this with a custom action using the 'onPurchaseGenerated' method.
The problem seems to be that the 'onPurchaseGenerated' method is called before the license generator, so when I try to get the license from the nexus_licensekeys table It won't get anything as the key for that purchase wasn't generated yet..
Is there anyway, I could implement this?
This is the code I've been using to test this out
public function onPurchaseGenerated( $member, $package, $invoice, $purchase )
{
$DB = ipsRegistry::DB();
$purchaseID = $purchase['ps_id'];
$licenseRow = $DB->buildAndFetch( array( 'select' => '*', 'from' => 'nexus_licensekeys', 'where' => "lkey_purchase=" . $purchaseID ) );
IPSDebug::addLogMessage("onPurchaseGenerated", "actionLog", array( "purchaseID" => $purchaseID, "licenseRow" => $licenseRow, "member" => $member, "package" => $package, "invoice" => $invoice, "purchase" => $purchase), true, false);
return;
}












