Support Forums

Extra fields

This is a discussion on Extra fields within the Technical Support forums, part of the Technical Support Forums category; Simple question but I have defined 2 extra fields. These get displayed in the view listing pages as I wanted. ...


Go Back   68 Classifieds Forums > Technical Support Forums > Technical Support

This topic is resolved.

If you have a similar issue that this thread does not address, open a new related support topic.

 
Thread Tools Display Modes
Old 04-10-2008, 10:14 PM   #1
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 3,004
Rep Power: 74
seymourjames is a jewel in the rough
Default Extra fields

Simple question but I have defined 2 extra fields. These get displayed in the view listing pages as I wanted. However I would like to take the 2nd of these fields which is a text field and put it in the browse listings page (especially when users wish to modify an ad). It is actually a reference number and it makes life easer for users to identify their products quickly. Here is the code that I wish to modify. I am sure it is a simple thing to do but after 2 hours of trying different combinations it is getting .....

<td class="{cycle values="row1,row2" advance=false}">{$entry.title} I WANT TO PUT THE FIELD HERE SO IT IS DISPLAYED</td>
<td class="{cycle values="row1,row2" advance=false}">
{if $entry.expirationTime < $smarty.now}
{$smarty.const.LANG_EXPIRED}
{elseif $entry.display == "Y"}
{$smarty.const.LANG_YES}
{else}
{$smarty.const.LANG_NO}
{/if}
</td>

Help appreciated.
seymourjames is offline  
Old 04-10-2008, 10:35 PM   #2
68 Evangelist & Developer
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 2,119
Rep Power: 63
Mike-N-Tosh is just really nice Mike-N-Tosh is just really nice
Default

Where is the code that you posted coming from? I'm not seeing that in showlistings(2).tpl. Perhaps that's why it isn't working. You may be in the wrong file.

Suggestion:
Whatever page it is that you are viewing that you would like to see this new field in, go to that page. Then make sure that you turn off any pop up blocking if you have that to off. Then add to the very end of your url "&debug=1" without the quotes.

This will refresh your page and it will pop up a debug window that will show you exactly what template file this is using as well as each data piece that is being passed to the template regardless of whether or not the template shows that data piece.

This will allow you to A) see exactly which template file is being used and B) if the data piece that you are wanting to show is even being passed to the template.

Hope that helps,
-Mike
P.S. If there is no "?" in the url for the page, replace the "&" with a "?" then "debug=1"
__________________
Mike-N-Tosh
IndianaPC.org - A community website (v3.1.10 Developer - heavily modified & used as the CMS)
Sandbox [localhost(v3.1.10, v4.0.9, 4.1.10,4.2,5.0)] for development and customization
Visit My blog: reviews, tips, tricks, tutorials and my store with Templates, Mods & Docs
Web Hosting | Web Design & Development | 68 Classifieds Customizations
I am not a 68C employee, just a user and try to help out
Mike-N-Tosh is offline  
Old 04-10-2008, 10:56 PM   #3
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 3,004
Rep Power: 74
seymourjames is a jewel in the rough
Default Extra fields

I am trying to change the userbrowsingslistings.tpl file. Basically I only want to display this 2nd field next to the entry.title when somebody is logged on - it is their references. What is strange is if I put normal text in, say XXXXX, it displays on the page I want it to. Something like

td class="{cycle values="row1,row2" advance=false}">{$entry.title} XXXXX </td>
<td class="{cycle values="row1,row2" advance=false}">
{if $entry.expirationTime < $smarty.now}
{$smarty.const.LANG_EXPIRED}

This displays entry.title and then XXXXX

Ideas. I could try it with the show listings file but then will it not appear on many different screens?
seymourjames is offline  
Old 04-10-2008, 11:06 PM   #4
68 Evangelist & Developer
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 2,119
Rep Power: 63
Mike-N-Tosh is just really nice Mike-N-Tosh is just really nice
Default

Use the debugger as I already suggested on the page. Most likely, it isn't showing what you want, because you aren't calling the variable by the correct name or that variable isn't being passed to the template.

-Mike
debug is your friend.
__________________
Mike-N-Tosh
IndianaPC.org - A community website (v3.1.10 Developer - heavily modified & used as the CMS)
Sandbox [localhost(v3.1.10, v4.0.9, 4.1.10,4.2,5.0)] for development and customization
Visit My blog: reviews, tips, tricks, tutorials and my store with Templates, Mods & Docs
Web Hosting | Web Design & Development | 68 Classifieds Customizations
I am not a 68C employee, just a user and try to help out
Mike-N-Tosh is offline  
Old 04-10-2008, 11:22 PM   #5
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 3,004
Rep Power: 74
seymourjames is a jewel in the rough
Default Extra Fields

