Support Forums

Displaying variables and extra fields NOT already shown on the page

This is a discussion on Displaying variables and extra fields NOT already shown on the page within the Modules / Plugins / Modifications forums, part of the Developer Forums category; Originally Posted by T0m1 Hi there, I am no whizz kid, and I am just starting out myself. But If ...


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

Reply
 
Thread Tools Display Modes
Old 08-20-2010, 10:27 AM   #11
Customer
 
Join Date: Jul 2010
Posts: 6
Rep Power: 0
KLOUGOON is on a distinguished road
Default

Quote:
Originally Posted by T0m1
Hi there,

I am no whizz kid, and I am just starting out myself. But If I was to have a good guess as to why its defaulting to the else statement id say it was because of this line in your code
Code:
{if $smarty.capture.condition==""}
From what I understand that statement is sayingif, the smarty capture'condition' is equal to nothing

Ok im out of my depths here, but try this one
Code:
 {if not $smarty.capture.condition==""}
And hopefully if im not mistaken it should then perform this

if, the smarty capture 'condition', is NOT equal to nothing

Kind regards,
Thanks for the quick reply. Have tried that and still no luck. It comes up with the text Condition: even when the extra field does not exist. I had tried a few other variations of this statement all with the same result. All listings either come up with the prefix or they don't - I just can't seem to get the validation right.
KLOUGOON is offline   Reply With Quote
Old 08-20-2010, 10:40 AM   #12
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 3,006
Rep Power: 74
seymourjames is a jewel in the rough
Default

Why not follow through on Mike's post - make a copy of the plugin and do the testing/output inside the smarty plugin. I think you will have more luck this way.
__________________
"The fool doth think he is wise, but the wise man knows himself to be a fool.".

TemplateCodes.com for 68 Classifieds Version 5 Themes and Version 4 Templates
seymourjames is offline   Reply With Quote
Old 08-23-2010, 04:33 PM   #13
Customer
 
Join Date: Jun 2008
Location: Maldives
Posts: 134
Rep Power: 13
business is on a distinguished road
Default

Getting an extra field evaluated in an IF statement has been a challenge for me too:
extra field variable not evaluated
__________________
v 4.2.0 Developer - Default Template
business is offline   Reply With Quote
Old 08-23-2010, 05:16 PM   #14
68 Evangelist & Developer
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 2,120
Rep Power: 63
Mike-N-Tosh is just really nice Mike-N-Tosh is just really nice
Default

Yes, this was also why I created a copy of this plugin. One of the other issues was that I wanted to only show a fields value if there was one AS WELL AS the field name. The issue is, that the plugin only gets the value. The actual field name isn't even stored in the same database table. So here's how you can do this.

1. Make a copy of the plugin and name it: function.get_extra_field2.php

