Most Popular, Newest Listings, Highest Rated

This is a discussion on Most Popular, Newest Listings, Highest Rated within the v3.1 Modules & Modifications forums, part of the v3.1 Legacy Help & Support category; How can I have Most Popular, Newest Listings, Highest Rated on my 68c ? Does any one knows this? This ...


Go Back   68 Classifieds Forums > v3.1 Legacy Help & Support > v3.1 Modules & Modifications

 
LinkBack Thread Tools Display Modes
  #1  
Old 01-10-2007, 03:44 PM
Member
 
Join Date: Dec 2006
Posts: 95
Rep Power: 10
Default Most Popular, Newest Listings, Highest Rated

How can I have Most Popular, Newest Listings, Highest Rated on my 68c? Does any one knows this? This is in the link here: http://www.68classifieds.com/modifications/

Thanks for help!

--------------------------------------------
well, I think I found the answer in another thread
http://www.68classifieds.com/documen...s#New_Listings


Last edited by darek; 01-10-2007 at 03:54 PM.
Reply With Quote
  #2  
Old 01-10-2007, 05:28 PM
68 Classifieds Staff
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 4,321
Rep Power: 99
Default

Here is the exact code we are using.

Home.tpl.php template file:
Code:
<table cellpadding="0" cellspacing="0" class="tableborder">
    <tr>
        <th width="33%">Most Popular</th>
        <th width="33%">Newest Listings</th>
        <th width="33%">Highest Rated</th>
    </tr>
    <tr>
        <td valign="top" style="border-right: 1px solid #ccc;">{most_viewed number=5}</td>
        <td valign="top" style="border-right: 1px solid #ccc;">{new_listings number=5}</td>
        <td valign="top">{highest_rated number=5}</td>
    </tr>
