In the Admin area, is there any way to create a counter so it adds up the total clicks and total products and displays it at the bottom?
For instance, as the code outputs the feedname and other details, could the number of clicks be added to $totalclicks (which would be defined at the top of the code as 0) and the same for $totalproducts.
Then at the bottom at the end of the feeds, print:
<?php
echo "<p><strong>Essential Statistics</strong><br />Total number of products: ".$totalproducts."<br />";
echo "Total number of clicks: ".$totalclicks."</p>";
?>
David,
This is already on the current version, isnt it ?
Eddie
Hi Eddie,
There has never been any summary information; although I think I remember having helped you do a similar mod in the past...
David,
OK - I see what you mean. Can youpost the toalt code bloack please anbd confirm where it can /should be added.
Eddie
Hi Eddie,
All the code is in this thread - the section at the top (to display the results) goes at the end of admin/index.php, immediately before:
require("admin_footer.php");
The code to increment the counters as indicated in the post (first reply in this thread)...
Cheers,
David.
David,
I get:
Essential Statistics
Total number of products: 0
Total number of clicks: 396
Eddie
Sorry Eddie - typo, it should be:
$totalproducts += $feeds[$filename]["products"];
$totalclicks += $feeds[$filename]["clicks"];
(missed an "s" off the end of products!)
Cheers,
David.
David,
Trying to format:
echo "Essential StatisticsTotal number of products: ".$totalproducts."";
echo "Total number of clicks: ".number_format($totalclicks)."";
Hi Eddie,
number_format() should work fine in this situation. Are you having trouble getting it to produce the format you want?
David,
echo "<p><strong>Essential Statistics</strong><br />Total number of products: ".$totalproducts."<br />";
echo "Total number of clicks: ".number_format($totalclicks)."</p>";
Displays -
Essential Statistics
Total number of products: 132221
Hi Eddie,
You don't yet have number_format() around $totalproducts; and you've not included the second line of output - the total number of clicks but I assume that number_format() is working correctly?
Try this:
echo "<p><strong>Essential Statistics</strong><br />Total number of products: ".number_format($totalproducts)."<br />";
echo "Total number of clicks: ".number_format($totalclicks)."</p>";
Cheers,
David.
David,
School boy error on my part - all working now.
Eddie
Works like a treat. Many thanks.
By the way:
Essential Statistics
Total number of products: 159,163
Total number of clicks: 179,427
at UK Price Comparison Search in 2 months! Nice!
Hi,
Sure - no problem. The two variables you need to use in the loop are:
$feeds[$filename]["product"]
$feeds[$filename]["clicks"]
The loop to display registered feeds starts with:
if (isset($feeds[$filename]["registered"]))
{
...so just add the following lines immediately afterwards:
$totalproducts += $feeds[$filename]["product"];
$totalclicks += $feeds[$filename]["clicks"];
Hope this helps!
David.