I do A LOT of voice over work - mostly for training videos in Drupal, Joomla and Mautic - but that seems to be expanding.

Here's the latest video for the introduction of Drupal 8.4 (launched October 4th, 2017)

 

 

 

I had a friend ask if I could create a donation/membership page for their non-profit using PayPal.  The site is built in Joomla! 3.x so I naturally thought of an excellent extension like JoomDonation.  However, they wanted a number of tweaks that meant modifying the extension which I hesitate to do.  Enter RSForm! Pro.  It's pretty much been my go-to form builder on any Joomla! site I've built over the years.

Basic View:

SafariScreenSnapz069

 Requirements:

  • Select a pre-set amount or enter a custom donation amount.
  • One-Time or Recurring donations (recurring donations required a PayPal account - users would manage them there...)
  • Recurring Donations on a Monthly, Quarterly, Semi-Annual or Annual basis.
  • Recurring donations would be empty for on-going donations, or at least 2, since 1 throws an error at PayPal.  (RSForm has a "range" validation feature).
  • Clean looking.
  • If you clicked on the Custom Donation Amount a field appears, allowing the amounts to be a required field, even if a donor chose the custom option.

Code: (download at the bottom of the article)

The magic happens upon form submission.  The php tests for all the variables then sends the appropriate link to PayPal. (Please don't write to me and tell me my code could be improved... I know it could. - I haven't done any coding in years lol).

/*Recurring Donation */
if ($_POST['form']['recurring'] == 'Recurring')
{
$business = '';;
/* getting the donation name */
if ($_POST['form']['other'][0] != '') {$item_name = str_replace($replace, $with, 'Custom Amount');}
if ($_POST['form']['membership'][0] != '0') {$item_name = str_replace($replace, $with, '{membership:text}');}
/* getting the donation amount */
if ($_POST['form']['membership'][0] != '0') {$total = str_replace($replace, $with, '{membership:value}');}
/* getting duration and frequency for PayPal */
$duration = str_replace($replace, $with, '{duration:value}');
$frequency = str_replace($replace, $with, '{frequency:value}');
if ($frequency == 'Q') {$p3 = '3'; $t3 ='M';}
if ($frequency == 'Y') {$p3 = '1'; $t3 = 'Y';}
if ($frequency == 'S') {$p3 = '6';$t3 ='M';}
if ($frequency == 'M') {$p3 = '1';$t3 ='M';}
/* PayPal variables set */
$currency_code = 'USD';
$a3 = $total;
$src = '1';
$srt = $duration;
$no_note = '1';
/* upon successful completion of the donation, RSForm will update the status from Pending to Accepted */
$notify_url = JURI::root().'index.php?option=com_rsform&formId='.$formId.'&submission='.$SubmissionId;
$url= 'https://www.paypal.com/cgi-bin/webscr?cmd=_xclick-subscriptions&business='.urlencode($business).'&item_name='.urlencode($item_name).'&currency_code='.urlencode($currency_code).'&a3='.urlencode($a3).'&p3='.urlencode($p3).'&t3='.urlencode($t3).'&src='.urlencode($src).'&srt='.urlencode($srt).'&no_note='.urlencode($no_note).'&notify_url='.urlencode($notify_url);
$app = JFactory::getApplication();
$app->redirect($url);
exit();
}
/* One Time Donation */
if ($_POST['form']['recurring'] == 'One Time')
{
if ($_POST['form']['membership'][0] != '') {$item_name = str_replace($replace, $with, '{membership:text}');}
if ($_POST['form']['other'][0] != '') {$item_name = str_replace($replace, $with, 'Custom Amount');}
if ($_POST['form']['other'][0] != '') {$total = str_replace($replace, $with, '{other:value}');}
if ($_POST['form']['membership'][0] != '0') {$total = str_replace($replace, $with, '{membership:value}');}
$currency_code = 'USD';
$a3 = $total;
$p3 = '0';
$t3 = '1';
$src = '0';
$no_note = '1';
$notify_url = JURI::root().'index.php?option=com_rsform&formId='.$formId.'&submission='.$SubmissionId;
$url='https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=design@navigatetomorrow.com&item_name=One+Time+Donation&amount=' .$total .'&currency_code=USD&notify_url='.urlencode($notify_url);
$app = JFactory::getApplication();
$app->redirect($url);
exit();
}

Test It Out

Feel free to test out the form - you can even send a donation if you'd like :)

Donations & Memberships

First Name(*)
Invalid Input

Last Name(*)
Invalid Input

Email(*)
Invalid Input

Choose either a set amount or enter a different amount below.
Note: A Patron Level Donation/Membership automatically renews your Basic Membership for that year.
Membership(*)

Invalid Input

Other Amount: $
Invalid Input

Donation Type
Invalid Input

Please select a frequency
Invalid Input

Number of Donations
Invalid Input

Invalid Input

Download

To use this code you must have a Joomla 3.x website (minimum) and a copy of RSForm! Pro.

Download

A few months ago I was riding my motorcycle through town when a guy turned into my lane from a side street and almost hit me.  I'll admit - I was angry.  I swerved, hit the horn and was determined to give him a piece of my mind.  As we came up to the next intersection, he got into the left turn lane so I pulled up beside him and glared.  

Read more: How to Accept Others

 by Dr. Heartsill Wilson

This is the beginning of a new day.
God has given me this day to use as I will.
I can waste it,
Or use it for good.
What I do today is important,
Because I am exchanging a day of my life for it.

Read more: A New Day

So...it's been a while since I wrote anything on the blog.  If you read blogs, you've probably seen this before.  Creating content for others kind of takes the fun out of keeping your own site up and running. 

Read more: October Update 2016