Tips and Tricks HQ Support Portal › Forums › WP Affiliate Platform › WP Affiliate Tweaks › clickthrough other options
Tagged: clickthrough, display affiliate data
- This topic has 5 replies, 2 voices, and was last updated 13 years, 7 months ago by sparkit.
-
AuthorPosts
-
April 1, 2011 at 6:59 pm #3097sparkitMember
hi, i would like to add another button/function to show the clicktrhough from the admin in different ways.
i have tested the query in the clickthroughs_menu.php and it works: i know it is a bit silly, but how do i add a button which fits with your code? i kind of understand that the date is refreshing the page, and if the variable is set the query is limiting dates.
I have created a similar function to show_last_clickthroughs() called show_filter_clickthroughs(). can you suggest how to link it to a button?
thanks!
April 1, 2011 at 11:42 pm #30992amin007ParticipantIts beyond our product support level teach you how to hook a function to a button. Please try searching Google.
April 2, 2011 at 12:38 am #30993sparkitMemberthat’s not very useful as answer!
maybe i didn’t make it too clear from the message, but it’s not just ‘hooking the function to the button’.
what i was after is a better understanding of how to make a second function, one which filters things differently from the default one, fit in the logic of the plugin, and that’s where i was looking for advice!
doing a google search is not going to tell me an aswer about that…
furthermore, this is the ‘tweaks’ thread: surely discussing how to extend the way clicktrhough is displayed for admins is useful and interesting for the others reading as well?!
April 2, 2011 at 2:06 am #30994amin007ParticipantThere is nothing wrong with you wanting something but please read the 3rd point in the forum rules… it has some explanation:
https://support.tipsandtricks-hq.com/forums/topic/forum-rules
April 2, 2011 at 12:28 pm #30995sparkitMemberhi, there is no other outlet to express this so feel free to remove the whole thread if you want, however i strongly believe that your statement here is damaging your position with customers and the use of the forum itself.
if you look at the history of my posts, *i have already received very valuable answers* in the past and the efforts of the moderators are very much appreciated!
like me, many are learning more about how the plugin works and how small customisation can be added from the forum answers.
The forum is a *community space* where people like me, not programmers but willing to make an extra effort, are asking questions, learning from you and the others and share ideas and tricks to adapt your product for their needs.
you seem to have taken a different view: however the forum is not a ticketing support system (i.e. one way communication with question from customer -> official answer from you) but you seem to enforce this with rules making it like it… if you restrict it you completely lose touch with what customers need and ultimately stifle your developments
this thread is an example of what a forum post *should not* be like as absolutely nothing can be learnt in relation to my original question!
said this, shall we rewind and go back to the original question?
April 2, 2011 at 2:31 pm #30996sparkitMemberSticking to what i said earlier, here is what i have done: these are fairly simple changes that others might want to implement.
1 – Total number of clicks (placed at the top of the table).
in the clicktrhoughs_menu.php there are two functions: one lists clicks by dates and the other only shows the last 100 clicks.
in both, the statement which performs the query is the one starting with the following:
$wp_aff_clicks_db = $wpdb->get_results("SELECT * FROM wp_2_affiliates_clickthroughs_tbl WHERE
to get the totals it is easy to use the defaul WP database interrogation and in this example i print it at the top of the table.
$tot_wp_aff_clicks = $wpdb->get_var($wpdb->prepare("SELECT Count(*) FROM wp_2_affiliates_clickthroughs_tbl"));
echo '<br>Total clicks: </br>' . $tot_wp_aff_clicks;
2- Display different queries.
The way i have done it (by no mean the only way of doing this!) is to add a set of links at the top of the page with an additional url parameter
for example:
<a href="admin.php?page=clickthroughs&clickFilter=1">Last 200</a>
then in the last else statement of the main function i check the url parameter:
if ($_GET["clickFilter"]=='1') {
show_last_clickthroughs();
}this statement shows the existing function with the last 100, but by modifying the query in the function i have also produced a table with the summary of clicks by affiliate like in the following function:
function show_Summary_clickthroughs()
{
echo '<div id="message" class="updated fade"><p><strong>';
echo 'Displaying Total clicks by AFFILIATE';
echo '</strong></p></div>';
// NOTE that this has the same structure as the default function, but only shows 5 columns
echo '
<table class="widefat" width="50%">
<thead><tr>
<th scope="col">'.__('Affiliate ID', 'wp_affiliate').'</th>
<th scope="col">'.__('Total Clicks', 'wp_affiliate').'</th>
<th scope="col">'.__('Impact % value', 'wp_affiliate').'</th>
<th scope="col"></th>
<th scope="col"></th>
</tr></thead>
<tbody>';
global $wpdb;
global $affiliates_clickthroughs_table_name;
// next two lines shows the total clicks
$tot_wp_aff_clicks = $wpdb->get_var($wpdb->prepare("SELECT Count(refid) as 'totalclicks' FROM wp_2_affiliates_clickthroughs_tbl"));
echo '<br>Total clicks: </br>' . $tot_wp_aff_clicks;
// this is the actual query
$wp_aff_clicks_db = $wpdb->get_results("SELECT refid, Count(refid) as 'total', (Count(refid) * 100) as 'impact' FROM wp_2_affiliates_clickthroughs_tbl GROUP BY refid", OBJECT);
if ($wp_aff_clicks_db)
{
foreach ($wp_aff_clicks_db as $wp_aff_clicks_db)
{
echo '<tr>';
echo '<td>'.$wp_aff_clicks_db->refid.'</td>';
echo '<td><strong>'.$wp_aff_clicks_db->total.'</strong></td>';
echo '<td><strong>'. round(($wp_aff_clicks_db->impact) / ($tot_wp_aff_clicks), 2).'</strong></td>';
echo '<td></td>';
echo '<td></td>';
echo '</tr>';
}
}
else
{
echo '<tr> <td colspan="5">'.__('No Click Data Found.', 'wp_affiliate').'</td> </tr>';
}
echo '</tbody>
</table>';
}
i hope that others will find it useful and feedback is very much appreciated!
-
AuthorPosts
- You must be logged in to reply to this topic.