Support Forums

Custom Search Box With Extra Fields Showing By Default

This is a discussion on Custom Search Box With Extra Fields Showing By Default within the Templates, HTML, CSS, and Design Help forums, part of the General category; I would like to create a custom search box that displays the extra fields for some categories by default. This ...


Go Back   68 Classifieds Forums > General > Templates, HTML, CSS, and Design Help

Reply
 
Thread Tools Display Modes
Old 05-25-2010, 01:20 PM   #1
Customer
 
Join Date: May 2010
Posts: 2
Rep Power: 0
computergiant is on a distinguished road
Default Custom Search Box With Extra Fields Showing By Default

I would like to create a custom search box that displays the extra fields for some categories by default.

This custom search box would be on a category page that uses extra fields by default so I don't want to require a visitor to select the category in order to see the extra fields drop down boxes.

An example would be I made a Cars category page, and on that page there is a search box with the extra fields Manufacturer drop down and Year drop down boxes displayed by default. There may be 4 extra fields tied to this category but I only want to display 2 of them.

What I have done so far is to replicate the extra_listing_fields function in ajax.php and added WHERE f.fID=2 OR f.fID=3 clause to the SQL statement. This limits the number of fields returned but doesn't display until I select the main category which calls optResponse.
computergiant is offline   Reply With Quote
Old 05-25-2010, 01:39 PM   #2
Developer & Moderator
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 2,311
Rep Power: 69
Mike-N-Tosh is just really nice Mike-N-Tosh is just really nice
Default

Haven't looked at the code, but off the top of my head I would say that you could add a smarty {if} based on the section or category ID. Something like <option {if $section=X}SELECTED{/if}>. Obviously, that's just a snippet, but may lead you in the right direction. check what variables are passed to the template using smarty debug to ensure that you use the appropriate variable.
__________________
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 05-27-2010, 03:51 PM   #3
Customer
 
Join Date: May 2010
Posts: 2
Rep Power: 0
computergiant is on a distinguished road
Default Found it!

Thank you Eric Barnes! Answer: 68 Classifieds Auto Loaded Search Fields | Eric Barnes

Add the following code beneath the $(document).ready(function() { in the search.tpl page.

selectedCat(1); //where 1 is the category pre selected.
function selectedCat(type){
$("#response").show()
$.ajax({
url: 'ajax.php',
data: 'action=extra_listing_fields&do=search§ion=' + type,
type: 'post',
success: function (msg) {
$("#response").html(msg);
}
});
}
computergiant is offline   Reply With Quote
Reply

Tags
custom search , extra field , extra fields , search

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Default value for Extra Fields MrGForce Technical Support 0 02-20-2010 08:45 AM
Extra Fields Showing Up On Search Page hotchops Technical Support 6 04-30-2009 09:34 PM
Extra Fields on Custom checkout/step3 marketingsolutions Technical Support 1 02-05-2009 08:40 AM
Default Value for Extra fields bholdman Technical Support 1 05-14-2008 10:02 AM


All times are GMT -4. The time now is 08:00 AM.


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