Call Us Today! 602-740-5635
  

How to add a Dollar Sign ($) to prices in the RSForm Pro PayPal Plug-in

The Dollar SignThis may seem like a weird tutorial, but the people across the pond forget that in The United States & Canada, we like to see a dollar sign in front of our prices.  Recently we had a client ask us to set up an event online registration form, and include multiple registration packages into the form.  Our solution was to use RSForm Pro 1.3.0 Rev 40 with the PayPal Plug-in.  So, we installed the software, created the form, added the plug-in, and formatted everything to perfection.

Except, the customer wanted to see a dollar sign in front of their prices.  Not an unreasonable request, but a pain to find.   That being said this tutorial was written to help people find the character string in front of the prices and add a “$”.  A little tweak that would seem so simple, that it may be quite frustrating if you can’t find it.

I hope this saves you some time.

Step 1 – Start your FTP Program

Open your FTP Program and connect to your site where your Joomla! installation resides that is using the RSForm Pro PayPal plug-in.

Step 2 – Locate and Copy the rsfppaypal.php File to your Computer

It does not matter where you copy the file, as long as you can get to it to edit the file.  If you are sitting in the Joomla! website’s root directory, the rsfppaypal.php file will be located in the /plugins/system folder.

Step 3 – Open the file

Open rsfppaypal.php with whatever text editor you choose, preferably an editor with line numbers.

Step 4 – Locate the “Select Option” Portion of the Code

Dropdown menus use the

<select><option>Dropdown 1</option><option>Dropdown 2</option></select>

Set of nested tags in HTML.  The PHP code makes this look a lot more complicated, but the principle is the same.

Locate the snippet of code that looks like this, located somewhere around line 191.

$option_value = $buf[0];
$option_value_trimmed = str_replace(‘[c]’,”,$option_value);
$option_shown = count($buf) == 1 ? $buf[0] : $buf[1];
$option_shown_trimmed = str_replace(‘[c]’,”,$option_shown);
$option_shown_value = $option_value == ” ? ” : $option_shown_trimmed;
$option_shown_trimmed = count($buf) == 1 ? $buf[0] :$option_shown_trimmed.
($buf[0] > 0 ? ‘ – ‘.number_format($buf[0],$nodecimals, $decimal, $thousands).’ ‘.$currency : ”);

The very last line is the code for the number value.  Right now it is the default setup which for example would look like “Title – 00.00 USD” assuming that you set the currency code to US Dollars.  Looking at the very last line, locate the ‘ – ‘ character string.  Within these quotes, you can put whatever you like, other than single quotes.  For the sake of this tutorial, let’s change the string to look like this: ‘ – $’ .  By making that small change, all of your prices will now have a dollar sign in front of them in your dropdown menu, Example: “Title – $00.00 USD”.

Your code should now look like this:

$option_value = $buf[0];
$option_value_trimmed = str_replace(‘[c]’,”,$option_value);
$option_shown = count($buf) == 1 ? $buf[0] : $buf[1];
$option_shown_trimmed = str_replace(‘[c]’,”,$option_shown);
$option_shown_value = $option_value == ” ? ” : $option_shown_trimmed;
$option_shown_trimmed = count($buf) == 1 ? $buf[0] :$option_shown_trimmed.
($buf[0] > 0 ? ‘ – $’.number_format($buf[0],$nodecimals, $decimal, $thousands).’ ‘.$currency : ”);

That’s it!  This code modification is a seemingly simple change, but a needle in a haystack to find.  I hope this tutorial saves you the hour I had to spend finding the 5 characters of PHP code in the 590 line plug-in PHP file.  Good Luck!

Categories

Enter your email address:

Delivered by FeedBurner

Social Media
Sponsored Ads