Support Forums

MODIFICATION: Display your extra fields on the showlistings.tpl page

This is a discussion on MODIFICATION: Display your extra fields on the showlistings.tpl page within the Modules / Plugins / Modifications forums, part of the Developer Forums category; You must have the developer edition in order to do this modification. Put this code somewhere in your includes/classes/kernal/listings.php page. ...


Go Back   68 Classifieds Forums > Developer Forums > Modules / Plugins / Modifications

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 03-02-2008, 11:26 PM   #1
Senior Member
 
cwp's Avatar
 
Join Date: Jun 2007
Posts: 296
Rep Power: 22
cwp is a jewel in the rough
Default MODIFICATION: Display your extra fields on the showlistings.tpl page

You must have the developer edition in order to do this modification.

Put this code somewhere in your includes/classes/kernal/listings.php page. I added it to the
very end.

If you have version 4.0 start here. If you have version 4.01, please skip this step and continue with the next one.
PHP Code:
function getExtraField($id,$fieldid)
    {
        global 
$db;
        
$sSQL "SELECT sValue FROM ".PREFIX."products_fields WHERE pID='".$id."' AND fID=".$fieldid;
        
$result=$db->query($sSQL);
        if ( 
$result->isError() )
        {
            
trigger_error('Listing::getListing: Unable to fetch listing');
            return 
false;
        }
        if ( 
$result->size()>)
        {
            
$rs=$result->fetch();
            
$value $rs['sValue'];
        }
        
$result->freeResult();
        return 
$value;
    } 
As a reminder, if you have version 4.01, you will start here:

Find this:
PHP Code:
$row['status']=$row['display']; 
Add this right after it:
PHP Code:
$row['extrafield'] = $this->getExtraField($row['id'], 4); 
Keep in mind the number 4 needs to come from the administration extra fields. This is the id of the extra field you want to get.
Replace the number 4 with your field id which you can get in administration, under extra fields.To add another extra field just it.


On Showlistings.tpl add this right where you want it to show up:
Code:
{$entry.extrafield}
If you had added multiple, it would be like this, and so on.
Code:
{$entry.extrafield2}
Credit goes to suzkaw.
__________________
Version 4.0.3 Developer

Last edited by cwp; 04-22-2008 at 01:14 PM.
cwp is offline   Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
MODIFICATION: Display extra fields separately. cwp Modules / Plugins / Modifications 2 05-30-2008 03:20 PM
Display extra fields on showlistings.tpl cwp Technical Support 9 03-03-2008 09:52 AM
Display extra fields by themselves? cwp Technical Support 3 02-22-2008 04:34 AM


All times are GMT -4. The time now is 05:42 PM.


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