v4.0.x [Modification] Show Category Name in "Featured" Plugins

Discussion in 'Modules / Plugins / Modifications' started by Cotton, Apr 5, 2009.

  1. Cotton Customer

    This is a simple way to add the category name in the stock 68c Featured Plugins.

    Plugins are located in "includes/classes/smarty/plugins"

    For: function.feature_listings_horizontal.php

    Find:

    Code:
    $sSQL="SELECT id,title,price FROM ".PREFIX."listings
    
    Replace with:

    Code:
    $sSQL="SELECT id,title,price,section FROM ".PREFIX."listings
    
    Find:

    Code:
    			$imageSQL = "SELECT image FROM ".PREFIX."prodimages WHERE pid=".$row['id']." ORDER BY rank LIMIT 1";
    			$iResult=$db->query($imageSQL);
    			$irs=$iResult->fetch();
    			if($irs['image']<>"")
    			{
    				 $image="thumbs/small_".$irs['image'];
    			}
    			else
    			{
    				 $image="http://www.68classifieds.com/forums/images/nophoto.gif";
    			}
    
    Directly after add:

    Code:
    			$sectionSQL = "SElECT name FROM ".PREFIX."categories WHERE id=".$row['section'];
    			$sectionResult=$db->query($sectionSQL);
    			$sectionrs=$sectionResult->fetch();
    			$section=$sectionrs['name'];
    
    Find:

    Code:
    		     $tmp = array(
    				'id' => $row['id'],
    				'image'=> $image,
    				'title'=> htmlspecialchars(trim_it($row['title'], 25)),
    				'price'=> FormatCurrency($row['price']),
    
    Directly after add:

    Code:
    				'section'=> $section,
    
    Find:

    Code:
    					//text
    					$output.=$loop[$x][title] ."<br />";
    					if($show_price=='Y')
    					{
    					$output.= $loop[$x][price];
    					}
    
    Replace with:

    Code:
    					//text
    					$output.=$loop[$x][title] ."<br />";
    					$output.=$loop[$x][section] ."<br />";
    					if($show_price=='Y')
    					{
    					$output.=$loop[$x][price];
    					}
    
    That should give your visitors a better idea of which category the featured listing belongs to.

    It does add an additional query to the database, but I havent noticed any change in pageload.

    Modify however you wish. Im sure a join could be used for the query.

    Please dont add it to any paid mods without asking me first.

Share This Page