July 4th, 2007phpld Additional Payment Plans
With this mod you can add two new payment plans, 1 featured we will call Featured+ and one regular, we call Regular+. You can adapt this tutorial to add as many payment plans as you would like to.
1. In this step you should add two rows in the PLD_CONFIG. You can use one of the following two methods.
Method 1: run the following Mysql query in phpMyadmin:
INSERT INTO `PLD_CONFIG` (`ID`, `VALUE`) VALUES
('PAY_NORMAL_ADV', '20'), ('PAY_FEATURED_ADV', '50');
Here 20 and 50 are the prices of the different plans, either change them before running the query or can just edit them in the admin panel when you are done adding the MOD.
Method 2:
in include/tables.php
FIND:
array ('ID' => 'PAY_NORMAL', 'VALUE' => '0'),
array ('ID' => 'PAY_FEATURED', 'VALUE' => '0'),
array ('ID' => 'PAY_RECPR', 'VALUE' => '0'),
REPLACE BY:
array ('ID' => 'PAY_NORMAL', 'VALUE' => '0'),
array ('ID' => 'PAY_FEATURED', 'VALUE' => '0'),
array ('ID' => 'PAY_NORMAL_ADV', 'VALUE' => '0'),
array ('ID' => 'PAY_FEATURED_ADV', 'VALUE' => '0'),
array ('ID' => 'PAY_RECPR', 'VALUE' => '0'),
Now rerun the installer by pointing the browser to /install/index.php. You might have to put that file back if you removed it or renamed it. You should also set the writing permissions of /include/config.php.
Now that the new fields are added to the database, remove the install script.
2. in admin/conf_options.php
FIND:
array ('ID' => 'PAY_NORMAL',
'NAME' => _L('Regular price'),
'DESCRIPTION' => _L('Unit price for regular links...'),
'CONFIG_GROUP' => '9',
'TYPE' => 'NUM',
'REQUIRED' => '1'),
array ('ID' => 'PAY_FEATURED',
'NAME' => _L('Featured price'),
'DESCRIPTION' => _L('Unit price for featured links...'),
'CONFIG_GROUP' => '9',
'TYPE' => 'NUM',
'REQUIRED' => '1'),
REPLACE BY:
array ('ID' => 'PAY_NORMAL_ADV',
'NAME' => _L('Regular price +'),
'DESCRIPTION' => _L('Unit price for regular links+ ...'),
'CONFIG_GROUP' => '9',
'TYPE' => 'NUM',
'REQUIRED' => '1'),
array ('ID' => 'PAY_FEATURED_ADV',
'NAME' => _L('Featured price +'),
'DESCRIPTION' => _L('Unit price for featured links+ ...'),
'CONFIG_GROUP' => '9',
'TYPE' => 'NUM',
'REQUIRED' => '1'),
array ('ID' => 'PAY_NORMAL',
'NAME' => _L('Regular price'),
'DESCRIPTION' => _L('Unit price for regular links...'),
'CONFIG_GROUP' => '9',
'TYPE' => 'NUM',
'REQUIRED' => '1'),
array ('ID' => 'PAY_FEATURED',
'NAME' => _L('Featured price'),
'DESCRIPTION' => _L('Unit price for featured links...'),
'CONFIG_GROUP' => '9',
'TYPE' => 'NUM',
'REQUIRED' => '1'),
3. in submit.php
FIND:
if (FTR_ENABLE == 1 && PAY_FEATURED > 0)
$price['featured'] = PAY_FEATURED;
if (PAY_NORMAL > 0)
{
$price['normal'] = PAY_NORMAL;
if (PAY_ENABLE_FREE)
$price['free'] = 0;
}
REPLACE BY:
if (FTR_ENABLE == 1 && PAY_FEATURED > 0)
$price['featured'] = PAY_FEATURED;
if (FTR_ENABLE == 1 && PAY_FEATURED_ADV > 0)
$price['featured_adv'] = PAY_FEATURED_ADV;
if (PAY_NORMAL > 0)
{
$price['normal'] = PAY_NORMAL;
if (PAY_ENABLE_FREE)
$price['free'] = 0;
}
if (PAY_NORMAL_ADV > 0)
{
$price['normal_adv'] = PAY_NORMAL_ADV;
}
FIND:
switch (strtolower ($link_type))
{
case 'free' :
$data['NOFOLLOW'] = 1;
break;
case 'featured' :
$data['FEATURED'] = 1;
break;
default :
break;
}
REPLACE BY:
switch (strtolower ($link_type))
{
case 'free' :
$data['NOFOLLOW'] = 1;
break;
case 'featured' :
$data['FEATURED'] = 1;
break;
case 'featured_adv' :
$data['FEATURED'] = 1;
break;
default :
break;
}
4. in payment.php
FIND:
if (FTR_ENABLE == '1' && PAY_FEATURED > 0)
$price[$link_type_int['featured']] = PAY_FEATURED;
if (PAY_NORMAL > 0)
{
$price[$link_type_int['normal']] = PAY_NORMAL;
if (PAY_ENABLE_FREE)
$price[$link_type_int['free']] = 0;
}
REPLACE BY:
if (FTR_ENABLE == '1' && PAY_FEATURED > 0)
$price[$link_type_int['featured']] = PAY_FEATURED;
if (FTR_ENABLE == '1' && PAY_FEATURED_ADV > 0)
$price[$link_type_int['featured_adv']] = PAY_FEATURED_ADV;
if (PAY_NORMAL > 0)
{
$price[$link_type_int['normal']] = PAY_NORMAL;
if (PAY_ENABLE_FREE)
$price[$link_type_int['free']] = 0;
}
if (PAY_NORMAL_ADV > 0)
{
$price[$link_type_int['normal_adv']] = PAY_NORMAL_ADV;
}
5. in include/constants.php
FIND:
$link_type_int = array ( 'none' => 0, 'free' => 1, 'normal' => 2,
'reciprocal' => 3, 'featured' => 4);
$link_type_str=array ( 0 => _L('None'), 1 => _L('Free'), 2 => _L('Normal'),
3 => _L('Reciprocal'), 4 => _L('Featured'));
REPLACE BY:
$link_type_int = array ( 'none' => 0, 'free' => 1, 'normal' => 2,
'reciprocal' => 3, 'featured' => 4, 'normal_adv' => 5,
'featured_adv' => 6);
$link_type_str = array ( 0 => _L('None'), 1 => _L('Free'),
2 => _L('Normal'), 3 => _L('Reciprocal'),
4 => _L('Featured'), 5 => _L('Normal+'),
6 => _L('Featured+'));
6. in include/functions.php
FIND:
function determine_link_type($type = 0)
{
if (!preg_match ('`^[\d]+$`', $type))
return false;
$type = ($type < 0 || $type > 6 ? 0 : intval ($type));
switch ($type) {
case 4 :
$return = 'featured';
break;
case 3 :
$return = 'reciprocal';
break;
case 2 :
$return = 'normal';
break;
case 1 :
$return = 'free';
break;
case 0 :
default :
$return = 'none';
break;
}
return (!empty ($return) ? $return : false);
}
REPLACE BY
function determine_link_type($type = 0)
{
if (!preg_match ('`^[\d]+$`', $type))
return false;
$type = ($type < 0 || $type > 6 ? 0 : intval ($type));
switch ($type) {
case 6 :
$return = 'featured_adv';
break;
case 5 :
$return = 'normal_adv';
break;
case 4 :
$return = 'featured';
break;
case 3 :
$return = 'reciprocal';
break;
case 2 :
$return = 'normal';
break;
case 1 :
$return = 'free';
break;
case 0 :
default :
$return = 'none';
break;
}
return (!empty ($return) ? $return : false);
}
We are almost done, we only need to modify the submit form to show the additional payment plans.
in submit.tpl
FIND
{if $price.featured}
ABOVE that, ADD:
{if $price.featured_adv}
<tr><td>
<input type="radio" name="LINK_TYPE" value="featured_adv"
{if $LINK_TYPE eq 'featured_adv'}checked="true"{/if}>
{l}Featured links +{/l}
</td><td>
{$smarty.const.HTML_CURRENCY_CODE}{$price.featured_adv}
</td>
</tr>
{/if}
FIND
{if $price.normal gt 0}
ABOVE that, ADD:
{if $price.normal_adv gt 0}
<tr>
<td><input type="radio" name="LINK_TYPE" value="normal_adv"
{if $LINK_TYPE eq 'normal_adv'}checked="true"{/if}>
{l}Regular links +{/l}
</td>
<td>{$smarty.const.HTML_CURRENCY_CODE}{$price.normal_adv}
</td>
</tr>
{/if}
You are done! If you are combining this with the deep links mod, you should place onclick="regular();";, onclick="featured();";, onclick="no_deeplinks();"; in the appropriate radio buttons.
Below is the javascript needed
{literal}
<script language="JavaScript">
function setVisibility(id, visibility) {
document.getElementById(id).style.display = visibility;
}
function featured(){
setVisibility('field1_title', '');
setVisibility('field1_url', '');
setVisibility('field2_title', '');
setVisibility('field2_url', '');
setVisibility('field3_title', '');
setVisibility('field3_url', '');
setVisibility('field4_title', '');
setVisibility('field4_url', '');
setVisibility('field5_title', '');
setVisibility('field5_url', '');
}
function regular(){
setVisibility('field1_title', '');
setVisibility('field1_url', '');
setVisibility('field2_title', '');
setVisibility('field2_url', '');
setVisibility('field3_title', '');
setVisibility('field3_url', '');
setVisibility('field4_title', 'none');
setVisibility('field4_url', 'none');
setVisibility('field5_title', 'none');
setVisibility('field5_url', 'none');
}
function no_deeplinks(){
setVisibility('field1_title', 'none');
setVisibility('field1_url', 'none');
setVisibility('field2_title', 'none');
setVisibility('field2_url', 'none');
setVisibility('field3_title', 'none');
setVisibility('field3_url', 'none');
setVisibility('field4_title', 'none');
setVisibility('field4_url', 'none');
setVisibility('field5_title', 'none');
setVisibility('field5_url', 'none');
}
</script>
{/literal}
Please refer to the deep links mod for more details on this. fieldX_title and fieldX_url are the ids of the rows corresponding the deep links fields, as explained in the deeplinks mod.
12 Responses to “phpld Additional Payment Plans”
Leave a Reply
You must be logged in to post a comment.

