Jump to content

Recommended Posts

I am attempting to change the currency from $ to € in a script i purchased.

In addons/paypal-gateway there are 3 folders.

 

Folder 1 "admin" holds index.php

<?session_start();
require("../../../includes/vars.inc.php");
require("../../../includes/functions.inc.php");
require("../../../includes/templates.inc.php");
require("../../../includes/apt_functions.inc.php");
$access_level=_ADMINLEVEL_;

db_connect(_DBHOSTNAME_,_DBUSERNAME_,_DBPASSWORD_,_DBNAME_,_PCONN_);
check_login_member();

$tpl = new phemplate(_BASEPATH_."/addons/gateway-paypal/templates/",'remove_nonjs');
$tpl->set_file('content','admin/sell_plans.html');

$message='';
if ($_SERVER['REQUEST_METHOD']=='POST') {
$plan_id=addslashes_mq($_POST['plan_id']);
$plan_name=addslashes_mq($_POST['plan_name']);
$plan_diz=addslashes_mq($_POST['plan_diz']);
$amount=addslashes_mq($_POST['amount']);
$rec_period=addslashes_mq($_POST['rec_period']);
$rec_increment=addslashes_mq($_POST['rec_increment']);
$query="UPDATE sell_plans_paypal SET plan_name='$plan_name',plan_diz='$plan_diz',amount='$amount',recurring=1,rec_period='$rec_period',rec_increment='$rec_increment' WHERE plan_id='$plan_id'";
if (!($res=mysql_query($query))) {general_error(mysql_error(),__LINE__,__FILE__);}
}

if (isset($_GET['act']) && !empty($_GET['act'])) {
$action=addslashes_mq($_GET['act']);
if ($action=='delete') {
	$plan_id=addslashes_mq($_GET['plan_id']);
	$query="DELETE FROM sell_plans_paypal WHERE plan_id='$plan_id'";
	if (!($res=mysql_query($query))) {general_error(mysql_error(),__LINE__,__FILE__);}
} elseif ($action=='add') {
	$query="INSERT INTO sell_plans_paypal SET plan_name=''";
	if (!($res=mysql_query($query))) {general_error(mysql_error(),__LINE__,__FILE__);}
}
}

$query="SELECT plan_id,plan_name,plan_diz,amount,rec_period,rec_increment FROM sell_plans_paypal";
if (!($res=mysql_query($query))) {general_error(mysql_error(),__LINE__,__FILE__);}
$plans=array();
if (mysql_num_rows($res)) {
$i=0;
while ($rsrow=mysql_fetch_row($res)) {
	$plans[$i]['plan_id']=$rsrow[0];
	$plans[$i]['plan_name']=$rsrow[1];
	$plans[$i]['plan_diz']=$rsrow[2];
	$plans[$i]['amount']=$rsrow[3];
	$plans[$i]['rec_period']=$rsrow[4];
	$plans[$i]['rec_increment']="<option value='D' ".(($rsrow[5]=='D') ? ("selected") : ("")).">Days</option>\n";
	$plans[$i]['rec_increment'].="<option value='W' ".(($rsrow[5]=='W') ? ("selected") : ("")).">Weeks</option>\n";
	$plans[$i]['rec_increment'].="<option value='M' ".(($rsrow[5]=='M') ? ("selected") : ("")).">Months</option>\n";
	$plans[$i]['rec_increment'].="<option value='Y' ".(($rsrow[5]=='Y') ? ("selected") : ("")).">Years</option>\n";
	$i++;
}
}
$tpl->set_loop('plans',$plans);
$content=$tpl->process('out','content',1);
$tpl = new phemplate(_TPLPATH_,'remove_nonjs');
$tpl->set_file('frame','admin/frame.html');
$tpl->set_var('title','Sell Plans');
$tpl->set_var('content',$content);
$tpl->set_var('message',$message);
$tpl->set_var('baseurl',_BASEURL_);
$tpl->set_var('relative_path',$relative_path);
$tpl->set_var('addon_links',insert_addon_admin_links());
print $tpl->process('out','frame');
?>

 

Folder 2 "includes" holds apt_functions.inc.php

<?
define('_CARTMODULE_','paypal');
define('_PAYPAL_BIZNAME_','sales@sites.com'); // your PayPal business email if you use paypal


function display_subscribe_plans() {
return display_subscribe_plans_paypal();
}


function display_subscribe_plans_paypal() {
$tpl = new phemplate(_BASEPATH_."/addons/gateway-paypal/templates/",'remove_nonjs');
$tpl->set_file('middlecontent','subscribe_paypal.html');
$tpl->set_var('baseurl',_BASEURL_);
$tpl->set_var('sitename',_SITENAME_);
$tpl->set_var('mybizemail',_PAYPAL_BIZNAME_);
$tpl->set_var('user_id',$_SESSION['user_id']);
$query="SELECT plan_id,plan_name,plan_diz,amount,recurring,rec_period,rec_increment,buys FROM sell_plans_paypal";
if (!($res=mysql_query($query))) {error(mysql_error(),__LINE__,__FILE__);}
if (mysql_num_rows($res)) {
	$payplans=array();
	$i=0;
	while ($rsrow=mysql_fetch_row($res)) {
		list($plan_id,$plan_name,$plan_diz,$amount,$recurring,$rec_period,$rec_increment,$buys)=$rsrow;
		$payplans[$i]['plan_id']=$plan_id;
		$payplans[$i]['plan_name']=$plan_name." (\$$amount)";
		$payplans[$i]['plan_diz']=$plan_diz;
		$payplans[$i]['amount']=$amount;
		$payplans[$i]['rec_period']=$rec_period;
		$payplans[$i]['rec_increment']=$rec_increment;
		$i++;
	}
	$tpl->set_loop('payplans',$payplans);
}
return $tpl->process('out','middlecontent',1,true);
}
?>

 