2. Around line 31 (the beginning of the function)
change this: function smarty_function_get_extra_field($params, &$smarty)
to this: function smarty_function_get_extra_field2($params, &$smarty)
(this is so the file name and the function match or it won't work)

3. Around line 47 after the two separate "}" and "}" for the foreach satatement add this new code to get the extra fields name. This will get the field name that we need.
PHP Code:
if($fid >0)
{
    
$sSQL "SELECT fName FROM ".PREFIX."fields WHERE fID='".$fid."'";
    
$result=$db->query($sSQL);
    if(
$result->isError())
    {
        return 
false;
    }
    if(
$result->size()>0)
    {
        
$rs=$result->fetch();
        
$ftitle $rs['fName'];
    }

4. Around line #76 (originally line #62) find: return $value; DELETE THIS LINE!

5. Just before the very last "}" insert this new code:
PHP Code:
If($value<>"")
{
    
$output $ftitle': ' .$value//insert whatever design html output you want here
} else {
    
$output '';
}
return 
$output
The last step (5) is where you can alter this to match your design if you want to
example:
$output = '<tr><td class="field_name">' .$ftitle. '</td><td class="field_value">' . $value. '</td></tr>';

Now you can use this plugin the same way except that you would use the proper name:
Example {get_extra_field2 id=2 fid=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

Last edited by Mike-N-Tosh; 08-23-2010 at 05:19 PM.
Mike-N-Tosh is offline   Reply With Quote
Old 08-23-2010, 05:32 PM   #15
Customer
 
Join Date: Aug 2010
Posts: 100
Rep Power: 5
T0m1 is on a distinguished road
Default

Mike, just a quick Question which may or may not be related to this topic (hence no new thread).

When creating extra fields is it possible to place certain ones specifically within viewlisting.tpl and the rest automatically be bunched together (so say another new one was created this was auto output without needing to again modify the tpl file).

But likewise to arrange these in a specific order int he form a user fills out and then any I do not manually place are auto output together (like they currently are)?

Many thanks and sorry if its not relevant to this thread.
__________________
Tom.

68c Developer v4.1.10 - Very Custom Template
MySQL v5.0.91-community <-> PHP v5.2.13 <-> Apache v2.2.15

Experience is the name we give to our mistakes
T0m1 is offline   Reply With Quote
Old 08-23-2010, 07:25 PM   #16
68 Evangelist & Developer
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 2,120
Rep Power: 63
Mike-N-Tosh is just really nice Mike-N-Tosh is just really nice
Default

Quote:
Originally Posted by T0m1
When creating extra fields is it possible to place certain ones specifically within viewlisting.tpl and the rest automatically be bunched together (so say another new one was created this was auto output without needing to again modify the tpl file).

But likewise to arrange these in a specific order int he form a user fills out and then any I do not manually place are auto output together (like they currently are)?
Short answer: NO

It's all or nothing, basically. The extra fields are gathered and displayed with the ajax file. However as far as ordering the display of ALL of the extra fields in the viewlisting as well as the checkout and advanced search, it is ordered by the field order as set in the extra fields list in the admin.
__________________
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   Reply With Quote
Old 08-23-2010, 08:04 PM   #17
Customer
 
Join Date: Aug 2010
Posts: 100
Rep Power: 5
T0m1 is on a distinguished road
Default

Hmm,

Not really what I was hoping for lolol.

Which means I am a little stuck now as it would be completely bizarr to have the price near the top (when listing a new item) then have a bunch of other fields then select ONO,OVNO etc, and then whether it is for Swap, Sell etc .

Likewise in the output on the front end it would completely daft...

I would have loved to modify viewlisting.tpl so that seller details were on the right, "Sell,Swap" appears at top with price underneath and ONO,OVNO next to it and then a little bit of a break (as the price would be formatted differently) and then the other extra fields along with the description box.

Actually just bumped into this post... MODIFICATION: Display extra fields separately. ...

Would this work? If yes, how would I go about giving more than 1, 2 or maybe even 3 extra fields their own name to display seperately?

Many thanks.
__________________
Tom.

68c Developer v4.1.10 - Very Custom Template
MySQL v5.0.91-community <-> PHP v5.2.13 <-> Apache v2.2.15

Experience is the name we give to our mistakes
T0m1 is offline   Reply With Quote
Old 08-23-2010, 08:37 PM   #18
68 Evangelist & Developer
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 2,120
Rep Power: 63
Mike-N-Tosh is just really nice Mike-N-Tosh is just really nice
Default

Quote:
Originally Posted by T0m1
Would this work? If yes, how would I go about giving more than 1, 2 or maybe even 3 extra fields their own name to display seperately?
No. That is for v4.0.x
__________________
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   Reply With Quote
Old 08-23-2010, 08:47 PM   #19
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 3,006
Rep Power: 74
seymourjames is a jewel in the rough
Default

The post is dated 02-28-2008 . It is for a very old version of 68C. I doubt it will do what you hope for but you can try. Experimenting is important.

Why do you not set up your extrafields to not display in a listing. Then use the extrafield plugin in the locations you wish to display the extrafields? Its potentially going to be be tedious and a bit messy but you are choosing to do something out of the ordinary. Managing extrafields on checkout and search are a different matter. There is a solution for search which is to remove the ajax stuff from search.tpl and hardcode in the labels and options in the order you wish them to display. That is exactly what we did on this site Annunci Immobiliari when we put search on the home page. The solution for search is only going to work though if your extra fields remain the same for all categories (the category structure is also flat - no subcats) and the extrafields are permanently shown on the search. Not sure how you would go about doing the checkout process at all. I think that will require a hell of a lot of customization. I would not even consider that.

To be frank again Tom. You are focussing on widgetry. Not much of this is going to make a difference to the success of your site. Looking at your overall goal as it is becoming clearer you need to find a top notch developer who can really dig into the internals of the code to make the types of modifications you would like to the system of extrafields. You are pressing 68C beyond the limits it was designed for if you want to accommodate sales, swaps, etc. As in the example site above you may be able to use our global search module to manage the fields in search and the listing filter to differentiate sales and swaps (in our case sales and renting) but it is not going to get you all of the way.

As Larry previously mentioned. Some of the most simple sites are by far the most successful.
__________________
"The fool doth think he is wise, but the wise man knows himself to be a fool.".

TemplateCodes.com for 68 Classifieds Version 5 Themes and Version 4 Templates

Last edited by seymourjames; 08-23-2010 at 08:58 PM.
seymourjames is offline   Reply With Quote
Old 08-24-2010, 06:27 AM   #20
Customer
 
Join Date: Aug 2010
Posts: 100
Rep Power: 5
T0m1 is on a distinguished road
Default

Hi Mike & David,

Many thanks to both of you for taking the time to respond and help in my enquiry .

@David
Its not that I want to make the site complex, not by any means, and at present im not interested in any automated selling/swapping thing.

I just (and for me personally I would see this as being a basic thing) wanted to be able to place and organise the extra fields exactly as I wanted them as opposed to how the code would dictate I should have them.

The site itself, despite the sound of my enquiries, is actually a very simple one. I would agree that some of the most simple are the most successful, but in the same breath I wouldnt hesitate to point out that this means simple for the user to use and not simple as in thrown together in a cooking pot and hoping for the best.
My intention is just to create a natural flow of information for the users, this way it would feel natural to them and little effort is ever required. If information begins to jump about (from my perspective) this would then induce confusion, which in turn leads users to become 'scared' per se. If this happens you then lose users instead of maintaining and increasing them.

Fantastic example and testament to all of this is eBay. In the early years it was simple, hence numbers grew. Now ebay (and they claim its in the interests of the users to keep it simple etc and more secure) have begun making it A more complex, which backs up your point, and secondly information is scattered. Although still a highly usable site, you have to work hard in being able to use it properly and so now I know plenty of people abandoning ebay, heck I am one of them also.

But yes, David, I agree simple is good karma, but I do not wish to confuse simple with 'Thrown together'. As an example the current display of info on a page would be as follows;

Seller : Name
City :
State :
Country :
Price : $1
Date Added :
Expiration :
Views :
(Extra Field 1)Sale Type: Sell & Swaps Considered
Extra Field 2)Price Flexability: ONO



I would like to have:

Title

List Type: Sell & Consider Swap............................Seller
Price: $1 (ONO(field))...................................... ..City
.................................................. ................State
xTra field............................................. ..........Expiration
xTra field............................................. ..........Views
xTra field etc

Desc

(sorry about the .............. but space didnt work lol)


The main fields I dont think (think lol) would be a problem as these are hard coded.
Its just those extra fields lol.

Many thanks for listening to my ramblings on. With regards to hiring someone, if only I had the money to invest. I can't even go for the membership module at present or even the stop spam module due to a lack of funds. Besides I love knowing how it works

Kindest regards,
__________________
Tom.

68c Developer v4.1.10 - Very Custom Template
MySQL v5.0.91-community <-> PHP v5.2.13 <-> Apache v2.2.15

Experience is the name we give to our mistakes

Last edited by T0m1; 08-24-2010 at 06:32 AM.
T0m1 is offline   Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
MODIFICATION: Display your extra fields on the showlistings.tpl page cwp Modules / Plugins / Modifications 28 08-06-2009 01:42 PM
extra fields in featured ads on home page rockabilly Technical Support 3 07-01-2009 06:02 AM
Extra Fields Showing Up On Search Page hotchops Technical Support 6 04-30-2009 10:34 PM
Extra Fields On View Listing Page dexignz Technical Support 1 09-23-2008 10:01 AM
extra fields on show results page anna245 Technical Support 3 04-18-2008 02:31 PM


All times are GMT -4. The time now is 12:22 AM.


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