If I am in the viewlistings.tpl file this code works. It is part of the standard file which I have not touched.

{* Extra Fields *}
{foreach from=$extrafields item=extras}
<tr>
<td><strong>{$extras.title}:</strong></td>
<td>
{if isset($extras.value)}
{foreach key=key item=item from=$extras.value}
{$item}<br />
{foreachelse}
{$extras.value}
{/foreach}
{/if}
</td>
</tr>
{/foreach}
{* End Extra Fields *}


It prints out both of my extra fields so the correct calls are being made. If I place this code in the userbrowselistings. tpl file it does nothing. I know that I am in the correct file (userbrowselisitings.tpl) because I can display simple text that I place next to the {$entry.title} call. Bizarre. If I place {$hitcounts} next to {$entry.title} it works as well. My problem is that i do not know what the 2nd field is called. I defined it in the categories setup as reference but how to call it I do not know. It is probably something daftly simple. It is driving me potty.
seymourjames is offline  
Old 04-10-2008, 11:37 PM   #6
68 Evangelist & Developer
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 2,119
Rep Power: 63
Mike-N-Tosh is just really nice Mike-N-Tosh is just really nice
Default

Those two template files are completely different beasts. I just checked the userbrowsingslistings.tpl which is fed from the userbrowsingslistings.php file. The function call for the information that is being passed to the userbrowsingslistings.tpl file is getListingsForMember. This function does not get description fields or extra fields at all.

The viewlistings.tpl uses a different function that DOES get all the information for the individual listing.

So, to do what you are wanting to do would mean that you would need to make up your own function that would also do a query directly to the database based off of each individual listing id for the extra fields information.

Bottom line is that it is much more complicated than what you were most likely originally thinking it was. If you really want to pursue that, I would start a new file and save it as a "smarty" function. Copy the function getListingsForMember from the listings.php and paste it into your new smarty function file and go from there.

This would require both php and mySQL understanding, but as these same queries are made elsewhere within the classifieds files, at least you wouldn't be starting from scratch. This is also assuming that you have the developers version as well.

-Mike
__________________
Mike-N-Tosh
IndianaPC.org - A community website (v3.1.10 Developer - heavily modified & used as the CMS)
Sandbox [localhost(v3.1.10, v4.0.9, 4.1.10,4.2,5.0)] for development and customization
Visit My blog: reviews, tips, tricks, tutorials and my store with Templates, Mods & Docs
Web Hosting | Web Design & Development | 68 Classifieds Customizations
I am not a 68C employee, just a user and try to help out

Last edited by Mike-N-Tosh; 04-10-2008 at 11:41 PM.
Mike-N-Tosh is offline  
Old 04-10-2008, 11:43 PM   #7
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 3,004
Rep Power: 74
seymourjames is a jewel in the rough
Default

Many thanks Mike. At least i know it is going to be complicated to do.

4.40 a.m in the morning here so calling it a night.
seymourjames is offline  
Old 04-11-2008, 09:28 AM   #8
68 Classifieds Staff
 
Eric Barnes's Avatar
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 5,497
Rep Power: 132
Eric Barnes is just really nice Eric Barnes is just really nice
Default

Yes it would take the Developer edition and v4.0.1 and it is still rather complex.
__________________
Eric Barnes
68 Classifieds Developer
Customer Area | Issue Tracker | Documentation | 68C Mods | 68 @ Twitter | My Modules
Eric Barnes is offline  
Old 04-11-2008, 10:09 AM   #9
68 Classifieds Staff
 
Eric Barnes's Avatar
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 5,497
Rep Power: 132
Eric Barnes is just really nice Eric Barnes is just really nice
Default

Here is a post with instructions:
MODIFICATION: Display your extra fields on the showlistings.tpl page

Please note that first function is already included.
__________________
Eric Barnes
68 Classifieds Developer
Customer Area | Issue Tracker | Documentation | 68C Mods | 68 @ Twitter | My Modules
Eric Barnes is offline  
Old 04-11-2008, 11:11 AM   #10
curmudgeon
 
Join Date: Mar 2006
Posts: 5,352
Rep Power: 134
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

Also keep in mind when adding extra fields to the showlistings.tpl you need to modify the table header to properly represent this new column if you will.

Aditionally, what happens if the extra fields you want to display are not in every category you have on your site?

If someone does a search and results come up with ads in both categories that do and do not use the extra field, think of how that is going to look.
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline  
Closed Thread

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


All times are GMT -4. The time now is 04:50 AM.


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