PDA

View Full Version : Admin - Listings By Plan


PassionSeed
02-14-2007, 03:18 PM
v2.1 - The Admin Panel shows the count and status of links. It would be a great addition to the eSC script to see this type of reporting on the plans (a total count of the links assigned to a specific plan and clicking on the link will show the actual links assigned to that plan).

Mark Brookes
02-15-2007, 08:28 AM
Hi PassionSeed

Good Idea... I'd Vote for that :)

Regards
Mark

John Turner
02-15-2007, 10:18 AM
Hi there,

Here solution for you.

1. open '../admin/manage-plans.php'
*** find following code

echo "<th>".$gDirLang['title']."</th>";
echo "<th width=\"40\">".$gDirLang['cost']."</th>";
echo "<th width=\"40\">".$gDirLang['days']."</th>";
echo "<th>".$gDirLang['language']."</th>";
echo "<th>".$gDirLang['order']."</th>";
echo "<th>&nbsp;</th>";
echo "<th class=\"last\">&nbsp;</th>";


*** replace with following code

echo "<th>".$gDirLang['title']."</th>";
echo "<th width=\"40\">Links</th>";
echo "<th width=\"40\">".$gDirLang['cost']."</th>";
echo "<th width=\"40\">".$gDirLang['days']."</th>";
echo "<th>".$gDirLang['language']."</th>";
echo "<th>".$gDirLang['order']."</th>";
echo "<th>&nbsp;</th>";
echo "<th class=\"last\">&nbsp;</th>";


*** find following code

echo "<td width=\"20\"><input type=\"checkbox\" name=\"plans[]\" value=\"".$value['id']."\" class=\"check\" /></td>";
echo "<td width=\"70%\">".$value['title']."</td>";
echo "<td>".$config->get('currency_symbol').$value['cost']."</td>";
echo "<td>".$value['period']."</td>";
echo "<td>".$value['lang']."</td>";
echo "<td><input type=\"text\" size=\"3\" class=\"orderinput\" name=\"order[".$value['id']."]\" value=\"".$value['order']."\" /></td>";


*** replace with following code

echo "<td width=\"20\"><input type=\"checkbox\" name=\"plans[]\" value=\"".$value['id']."\" class=\"check\" /></td>";
echo "<td width=\"70%\">".$value['title']."</td>";

$query = "SELECT count(`id`) FROM `".PREFIX."links` WHERE `sponsored_plan_id`='".$value['id']."'";
$count_links = $Plan->getOne($query);
$go_to_links = $count_links > 0 ? "<a href=\"manage-links.php?state=sponsoredby&plan={$value['id']}\">{$count_links}</a>" : '0';
echo "<td>{$go_to_links}</td>";

echo "<td>".$config->get('currency_symbol').$value['cost']."</td>";
echo "<td>".$value['period']."</td>";
echo "<td>".$value['lang']."</td>";
echo "<td><input type=\"text\" size=\"3\" class=\"orderinput\" name=\"order[".$value['id']."]\" value=\"".$value['order']."\" /></td>";



*** save and close it.


2. open '../admin/manage-links.php'
*** find following code

elseif($state=='all' && ($status=='all' || empty($status)))
{
$links = $Link->getLinks($start, ITEMS_PER_PAGE); //, $calcRows=true);
$links_num = 0;
if($links)
{
$links_num = $Link->one("count(*)");
}
}


*** add after it following code

elseif($state=='sponsoredby' && $_GET['plan'])
{
$links = $Link->getByCriteria($start, ITEMS_PER_PAGE, "WHERE t1.`sponsored_plan_id`='".(int)$_GET['plan']."'");
$links_num = $Link->foundRows();
}


***save and close it.

Hope it helps. :friends:

PassionSeed
02-15-2007, 01:37 PM
Beautiful! I hope this doesn't get lost in the next upgrade.:1st:

Mark Brookes
02-15-2007, 04:40 PM
Hi John,

I can't find the proper code in ver 2.0.01, so I am guessing that it aplies to ver 2.1 ???

I have looked at the files to try and work out how to adapt it but have found it too tricky.
is it possible to adapt for ver 2.0.01?


Thanks
Mark

