PDA

View Full Version : featured listings for category



Pete Young
January 27, 2013, 11:58 PM
{include file='blocks'|cat:$smarty.const.RL_DS|cat:'feature d.tpl' listings=$featured_listings type='listings'}

In the featured listing block there is this code, is there any way i could rewrite this code to where it has listing type to also just include a category and all sub categories please, lets say i had a category called books ? how could i write that code, then if i had had say a sub category called books > old books ? how would that path be set up ?

Thanks for any help.

Viktor
January 28, 2013, 04:39 AM
Hello Pete,

Do you want show in this block only listings from category and their subcategories. For example if my location is Audi I can see featured listings from audi and from all his subcategories isn't it?

and what should show in this block if my location is home page?

Pete Young
January 28, 2013, 06:56 AM
Victor the home page one is fine, but what i want to to is add a featured block up top of each main category with just featured items from that category, and wondering if that code could be refined to show featured from just a set category.

Viktor
January 28, 2013, 11:02 AM
Hello Pete,

go to ftp://includes>>classes>>rlListings.class.php

find method: getFeatured and code:


global $rlValid;

and replace to:


global $rlValid, $rlCategories, $config, $rlCommon;

then find code:



if ( !$type )
{
return false;
}

and add new after that:



$get = explode('/', $_GET['rlVareables']);
if ( $config['mod_rewrite'] )
{
$category = $rlCategories -> getCategory( false, $get[0]);
}
else
{
$category = $rlCategories -> getCategory( $_GET['category'] );
}
if($category)
$cat_children = $rlCommon -> getChildren($category['ID'], 'Categories', 'active');



then find code:


$sql .= "AND `T1`.`Status` = 'active' AND `T4`.`Status` = 'active' AND `T7`.`Status` = 'active' ";

and after that add new:



if( $cat_children )
{
$sql .= "AND (`T1`.`Category_ID`= '". implode("' OR `T1`.`Category_ID` = '", $cat_children) ."')";
}


save and check.

Pete Young
January 31, 2013, 09:42 AM
thanks victor will try that and let you know
Pete

Daniel Loiselle
December 12, 2013, 02:57 AM
Hello Viktor,

I recently bought the latest version of general classified and I would like to have the same featured asked by Pete. On my home page, random featured ads from all the categories. On a specific categorie listing page, random featured ads related to this categorie only. Unfortunately, I was unable to find the second part of the code in my script. Any ideas? Thanks!