68 Classifieds 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 v4 Modules / Modifications forums, part of the Help & Support 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 > Help & Support > v4 Modules / Modifications

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 03-02-2008, 11:26 PM
cwp's Avatar
cwp cwp is offline
Senior Member
 
Join Date: Jun 2007
Posts: 297
Rep Power: 14
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.
Reply With Quote
  #2  
Old 04-11-2008, 10:08 AM
Eric Barnes's Avatar
68 Classifieds Staff
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 4,307
Rep Power: 99
Eric Barnes is a jewel in the rough
Default

I wanted to follow up on this thread and say that first function is now part of the file. So it will be already included.
__________________
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 04-11-2008, 11:35 AM
cwp's Avatar
cwp cwp is offline
Senior Member
 
Join Date: Jun 2007
Posts: 297
Rep Power: 14
cwp is a jewel in the rough
Default

which version was it added in? And I'll change my post
__________________
Version 4.0.3 Developer
Reply With Quote
  #4  
Old 04-11-2008, 11:36 AM
Eric Barnes's Avatar
68 Classifieds Staff
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 4,307
Rep Power: 99
Eric Barnes is a jewel in the rough
Default

Sorry forgot to mention that. Starting with v4.0.1 that function is now added.
__________________
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
  #5  
Old 04-11-2008, 04:23 PM
cwp's Avatar
cwp cwp is offline
Senior Member
 
Join Date: Jun 2007
Posts: 297
Rep Power: 14
cwp is a jewel in the rough
Default

Quote:
Originally Posted by suzkaw View Post
Sorry forgot to mention that. Starting with v4.0.1 that function is now added.
Thanks, I edited the original post with steps for each version.
__________________
Version 4.0.3 Developer
Reply With Quote
  #6  
Old 04-22-2008, 12:16 PM
Member
 
Join Date: Apr 2008
Posts: 51
Rep Power: 5
anna245 is on a distinguished road
Default error on listings.php

I inserted $row['extrafield'] = getExtraField($row['id'], 4); replacing the "4" with the id number on the listings.php page and when I do a search on the site, the view listings page is blank with this error showing up.

Fatal error: Call to undefined function: getextrafield() in the listings.php page.

Any suggestions on how to fix?
Reply With Quote
  #7  
Old 04-22-2008, 12:23 PM
Lhotch's Avatar
Moderator
 
Join Date: Mar 2006
Posts: 3,663
Rep Power: 90
Lhotch is just really niceLhotch is just really nice
Default

Quote:
Originally Posted by anna245 View Post
I inserted $row['extrafield'] = getExtraField($row['id'], 4); replacing the "4" with the id number on the listings.php page and when I do a search on the site, the view listings page is blank with this error showing up.

Fatal error: Call to undefined function: getextrafield() in the listings.php page.

Any suggestions on how to fix?
What version of 68C are you running? As Eric stated above, the getextrafield function was added until v4.0.1. Are you running the initial 4.0.0?
__________________
Larry.
(Please note: I am not a 68C employee. I am a customer and volunteer who helps with questions where I can and the forums spam free)

Set your site apart from the competition with one of my modules......
Google Map Module | You Tube Module | Google Calendar Module

68 Classifieds Important Links
Customer Area | Issue Tracker | Knowledge Base | User Manuals
Reply With Quote
  #8  
Old 04-22-2008, 12:30 PM
Eric Barnes's Avatar
68 Classifieds Staff
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 4,307
Rep Power: 99
Eric Barnes is a jewel in the rough
Default

It does appear to have an error in the instructions. I have just modified them to be correct. Basically where you have:
$row['extrafield'] = getExtraField($row['id'], 4);

Should be:
$row['extrafield'] = $this->getExtraField($row['id'], 4);

Also 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.
__________________
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
  #9  
Old 04-22-2008, 01:15 PM
cwp's Avatar
cwp cwp is offline
Senior Member
 
Join Date: Jun 2007
Posts: 297
Rep Power: 14
cwp is a jewel in the rough
Default

Quote:
Originally Posted by suzkaw View Post
It does appear to have an error in the instructions. I have just modified them to be correct. Basically where you have:
$row['extrafield'] = getExtraField($row['id'], 4);

Should be:
$row['extrafield'] = $this->getExtraField($row['id'], 4);

Also 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.

Thanks for the heads up. I fixed the post.
__________________
Version 4.0.3 Developer
Reply With Quote
  #10  
Old 04-22-2008, 01:19 PM
Member
 
Join Date: Apr 2008
Posts: 51
Rep Power: 5
anna245 is on a distinguished road
Default

Thanks! It works now!
Reply With Quote
Reply

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
MODIFICATION: Display extra fields separately. cwp v4 Modules / Modifications 2 05-30-2008 03:20 PM
Display extra fields on showlistings.tpl cwp v4 Questions & Support 9 03-03-2008 09:52 AM
Display extra fields by themselves? cwp v4 Questions & Support 3 02-22-2008 04:34 AM
Extra fields to be searchable on the first search page, before a category is chosen Greg H v3.1 Modules & Modifications 5 11-28-2007 03:29 PM
extra fields in the listing modification Acpjax v3.1 Questions & Support 4 11-20-2006 02:20 PM


All times are GMT -4. The time now is 07:20 PM.


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