PassionSeed
02-15-2007, 09:07 PM
I have yet another issue with the plans on the admin side. In v2.0.02 and v2.1 there's a way to delete the plan. But if you no longer wish to offer a particular plan, and there are links assigned to that plan that haven't expired, you really don't want to delete the plan, but you'll need to suspend the plan instead.

I've added a status field in the plans table and an {if $plans.status eq 'active'} clause on the template/suggest-link.tpl file so that new listings can't be added to a suspended plan.

On the admin panel, I've included the status field when you're editing the plan as well as on the manage plans page. Here's the code I used in v2.0.02:

<tr>
<td><strong><?php echo $gDirLang['status']; ?>:</strong></td>
<td><input type="radio" name="status" value="active" id="s1"<?php echo $plan['status'] ? ' checked="checked"' : ''; ?> /><label for="s1"><?php echo $gDirLang['active']; ?></label>
<input type="radio" name="status" value="suspended" id="s2"<?php echo !$plan['status'] ? ' checked="checked" ' : ''; ?> /><label for="s2"><?php echo $gDirLang['suspended']; ?></label>
</td>
</tr>

This code works a little weird in v2.1. No matter what the $plan['status'] is set to, when you edit the plan, it automatically defaults to "active" but I want the radio button to be check based on what's in the $plan['status'] field.

Please help!:(

If you need to view my admin/manage-plans.php file, the same credentials I sent via PM are valid.

John Turner
02-16-2007, 05:17 AM
Hi there,

Beautiful! I hope this doesn't get lost in the next upgrade.
I suppose it will not be difficult to implement it back :)

This changes are useful for V2.0.2

1. open '../admin/manage-plans.php'
*** find following code

echo "<th>{$gDirLang['title']}</th>";
echo "<th width=\"40\">{$gDirLang['cost']}</th>";
echo "<th width=\"40\">{$gDirLang['days']}</th>";
echo "<th>{$gDirLang['order']}</th>";
echo "<th>&nbsp;</th>";
echo "<th class=\"last\">&nbsp;</th>";

*** replace with following code

echo "<th>{$gDirLang['title']}</th>";
echo "<th width=\"40\">Links</th>";
echo "<th width=\"40\">{$gDirLang['cost']}</th>";
echo "<th width=\"40\">{$gDirLang['days']}</th>";
echo "<th>{$gDirLang['order']}</th>";
echo "<th>&nbsp;</th>";
echo "<th class=\"last\">&nbsp;</th>";


*** find following code

echo "<td width=\"20\"><input type=\"checkbox\" name=\"plans[]\" value=\"{$value['id']}\" class=\"check\" /></td>";
$title = $gDirLang['plan_'.$value['id'].'_title'];
echo "<td width=\"70%\">{$title}</td>";
echo "<td>{$gDirConfig['currency_symbol']}&nbsp;{$value['cost']}</td>";
echo "<td>{$value['period']}</td>";
echo "<td><input type=\"text\" size=\"3\" class=\"orderinput\" name=\"order[{$value['id']}]\" value=\"{$value['order']}\" /></td>";
$cause = $page ? "&amp;page={$page}" : '';

*** replace with following code

echo "<td width=\"20\"><input type=\"checkbox\" name=\"plans[]\" value=\"{$value['id']}\" class=\"check\" /></td>";
$title = $gDirLang['plan_'.$value['id'].'_title'];
echo "<td width=\"70%\">{$title}</td>";
$count_links = $gAdminDb->getNumLinksBy(" WHERE t1.`sponsored_plan_id`='{$value['id']}'");
$go_to_links = $count_links > 0 ? "<a href=\"manage-links.php?state=sponsoredby&plan={$value['id']}\">{$count_links}</a>" : '0';
echo "<td>{$go_to_links}</td>";
echo "<td>{$gDirConfig['currency_symbol']}&nbsp;{$value['cost']}</td>";
echo "<td>{$value['period']}</td>";
echo "<td><input type=\"text\" size=\"3\" class=\"orderinput\" name=\"order[{$value['id']}]\" value=\"{$value['order']}\" /></td>";
$cause = $page ? "&amp;page={$page}" : '';


*** save and close it

1. open '../admin/manage-links.php'
*** find following code

elseif($state=='all' && $status=='all') {
$links_num =& $gAdminDb->getNumLinksBy();
$links =& $gAdminDb->getLinks($start, ITEMS_PER_PAGE);
}

