Moderator: jamesSBT


Michael wrote:Hi,
That is a good question. Unfortunately, the extension does not support the feature you are describing. At best, you could specify a special message per product, but not per buyer.
~ All the best


Michael wrote:Yes, if you are familiar with PHP. There is a method that prepares the email message for sending. Prior to sending, the email message may contain certain tokens %examlpe%. The method replaces those tokens with dynamic information and then sends the email out.
Example
"%date%" is replaced with "06/24/2011".
You could hook into the replacement method and use a token in your email message, like %activationcode%.
Then when the system sees %activationcode% it will replace it with the appropriate information.
It will take a bit of doing (customizing) on your part, but the frame work is there to support your needs. If you have questions during your modifications, I would be happy to help answer them.
As a side note, I will be away between 6/24 - 6/28.
~ Best regards


Michael wrote:No worries, if the extension cannot be modified to fit your needs, I will personally make sure you are refunded for the purchase. However, I am 99% sure that you will be successful in the modification and/or we will be able to guide you to an appropriate solution using the extension.
~ Enjoy


Michael wrote:That sounds great!
To get you started, you will want to take a look at the script found here joomla_root_directory/component/com_nicepaypaldownloads/models/ipn.php. Find the "getEmailData()" function. It handles the %token% replacement process that I was speaking of earlier.
You will also want to take a look at the getdata() function in joomla_root_directory/component/com_nicepaypaldownloads/models/nicepaypaldownloads.php. It handles all of the %token% replacement processing for the download landing page messages and other pages.
~ Best regards




function mytrace($data)
{
$file = 'path/to/joomla_root_directory/mytrace.log';
$handle = fopen($file, 'a') or die("can't open file");
fwrite($handle, $data."\n");
fclose($handle);
}
function mytrace_r($data)
{
ob_start();
print_r( $data );
$output = ob_get_clean();
$file = 'path/to/joomla_root_directory/mytrace.log';
file_put_contents( $file, file_get_contents( $file ) . $output );
}
$this->mytrace("your string here.");$this->mytrace_r($yourArray);tail -f path/to/joomla_root_directory/mytrace.log
//lets set up for replacing all those message tokens
$repKey = array(
'%firstname%',
'%lastname%',
'%itemname%',
'%itemnumber%',
'%transactionid%',
'%paymentstatus%',
'%downloadcount%',
'%downloadsallowed%',
'%firstdate%',
'%timeallowed%',
'%downloaduntil%',
'%downloadlink%',
'%productkey%'
);
$repVal = array(
$this->_emaildata->first_name,
$this->_emaildata->last_name,
$this->_emaildata->item_name,
$this->_emaildata->id,
$this->_emaildata->txn_id,
$this->_emaildata->payment_status,
$this->_emaildata->dload_count,
$this->_emaildata->hitstoexpiry,
$firstdate,
$timeallowed,
$untildate,
$downloadlink,
$productkey
); $buyerName = $this->_emaildata->first_name + " " + $this->_emaildata->last_name;
$buyerItemName = $this->_emaildata->item_name;
$buyerDate = date("d/m/Y", time());
$buyerEmail = $this->_emaildata->payer_email;
1. I don't know where to put the trace functions in the class, what file would I put them into?
// Build the string
foreach ($segments as $key => $value) {
$segment_name = substr($key, 0, -1);
$segment = $value . ' ' . $segment_name;
if ($value != 1) {
$segment .= 's';
}
$array[] = $segment;
}
$str = implode(', ', $array);
return $str;
}
function mytrace($data)
{
$file = 'path/to/joomla_root_directory/mytrace.log';
$handle = fopen($file, 'a') or die("can't open file");
fwrite($handle, $data."\n");
fclose($handle);
}
function mytrace_r($data)
{
ob_start();
print_r( $data );
$output = ob_get_clean();
$file = 'path/to/joomla_root_directory/mytrace.log';
file_put_contents( $file, file_get_contents( $file ) . $output );
}
}
$buyerName = $this->_emaildata->first_name + " " + $this->_emaildata->last_name;
$buyerItemName = $this->_emaildata->item_name;
$buyerDate = date("d/m/Y", time());
$buyerEmail = $this->_emaildata->payer_email;
$this->mytrace('buyerEmail: '.$buyerEmail); //lets set up for replacing all those message tokens
$repKey = array(
'%firstname%',
'%lastname%',
'%itemname%',
'%itemnumber%',
'%transactionid%',
'%paymentstatus%',
'%downloadcount%',
'%downloadsallowed%',
'%firstdate%',
'%timeallowed%',
'%downloaduntil%',
'%downloadlink%',
'%productkey%'
);
$repVal = array(
$this->_emaildata->first_name,
$this->_emaildata->last_name,
$this->_emaildata->item_name,
$this->_emaildata->id,
$this->_emaildata->txn_id,
$this->_emaildata->payment_status,
$this->_emaildata->dload_count,
$this->_emaildata->hitstoexpiry,
$firstdate,
$timeallowed,
$untildate,
$downloadlink,
$productkey
);
$this->mytrace_r($repVal);
2. As for multiple downloads, I would rather not put all the files in one due to the fact I'm giving links to a 32 bit, 64 bit version and also portable versions, what I did was just remove the downloadlink token from the email message and entered my own information to give direct links, it won't really matter since my users will need a key to activate the program which they will need to download anyway.
3. I have tried sending a mass mail and it did work and I did receive an email, so my joomla email is working fine.
$this->mytrace("step 1");
...
$this->mytrace("step 2");
...
$this->mytrace("step 3");
4. I have entered my code into ipn.php

Return to Joomla: Nice PayPal Downloads
Users browsing this forum: Google [Bot] and 0 guests