Folder 3 has a couple of files

"subscribe_paypal.html"

{h_menu}
<table cellspacing="5" cellpadding="0" width="100%" border="0">
<tr>
<td class="headertext">Subscribe<td>
</tr>
<tr>
<td align="center"><font class="alert">{message}</font></td>
</tr>
<tr>
<td class=textspace>
To become a premier member please use the signup form below. Subscriptions are handled by PayPal
payment services. Subscriptions are handled on a recurring basis. PayPal will continue to bill you according to the
cycle you select below until you cancel your membership.

<table width=100% cellpadding="5" align="center">
<loop name="payplans">
<tr>
	<td align="center">
	<table width=100% cellpadding=2 cellspacing=2 border=0><tr>
	<td class=subheadertext width=30%>{payplans.plan_name}</td>
	<td class=headertext width=55%>{payplans.plan_diz}</td>
	<td valign=middle class=border align=center width=15%>
		<form action="http://www.paypal.com/cgi-bin/webscr" method="post">
		<input type="hidden" name="cmd" value="_xclick-subscriptions" />
		<input type="hidden" name="business" value="{mybizemail}" />
		<input type="hidden" name="no_shipping" value="1" />
		<input type="hidden" name="return" value="{baseurl}/addons/gateway-paypal/paypal_thankyou.php" />
		<input type="hidden" name="cancel_return" value="{baseurl}/subscribe.php" />
		<input type="hidden" name="no_note" value="1" />
		<input type="hidden" name="quantity" value="1" />
		<input type="hidden" name="no_shipping" value="1" />
		<input type="hidden" name="rm" value="2" />
		<input type="hidden" name="item_name" value="{payplans.plan_name}" />
		<input type="hidden" name="item_number" value="{payplans.plan_id}" />
		<input type="hidden" name="p3" value="{payplans.rec_period}" />
		<input type="hidden" name="t3" value="{payplans.rec_increment}" />
		<input type="hidden" name="a3" value="{payplans.amount}" />
		<input type="hidden" name="custom" value="{user_id}" />
		<input type="hidden" name="src" value="1" />
		<input type="hidden" name="sra" value="1" />
					<input class="aptbutton" type="submit" value="Buy with PayPal" />

		</td><td></form></td></tr></table>
	</td>
</tr>
</loop name="payplans">
</table>
</td>
</tr>
</table>

 

"interface_single_item.html"

<table cellpadding="5" align="center">
<tr>
<td class="headertext" align="center">
	<form action="http://www.paypal.com/cgi-bin/webscr" method="post">
	<input type="hidden" name="cmd" value="_xclick" />
	<input type="hidden" name="business" value="{mybizemail}" />
	<input type="hidden" name="no_shipping" value="1" />
	<input type="hidden" name="return" value="{baseurl}/addons/gateway-paypal/paypal_thankyou.php" />
	<input type="hidden" name="cancel_return" value="{baseurl}/subscribe.php" />
	<input type="hidden" name="no_note" value="1" />
	<input type="hidden" name="quantity" value="1" />
	<input type="hidden" name="no_shipping" value="1" />
	<input type="hidden" name="rm" value="2" />
	<input type="hidden" name="item_name" value="{item_name}" />
	<input type="hidden" name="amount" value="{amount}" />
	<input type="hidden" name="custom" value="{user_id}" />
	<input type="hidden" name="src" value="1" />
	<input type="hidden" name="sra" value="1" />
	{item_name}<br />
	{item_diz}<br />
	<input class="aptbutton" type="submit" value="Buy" />
	</form>
</td>
</tr>
</table>

 

and "sell_plans.html"

<table>

<tr>

<td colspan="6" height="30">

	Make changes to the desired plan and click the coresponding submit button:<br />

</td>

</tr>

</table>

<table>

<tr class=hcell align="center">

<td></td>

<td><font class=hcellfont>Plan Name</font></td>

<td><font class=hcellfont>Plan Description</font></td>

<td><font class=hcellfont>Amount</font></td>

<td align="center"><font class=hcellfont>Period</font></td>

<td align="center"><font class=hcellfont>Term</font></td>

<td></td>

</tr>

<loop name="plans">

<form action="{relative_path}index.php" method="post">

<input type="hidden" name="plan_id" value="{plans.plan_id}">

<tr>

<td class=admcell><a href="{relative_path}index.php?act=delete&plan_id={plans.plan_id}">Delete</a></td>

<td class=admcell><input type="text" size="15" name="plan_name" value="{plans.plan_name}" /></td>

<td class=admcell><input type="text" size="20" name="plan_diz" value="{plans.plan_diz}" /></td>

<td class=admcell><input type="text" size="5" name="amount" value="{plans.amount}" /></td>

<td class=admcell align="center"><input type="text" size="3" name="rec_period" value="{plans.rec_period}" /></td>

<td class=admcell>

	<select name="rec_increment" size="1">

	{plans.rec_increment}

	</select>

</td>

<td class=admcell><input type="submit" value="Change"/></td>

</tr>

</form>

</loop name="plans">

<tr>

<td colspan="6" height="30" align="center">

	<a href="{relative_path}index.php?act=add">Add new plan</a>

</td>

</tr>

</table>

 

The script itself does not have the normal config.php to change currency.

Is there something in the above new to me? all i need to do is change currency to euros.

Link to comment
https://forums.phpfreaks.com/topic/168797-baffled-by-gateway-paypal/
Share on other sites

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.