*** replace with following code

elseif($state=='all' && $status=='all') {
$links_num =& $gAdminDb->getNumLinksBy();
$links =& $gAdminDb->getLinks($start, ITEMS_PER_PAGE);
}
elseif($state == 'sponsoredby' && $_GET['plan'] > 0)
{
$links_num = $gAdminDb->getNumLinksBy(" WHERE t1.`sponsored_plan_id`='".(int)$_GET['plan']."'");
$links = $gAdminDb->getLinksBy($start, ITEMS_PER_PAGE, "WHERE t1.`sponsored_plan_id`='".(int)$_GET['plan']."'");
}


*** save and close it.

I suppose plan suspending will be implemented in our V2.2

Hope it helps
:friends:

PassionSeed
02-16-2007, 07:21 AM
Hi John,

Maybe I didn't explain it properly. The admin/manage-plans.php page is OK. I've implemented my v2.0.02 changes over to v2.1 as well as the additional column of the total listings per type of plan (Links). The problem is when I click on the button to edit the plan.

I'm having a problem with converting v2.0.02 code to v2.1 code.

This is the v2.0.02 code:
<tr>
<td><strong><?php echo $gDirLang['status']; ?>:</strong></td>
<td><input type="radio" name="status" value="active" id="s1"<?php echo $plan['status'] ? ' checked="checked"' : ''; ?> /><label for="s1"><?php echo $gDirLang['active']; ?></label>
<input type="radio" name="status" value="suspended" id="s2"<?php echo !$plan['status'] ? ' checked="checked" ' : ''; ?> /><label for="s2"><?php echo $gDirLang['suspended']; ?></label>
</td>
</tr>

For example, the status of the Free plan is listed on the admin/manage-plans.php page and in the database as suspended. When I click on the button to edit the plan, the radio button is checked for active instead of suspended. But it functions as expected: it's really suspended as the plan is not listed on the user side as an available plan. How do I get the radio button to reflect the correct status of the plan when I edit the plan.:cry:

Everything else works well in v2.1 for suspending a plan.

Mark Brookes
02-16-2007, 09:42 AM
Hello John

message #7 works for ver 2.0.01 also ... beautifully. :)

A really useful mod, Thanks

Reagrds
mark


PS

... may I refer you to http://www.esyndicat.com/forum/about8964.html

The type of mod you've just designed for showing which sponsored links are associated with which plans, would be Beautiful for associating links with Editors.

Would It be possbile to provide similar code for Editors on http://www.esyndicat.com/forum/about8964.html ... pretty please :)
(Ver 2.0.01 for me please, but I guess ver 2.1 also)

John Turner
02-16-2007, 10:23 AM
PassionSeed,

For example, the status of the Free plan is listed on the admin/manage-plans.php page and in the database as suspended. When I click on the button to edit the plan, the radio button is checked for active instead of suspended. But it functions as expected: it's really suspended as the plan is not listed on the user side as an available plan. How do I get the radio button to reflect the correct status of the plan when I edit the plan

And what happens after you have set suspended for plan?
There isn't status field for plan.

You are welcome Mark.
Always at your services.

Murali
02-16-2007, 10:27 AM
Hello admin,
How create Categories in column wise. I have seen one option in Configuration settings that is Number of columns option. Let’s take below example.
For example: lion king elephant
cat pig zebra
moon sun kite

PassionSeed
02-18-2007, 02:30 PM
Hi John,

When I set a plan's status to suspended, it is displayed on the admin side as suspended (I've included this column next to the Links column) and the plan is not available for users to select on the user side (I included an {if} clause to display only active plans). The database is updated to show the plan as suspended.

I understand this mod is not included in any of your versions, but if I can get it completed and functioning correctly, I will submit it for eSC script users and for you to include in the next version if you want to.

The only quirk that's happening is this on the admin side (user side functions perfectly):

I set the plan's status to suspended and save the plan. When I look at the list of plans (manage-plans.php) the plan is listed as suspended, the status of the plan is updated in the database and the plan is no longer available on the user side. When I click on the same plan to edit it again, instead of the selected status set at suspended, it defaults to active. If you don't save the plan, the plan's status remains as suspended. It's defaulting to active no matter what.%)

