Custom Payment Information Screens
| Developer Tutorials |
| Version: | Commercial | |
| Targetted Version: | C1.0.0.18 |
All of the payment gateway forms can be customised to display extra information or instructions if required. This tutorial will walk you through customising the payment forms for any of the Seber Cart payment options.
Warning! This tutorial requires that you to edit Seber Cart source code which may be overwritten when upgrading the software. It is essential that you backup any customised files before upgrading and then re-applying your changes afterwards.
- Each payment gateway processor code is stored in its own php file in the \administrator\components\com_sebercart\gateways folder
- Each gateway code file usually has three functions:
- The html instructions displayed to the user: pi<processorname>
- The code to create and process the payment: perform<processorname>
- Optionally the code to confirm the payment if it is out of process: confirm<processorname>
- To start our tutorial we are going to update the instructions displayed for the Paypal standard processor. This processor only displays instructions to the user as the payment is processed on the Paypal web site itself. Later we will look at modifying a more complex processor.
- Using your php editor open the \administrator\components\com_sebercart\gateways\paypal.standard.php file
- Locate the piPayPal() function. This is normally the first function in the code. At the time of writing the function looks like this (whitespace added for readability):
function piPayPal()
{
$L=LoadLang(8);
?>
<p><?php echo($L[5]);?><br>
<!-- PayPal Logo -->
<table border="0" cellpadding="10" cellspacing="0" align="center">
<tr>
<td align="center">
<a href="#" onclick="javascript:window.open('https://www.paypal.com/au/cgi-bin/webscr?cmd=xpt/Marketing/popup/OLCWhatIsPayPal-outside','olcwhatispaypal','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=400, height=350');"><img src="https://www.paypal.com/en_AU/i/logo/PayPal_mark_50x34.gif" border="0" alt="Acceptance Mark"></a>
</td>
</tr>
</table>
<!-- PayPal Logo --></p>
<?php
} - The first part of the function loads the language elements for the payment instructions by calling the LoadLang function. This is essential as it loads the user defined language for the payment.
- After this we have start to display our HTML. In this code we display a new paragraph which displays the user defined instructions.
- Next we display the PayPal logo and close off our paragraph.
- Feel free to add or remove any html code inside this function that you would like displayed to the user. Keep in mind that if you do not include the language file code then the user will not be able to modify the instructions themselves.
- Some payment processors require the user to fill out a form to be able to process the payment.
- Open the following file in your php editor:
- If you have a look at the piMerchantOne function it looks like this (whitespace added for readability):
function piMerchantOne()
{
$L=LoadLang(8);
?>
<table border="0" cellpadding="3" cellspacing="0">
<tr>
<td nowrap="nowrap"><?php echo($L[1]);?></td><td><input type="text" value="<?php echo($_POST['txtMOCCNo']);?>" name="txtMOCCNo"></td>
<td rowspan="3"><img src="<?php echo(JURI::base( true ))?>/components/com_sebercart/images/visa.png" alt="Visa" ><img src="<?php echo(JURI::base( true ))?>/components/com_sebercart/images/masterCard.png" alt="MasterCard" ></td>
</tr>
<tr>
<td><?php echo($L[2]);?></td>
<td><select name="ddlMOCCMonth">
<?php
$i=1;
while ($i <= 12)
{
echo "<option value='" . sprintf("%02d", $i) . "'";
if ($_POST['ddlMOCCMonth'] == sprintf("%02d", $i))
echo " selected='selected'";
echo ">" . sprintf("%02d", $i) . "</option>";
$i++;
}
?>
</select> /
20<select name="ddlMOCCYear">
<?php
$start=(int)date("Y")-2000;
for ($y = $start; $y <= $start+10; $y++)
{
$val=str_pad($y, 2, "0", STR_PAD_LEFT);
echo '<option value="' . $val . '"';
if ($_POST['ddlMOCCYear'] == $val)
echo " selected='selected'";
echo '>' . str_pad($y, 2, "0", STR_PAD_LEFT) . '</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td nowrap="nowrap"><?php echo($L[14]);?></td><td><input type="text" value="<?php echo($_POST['txtMOCVV']);?>" name="txtMOCVV" maxlength="4" size="4"></td>
</tr>
</table>
<?php
} - Just like the Paypal code we load the language at the start. This time though we display a table. Inside this table we now display form elements. It is absolutely essential that you do not change the name of these form elements as you will break the rest of the processor code.
- You can re-arrange and add to the instructions as desired, just keep the structure of the form elements the same.
Last Updated (Wednesday, 31 March 2010 09:05)
Download Express
Commercial Version
Joomla 1.5.x only![]()
[License Information]
AUD$99.99
Current Version
C1.0.0.35
Released: 15-Jun-2011
[Release Notes]
[Upgrade Instructions]
Quick Search
Who's online
We have 52 guests online