July 9th, 2007 at 6:59 pm
Hi sir i m having a slight problem here : http://www.Linksrevo.com
Please take a look .. i have done all the steps perfect. Dont know where is the problem . Please guide me through it.
Thanks
July 9th, 2007 at 7:03 pm
Actually cant understand wht you said here :
You are done! If you are combining this with the deep links mod, you should place onclick=”regular();”;, onclick=”featured();”;, onclick=”no_deeplinks();”; in the appropriate radio buttons.
Below is the javascript needed
July 10th, 2007 at 3:33 am
Wow Its working Perfect Now i just take a deep look on the codes and find the answer. Thanks bro You really put a Great effort to make it. I’ll be looking forward on the upcoming latest mods by you.
Thanks
July 10th, 2007 at 3:25 pm
Hi sir i m having a problem here now that is when i submit any link it says : An error occured while saving the link.
Please guide me through this
August 8th, 2007 at 3:18 am
I couldn’t understand some parts of this article phpld Additional Payment Plans, but I guess I just need to check some more resources regarding this, because it sounds interesting.
August 22nd, 2007 at 6:41 am
Thanks, can you do it for version 2.0, when i try to modify i could not find the code “function determine_link_type($type = 0)” in include/function.php
Thanks
September 8th, 2007 at 11:13 pm
Hi admin,
I have set the code perfectly correct( I already double check), but when I login to the admin section and set the price for the feature_advance and normal_advance. After I click to update the price, It is automaticly change to blank again. What should I do now? I am using phpld 3.2
Another question is what is the different between the feature_advance and feature link? and between normal and normal_advance link?
thanks
May 20th, 2008 at 2:22 pm
I get the following error in my admin section:
Notice: SmartyValidate: [is_valid] form ‘conf_settings’ is not registered. in /home/abacklin/public_html/libs/smarty/SmartyValidate.class.php on line 274
Followed instructions word for word. I have phpld 3.2 if that helps
June 29th, 2008 at 10:25 pm
[...] Additional Payment Plans (Rakcha.com): With this mod you can add two new payment [...]
July 11th, 2008 at 10:37 pm
[...] Additional Payment Plans (Rakcha.com): With this mod you can add two new payment [...]
December 14th, 2008 at 5:45 am
[...] I am looking for someone whoknows PHPLD and has done updates with ver 3.3 and Mod additions before.I want to add the Additional Payment Plans Mod from http://blog.rakcha.com/2007/07/04/phpld-additional-payment-plans/. [...]
July 22nd, 2009 at 8:16 am
Is this mod compatible with PHPld ver3.3? Is there a PHPld 3.3 tutorial like the one on your site?