The WorksForWeb Community Forums
Welcome to the WorksForWeb community forums. Here you can discuss WorksForWeb products with others and contribute to the rapidly growing WorksForWeb community. Please note that while WorksForWeb staff try to maintain presence on the forums, this is not the most reliable way to contact WorksForWeb staff. In case you require a timely response from WorksForWeb on an issue, please open a support ticket here. For pre-sales questions, please open a sales ticket here.

Welcome, Guest. Please login or register.
September 03, 2010, 03:06:32 AM

Login with username, password and session length
Search:     Advanced search
Added the iLister-related Boards

Rate My Site Boards Added

Merged iAuto and iRealty Support Forums together

Several new tips in the Tips and Tricks section
1,433 Posts in 564 Topics by 939 Members
Latest Member: gliscasiara
* Home Help Search Login Register
+  The iAuto/iRealty/iLister Support Forum
|-+  iAuto, iRealty and iLister v.4.x
| |-+  General iRealty Discussions
| | |-+  Featured Listing by listing type
« previous next »
Pages: [1] Print
Author Topic: Featured Listing by listing type  (Read 447 times)
Dinkum
Newbie
*

Karma: 0
Posts: 5


View Profile
« on: February 04, 2010, 06:18:32 PM »

Currently featured listings in Irealty shows a mix of featured properties from HomesforSale and HomesforRent.

How do I change it that on certain pages it only shows HomesforSale or HomesforRent?

Thanks
Logged
nikolosnet
Newbie
*

Karma: 2
Posts: 8


View Profile
« Reply #1 on: February 05, 2010, 03:58:38 PM »

Hi Dinkum, to solve your problem for you:
1) modify file /system/modules/classifieds/config.php
replace
Code:
'featured_listings' => array
(
'display_name' => 'Featured Listings',
'script' => 'featured_listings.php',
'type' => 'user',
'access_type' => array('user'),
'params' => array ('featured_listings_template', 'number_of_rows', 'number_of_cols'),
),
to
Code:
'featured_listings' => array
(
'display_name' => 'Featured Listings',
'script' => 'featured_listings.php',
'type' => 'user',
'access_type' => array('user'),
'params' => array ('featured_listings_template', 'number_of_rows', 'number_of_cols', 'listing_type_id'),
),

2) modify file /system/lib/classifieds/Listing/ListingManager.php
replace
Code:
function getFeaturedListings($number_of_listings) {


$listings_info = DB::query("SELECT * FROM listings WHERE featured = 1 AND active = 1 ORDER BY featured_last_showed ASC LIMIT 0, ?n", $number_of_listings);

$listings = array();

to
Code:
function getFeaturedListings($number_of_listings) {

if(isset($_REQUEST['listing_type_id']))
{
$listing_type_sid = ListingTypeManager::getListingTypeSIDByID($_REQUEST['listing_type_id']);

$listings_info = DB::query("SELECT * FROM listings WHERE listing_type_sid = ?n AND featured = 1 AND active = 1 ORDER BY featured_last_showed ASC LIMIT 0, ?n", $listing_type_sid, $number_of_listings);
}
else
$listings_info = DB::query("SELECT * FROM listings WHERE featured = 1 AND active = 1 ORDER BY featured_last_showed ASC LIMIT 0, ?n", $number_of_listings);

$listings = array();

3) if you show featured listing in template by code
Code:
{module name="classifieds" function="featured_listings"}
, add to this construction parametr listing_type_id, for example,
Code:
{module name="classifieds" function="featured_listings" listing_type_id="HomesforSale"}

if you show featured listing by call user page, then modify your userpage, in this page added parametr listing_type_id, fill them
« Last Edit: February 07, 2010, 05:28:26 PM by nikolosnet » Logged
Dinkum
Newbie
*

Karma: 0
Posts: 5


View Profile
« Reply #2 on: February 06, 2010, 01:00:20 AM »

Thanks, I got it working, but had to modify the code in ListingManager.php slightly

Code:
$listings_info = DB::query("SELECT * FROM listings WHERE listing_type_sid = ?n, featured = 1 AND active = 1 ORDER BY featured_last_showed ASC LIMIT 0, ?n", $listing_type_sid, $number_of_listings);
}
to
Code:
$listings_info = DB::query("SELECT * FROM listings WHERE listing_type_sid = ?n AND featured = 1 AND active = 1 ORDER BY featured_last_showed ASC LIMIT 0, ?n", $listing_type_sid, $number_of_listings);
}

Simply replaced the comma after listng_type_sid = ?n with AND.

Thanks for the help.
Logged
nikolosnet
Newbie
*

Karma: 2
Posts: 8


View Profile
« Reply #3 on: February 07, 2010, 05:31:10 PM »

You're right, I made an error in the sql code.
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!