You have to see what I'm talking about. May I PM credentials for your review?

PassionSeed,



And what happens after you have set suspended for plan?
There isn't status field for plan.

You are welcome Mark.
Always at your services.

PassionSeed
02-18-2007, 06:28 PM
Hi John,

I fixed the problem. Now suspending plans works perfectly on the admin and user side.:applause:

Now I can suspend plans and show the number of banners and categories on the user side that are included in each plan and it will show only the active plans.:yahoo:

PassionSeed,



And what happens after you have set suspended for plan?
There isn't status field for plan.

You are welcome Mark.
Always at your services.

shelly
04-02-2007, 12:44 AM
Hi there,

Here solution for you.

1. open '../admin/manage-plans.php'
*** find following code

echo "<th>".$gDirLang['title']."</th>";
echo "<th width=\"40\">".$gDirLang['cost']."</th>";
echo "<th width=\"40\">".$gDirLang['days']."</th>";
echo "<th>".$gDirLang['language']."</th>";
echo "<th>".$gDirLang['order']."</th>";
echo "<th>&nbsp;</th>";
echo "<th class=\"last\">&nbsp;</th>";


*** replace with following code

echo "<th>".$gDirLang['title']."</th>";
echo "<th width=\"40\">Links</th>";
echo "<th width=\"40\">".$gDirLang['cost']."</th>";
echo "<th width=\"40\">".$gDirLang['days']."</th>";
echo "<th>".$gDirLang['language']."</th>";
echo "<th>".$gDirLang['order']."</th>";
echo "<th>&nbsp;</th>";
echo "<th class=\"last\">&nbsp;</th>";


*** find following code

echo "<td width=\"20\"><input type=\"checkbox\" name=\"plans[]\" value=\"".$value['id']."\" class=\"check\" /></td>";
echo "<td width=\"70%\">".$value['title']."</td>";
echo "<td>".$config->get('currency_symbol').$value['cost']."</td>";
echo "<td>".$value['period']."</td>";
echo "<td>".$value['lang']."</td>";
echo "<td><input type=\"text\" size=\"3\" class=\"orderinput\" name=\"order[".$value['id']."]\" value=\"".$value['order']."\" /></td>";


*** replace with following code

echo "<td width=\"20\"><input type=\"checkbox\" name=\"plans[]\" value=\"".$value['id']."\" class=\"check\" /></td>";
echo "<td width=\"70%\">".$value['title']."</td>";

$query = "SELECT count(`id`) FROM `".PREFIX."links` WHERE `sponsored_plan_id`='".$value['id']."'";
$count_links = $Plan->getOne($query);
$go_to_links = $count_links > 0 ? "<a href=\"manage-links.php?state=sponsoredby&plan={$value['id']}\">{$count_links}</a>" : '0';
echo "<td>{$go_to_links}</td>";

echo "<td>".$config->get('currency_symbol').$value['cost']."</td>";
echo "<td>".$value['period']."</td>";
echo "<td>".$value['lang']."</td>";
echo "<td><input type=\"text\" size=\"3\" class=\"orderinput\" name=\"order[".$value['id']."]\" value=\"".$value['order']."\" /></td>";



*** save and close it.


2. open '../admin/manage-links.php'
*** find following code

elseif($state=='all' && ($status=='all' || empty($status)))
{
$links = $Link->getLinks($start, ITEMS_PER_PAGE); //, $calcRows=true);
$links_num = 0;
if($links)
{
$links_num = $Link->one("count(*)");
}
}


*** add after it following code

elseif($state=='sponsoredby' && $_GET['plan'])
{
$links = $Link->getByCriteria($start, ITEMS_PER_PAGE, "WHERE t1.`sponsored_plan_id`='".(int)$_GET['plan']."'");
$links_num = $Link->foundRows();
}


***save and close it.

Hope it helps. :friends:

Only a little glitch

This mod has been working fine with 2.1.02 GreenLeaves but now with patch 3

when a sposored link is marked as unsponsored it remains listed as sponsored in manage plans although it is actually unsposored in manage links.

I can correct it in my Data Base but if there is a fix for this that would be great.

I realise you guys are probably going to be quite busy in the Forums with the release of 2.1.03 so it is not urgent:)

Thanks

Shelly