Solution: Specify a Custom PayPal Payment Page Style with Nice PayPal Downloads

Tech


Joomla!

Joomla is one of the world’ s most popular open source CMS (content management system).

Version: 1.5-2.5
Developer: Open Source Matters, Inc.
Linkhttp://www.joomla.org


Nice PayPal Downloads

The Nice PayPal Downloads extension is a robust download manager that allows you to distribute files for free or for paid download. 

Version: 1.92
Developer: TriniTronic
Linkhttp://trinitronic.com/index.php/Downloads/nice-paypal-downloads.html


Background


One of the coolest features available when using PayPal is that you can stylize your PayPal payment page. One thing that folks don't always realize is that PayPal will allow you to create multiple styles for your PayPal payment page. This is a handy feature, especially if you are running several ecommerce sites that all use the same PayPal account. You can have a different theme for each site's PayPal payment page and still use the same PayPal account to collect payment.

Now the way that you tell PayPal that you want to use one of your other page styles is to include a bit of extra informaiton with your PayPal payment button. Nice Paypal Downloads does not support this feature out-of-the-box. However, it is relatively simple to modify the Nice PayPal Downloads to include a request to PayPal to use one of your alternate page styles.


Solution


Before you get started, it is important to understand that many of the files and folders for this extension are named similarly and it's easy to accidentally modify the wrong file. So, pay careful attention to the file names and file paths cited in this tutorial.

IMPORTANT: Before you proceed make a full back up of your web site files and database.

As you get started, you will need to create at least one page style within your PayPal profile account. You can find more information about PayPal's custom payment pages here https://www.paypal.com/cgi-bin/webscr?cmd=p/mer/cowp_summary-outside

In order to tell PayPal that you want to use one of your payment page styles you need to include the page_style variable in your payment button code. You can include the page_style variable by editing the button code generation script. You will find this script at the following location.

plugins/system/nicepaypaldownloadsbtn/nicepaypaldownloadsbtn.php


You will need to find the block of code that looks like the one below, around line 165.

{codecitation class="brush:php;first-line:165;" width="550px" }

$insert = '<form action="'.$this->paypal_url.'/cgi-bin/webscr" method="post">

<input type="hidden" name="cmd" value="_xclick">  

<input type="hidden" name="business" value="'.$this->paypal_email.'">  

<input type="hidden" name="item_name" value="'.$this->_data->item_name.'">  

<input type="hidden" name="item_number" value="'.$this->_data->id.'">

<input type="hidden" name="quantity" value="1">

<input type="hidden" name="amount" value="'.$this->_data->amount.'">

<input type="hidden" name="tax" value="'.$this->_data->tax.'">

<input type="hidden" name="shipping" value="0">

<input type="hidden" name="currency_code" value="'.$this->currency_code.'"> 

<input type="hidden" name="lc" value="'.$this->country_code.'">

<input type="hidden" name="mrb" value="YRDKF6S68Y7DS"/>

<input type="hidden" name="return" value="'.JURI::base().'index.php?option=com_nicepaypaldownloads&amp;nd=r&amp;itm='.$this->_data->id.'">    

<input type="hidden" name="cancel_return" value="'.JURI::base().'index.php?option=com_nicepaypaldownloads&amp;nd=c&amp;itm='.$this->_data->id.'">    

<input type="hidden" name="notify_url" value="'.JURI::base().'index.php?option=com_nicepaypaldownloads&amp;controller=Ipn&amp;task=ipn">  

<input type="image" border="0" name="submit" src="'.$btnimg.'" alt="PayPal - The safer, easier way to pay online">

</form>';

{/codecitation}


Once you found this block the code, you will need to add your custom page_style variable to it. For the page_style input value, you need to use the name of your custom payment page style. This should result in something that looks like the following.

{codecitation class="brush:php;first-line:165;highlight:[180,180]" width="550px" }

$insert = '<form action="'.$this->paypal_url.'/cgi-bin/webscr" method="post">

<input type="hidden" name="cmd" value="_xclick">  

<input type="hidden" name="business" value="'.$this->paypal_email.'">  

<input type="hidden" name="item_name" value="'.$this->_data->item_name.'">  

<input type="hidden" name="item_number" value="'.$this->_data->id.'">

<input type="hidden" name="quantity" value="1">

<input type="hidden" name="amount" value="'.$this->_data->amount.'">

<input type="hidden" name="tax" value="'.$this->_data->tax.'">

<input type="hidden" name="shipping" value="0">

<input type="hidden" name="currency_code" value="'.$this->currency_code.'"> 

<input type="hidden" name="lc" value="'.$this->country_code.'">

<input type="hidden" name="mrb" value="YRDKF6S68Y7DS"/>

<input type="hidden" name="return" value="'.JURI::base().'index.php?option=com_nicepaypaldownloads&amp;nd=r&amp;itm='.$this->_data->id.'">    

<input type="hidden" name="cancel_return" value="'.JURI::base().'index.php?option=com_nicepaypaldownloads&amp;nd=c&amp;itm='.$this->_data->id.'">    

<input type="hidden" name="notify_url" value="'.JURI::base().'index.php?option=com_nicepaypaldownloads&amp;controller=Ipn&amp;task=ipn">  

<input type="hidden" name="page_style" value="your_page_style_name_goes_here" >

<input type="image" border="0" name="submit" src="'.$btnimg.'" alt="PayPal - The safer, easier way to pay online">

</form>';

{/codecitation}


Once you're finished, save your changes and upload the file over the top of the original. That is all there is to it.


~ Enjoy success!