X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Adding 10 latest referals section in statistics (https://forum.x-cart.com/showthread.php?t=9556)

amy2203 09-25-2004 11:43 PM

Adding 10 latest referals section in statistics
 
I'm trying to add a 10 latest referals section to my statistics page.

I've copied and pasted the section from referals underneath it as a starting point, but I can't work out what is controlling the order that the referals are listed in. I mean the main referals list lists them in order of number of visits, I simply want to reorder them by last_visited.

Any guidance on what I need to change? I can't tell which peice of code controls the order. I've pasted the code for the section below, this creates the new area, but at the moment it still feeds in the same referals data as normal

Code:

{if ($referers_array != "")}


{include file="customer/main/navigation.tpl"}
{capture name=dialog}
<table width="100%" border="0" cellspacing="2" cellpadding="0">
{section name=index loop=$referers_array}
<tr>
  <td valign="top" width="90%" class=Text>{$referers_array[index].referer}</td>
  <td valign="top" width="67" class=Text>
    <div valign=bottom align="right">{$referers_array[index].visits}</div>
  </td>
  <td width="1"></td>
 <td>
  <table width="100" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="50">{$referers_array[index].last_visited|date_format:"%d/%m/%y - %H:%M"}</td>
        </tr>
  </table>       
  </td>
</tr>
{/section}
</table>
{/capture}
{include file="dialog.tpl" title="10 Latest Referals" content=$smarty.capture.dialog extra="width=100%"}
{/if}


Thanks

Amy

amy2203 09-26-2004 02:39 AM

I've found it, I had to change the PHP file instead. In case anyone is wondering, this is how I did it (I haven't limited it yet to the latest 10)

display_stats.php

I added:

Code:

#
# Prepare statistics on referers for 10 latest referrers section
#

        $latest_referers_array = func_query("SELECT * FROM $sql_tbl[referers] ORDER BY last_visited DESC LIMIT $first_page, $objects_per_page");
       

$smarty->assign("latest_referers_array", $latest_referers_array);


and then changes the references in advanced_statistics.tpl to reference the latest_referrers_array instead of the array previously created.

Amy


All times are GMT -8. The time now is 01:48 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.