</table>
includes/classes/smarty/plugins/function.highest_rated.php
PHP Code:
<?php
/***********************************************************************
| 68 Classifieds developed by 68 Designs, LLC.
|-----------------------------------------------------------------------
| All source code & content (c) Copyright 2005, 68 Designs LLC
|   unless specifically noted otherwise.
|
|The contents of this file are protect under law as the intellectual property
| of 68 Designs, LLC. Any use, reproduction, disclosure or copying
| of any kind without the express and written permission of 68 Designs, LLC is forbidden.
|
| Author $Author: Eric $ (68 Classifieds)
| Version $Revision: 1.1 $
| Updated: $Date: 2006/03/14 16:08:04 $
| ______________________________________________________________________
|    http://www.68classifieds.com      http://www.68designs.com/
***********************************************************************/
function smarty_function_highest_rated($params, &$smarty)
{
    global 
$db;
 
    
$number=4;

    foreach (
$params as $_key=>$_value
    {
        switch (
$_key
        {
            case 
'number':
                $
$_key = (int)$_value;
                break;
        }
    }
        
            
$sSQL="SELECT lid, p.title, ROUND(AVG(score)) AS rank FROM ".PREFIX."rating LEFT JOIN ".PREFIX."products AS p ON lid=p.id WHERE approved='Y' AND p.expiration > NOW() AND p.display = 'Y' GROUP BY lid ORDER BY rank";
            
$result2=$db->query($sSQL);
            
$output="<ol>";
            while(
$row=$result2->fetch())
            {
                
//echo $row['lid'] .' '. $row['rank'];
                
$output.='<li><a href="viewlisting.php?view='.$row['lid'].'">'.$row['title'].'</a>';
                
$output.='<br />'.$row['rank'].' out of 5 stars.</li>';
            }
            
$output.="</ol>";
        
    return 
$output;
}
?>
includes/classes/smarty/plugins/function.most_viewed.php
PHP Code:
<?php
/***********************************************************************
| 68 Classifieds developed by 68 Designs, LLC.
|-----------------------------------------------------------------------
| All source code & content (c) Copyright 2005, 68 Designs LLC
|   unless specifically noted otherwise.
|
|The contents of this file are protect under law as the intellectual property
| of 68 Designs, LLC. Any use, reproduction, disclosure or copying
| of any kind without the express and written permission of 68 Designs, LLC is forbidden.
|
| Author $Author: Eric $ (68 Classifieds)
| Version $Revision: 1.1 $
| Updated: $Date: 2006/03/14 16:08:04 $
| ______________________________________________________________________
|    http://www.68classifieds.com      http://www.68designs.com/
***********************************************************************/
function smarty_function_most_viewed($params, &$smarty)
{
    global 
$db;
 
    
$number=4;

    foreach (
$params as $_key=>$_value
    {
        switch (
$_key
        {
            case 
'number':
                $
$_key = (int)$_value;
                break;
        }
    }

        
$sSQL="SELECT p.id, p.title, p.section, p.description, p.hitcount, c.name FROM ".PREFIX."products AS p LEFT JOIN ".PREFIX."categories AS c ON p.section=c.id WHERE p.expiration > NOW() AND p.display = 'Y' ORDER BY hitcount DESC LIMIT "$number;
        
$result=$db->query($sSQL);
        
$i=0;
        
$output="<ol>";
        while(
$row=$result->fetch())
        {
             
$output.='<li><a href="viewlisting.php?view='.$row['id'].'">'.$row['title'].'</a>';
             
$output.='<br />'.$row['hitcount'].' Views</li>';
             
//$output.='</li>';
        
}
        
$output.="</ol>";
    return 
$output;
}
?>
includes/classes/smarty/plugins/function.new_listings.php
PHP Code:
<?php
/**************************************************  *********************
| 68 Classifieds developed by 68 Designs, LLC.
|-----------------------------------------------------------------------
| All source code & content (c) Copyright 2005, 68 Designs LLC
|   unless specifically noted otherwise.
|
|The contents of this file are protect under law as the intellectual property
| of 68 Designs, LLC. Any use, reproduction, disclosure or copying
| of any kind without the express and written permission of 68 Designs, LLC is forbidden.
|
| Author $Author: Eric $ (68 Classifieds)
| Version $Revision: 1.1 $
| Updated: $Date: 2006/03/14 16:08:04 $
| __________________________________________________  ____________________
|    http://www.68classifieds.com      http://www.68designs.com/
**************************************************  *********************/
/**
 * Include the {@link shared.make_timestamp.php} plugin
 */


function smarty_function_new_listings($params, &$smarty)
{
    global 
$db;
 require_once 
$smarty->_get_plugin_filepath('shared','make_timestamp');
    
$number=4;

    foreach (
$params as $_key=>$_value
    {
        switch (
$_key
        {
            case 
'number':
                $
$_key = (int)$_value;
                break;
        }
    }

        
$sSQL="SELECT p.id, p.owner, p.title, p.featured, p.section, p.description, p.price, p.dateadded, p.expiration, p.pHighlighted, p.pBold, u.state, u.city, u.country FROM ".PREFIX."products AS p LEFT JOIN ".PREFIX."users AS u ON p.owner = u.id WHERE p.expiration > NOW() AND p.display = 'Y' ORDER BY p.dateadded DESC LIMIT "$number;
        
$result=$db->query($sSQL);
        
$i=0;
        
$output="<ol>";
        while(
$row=$result->fetch())
        {
             
$output.='<li><a href="viewlisting.php?view='.$row['id'].'">'.$row['title'].'</a>';
             
$output.='<br />'.new_listings_date_format($row['dateadded']).'</li>';
             
//$output.='</li>';
        
}
        
$output.="</ol>";
    return 
$output;
}
function 
new_listings_date_format($string$format="%b %e, %Y"$default_date=null)
{
    if (
substr(PHP_OS,0,3) == 'WIN') {
           
$_win_from = array ('%e',  '%T',       '%D');
           
$_win_to   = array ('%#d''%H:%M:%S''%m/%d/%y');
           
$format str_replace($_win_from$_win_to$format);
    }
    if(
$string != '') {
        return 
strftime($formatsmarty_make_timestamp($string));
    } elseif (isset(
$default_date) && $default_date != '') {
        return 
strftime($formatsmarty_make_timestamp($default_date));
    } else {
        return;
    }
}
?>
__________________
Eric Barnes
68 Classifieds Developer
Please do not send me a private message asking for support. Instead use these open forums or our ticket system.

Customer Area | Issue Tracker | Documentation | 68C Mods | Submit a Ticket | Twitter
Reply With Quote
  #3  
Old 01-12-2007, 09:34 AM
Member
 
Join Date: Dec 2006
Posts: 95
Rep Power: 10
Default

Yeas, thank you Eric, I also managed to get the highlighted in the front end too.
Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Top Listings sbuell20 v3.1 Questions & Support 0 09-02-2006 01:11 PM
Help? Newest listings on homepage showing ALL Listings zman78 v3.1 Modules & Modifications 5 05-26-2006 08:47 PM
Newest Listings On Home Page zman78 v3.1 Modules & Modifications 24 05-26-2006 09:23 AM


All times are GMT -4. The time now is 07:56 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22