![]() |
Adding extra field to subcategories.tpl
I'm trying to show a couple of the extra fields on subcategories.tpl but can't figure out how to add the data from the {$extra} array into the variables so I can display them.
Does anyone know how? Thanks |
The only place extra fields are available with out modifying the core files is at viewlisting.php and its templates viewlisting.tpl.php viewlisting2.tpl.php
|
Hi John,
With the developer edition I should be able to grab the data out of the database and display it, right? I looked at viewlisting.php and took the section marked //extra fields and added it to category.php, but that didn't get the data in the $extra array like I hoped. $extra is now a template variable in category.php but it is empty. What am I missing? Regards |
Well, you have to be sure you are calling the extra fields inside the loop where the listing information is assigned. This way it is availible for each listing.
Just to be sure we are on the same page, you are talking about adding extra fields to the results for category/toplistings/searchresults correct? If you know the specific extra field and it is global across all listings you could modify the code found here to help you get it to the template. There isn't a very easy way of handling the dynamics of extra fields when you can have different ones for different categories and the fact that some pages show listings from various categories. Code that does this for 3.0.15: http://www.68classifieds.com/forums/...ead.php?t=2310 Original thread for this modification: http://www.68classifieds.com/forums/...read.php?t=198 |
Hi John,
The extra fields I need to display will be used for all products in all categories. I'm trying to display the extra fields in the category and subcategory display (showlistings.tpl). Debug shows the script is categories.php and the body is categories/subcategories.tpl.php. I had already looked at the threads you referenced, but my php/mysql skills are very limited -- I can follow and edit some of the logic, cut and paste etc, but I've never grasped handling db I/O. I don't know what would need to be changed in the mods in those threads to make it work with 3.1. I don't need the existing price and short description fields for the way I'm using the script, so I may use those fields for the two extra fields I need instead. That may be easier than pulling the extra array out of the db. I'll see how that goes... Thanks |
I'm still short an extra field that I need to show in the category and subcategory display (showlistings.tpl).
How can I add entirely new field (or fields) to the db and make it available to show in the category templates? I can modify the templates to display them, I just need a bit of help getting the data in the variables. Regards, Jim Whitesell |
This seems to be a pretty common request. I actually made a module for this but didn't want to release it since v4 is right around the corner. Since I'm feeling rather charitable I will attach it here when I get home from school.
However, it requires the developer version since some hooks have to be added and some code rewritten. We can just consider this a community module. |
Thanks John,
I'm looking forward to grabbing it -- Your generosity is greatly appreciated!! Regards, Jim Whitesell |
Just got home, but I have to track down the core file changes. Seems the readme was never finished :rolleyes:.
I'll need to upload it and be sure the rest was finished. |
It has some errors, I thought I finished it, but there are some errors, maybe I will get to it tomorrow night.
|
| All times are GMT -4. The time now is 04:48 AM. |
Powered by vBulletin® Version 3.6.3
Copyright ©2000 - 2007, Jelsoft Enterprises Ltd.