This is a discussion on Preselected Category for Search within the v4 Modules / Modifications forums, part of the Help & Support category; It seems to be a common change to want a category to be pre-selected when visiting the search form. This ...
|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
#1
|
||||
|
||||
|
It seems to be a common change to want a category to be pre-selected when visiting the search form. This modification will allow that.
V4.0.x #1. Open search.tpl and find the closing </form> tag. #2. Just below it add: Code:
{literal}
<script type="text/javascript">
selectedCat(1); //where 1 is the category pre selected.
function selectedCat(type){
document.getElementById('ajxresponse').innerHTML = '';
var QSTRING = type;
cp.call('{/literal}{$smarty.const.URL}{literal}/ajax.php', 'ajax_extra_search_fields', response, QSTRING);
return false;
}
</script>
{/literal}
V4.1.x Beta #1. Open search.tpl and find the following code: Code:
$(document).ready(function() {
Code:
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);
}
});
}
__________________
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 Last edited by Eric Barnes; 12-23-2008 at 12:49 PM. |
|
#2
|
|||
|
|||
|
That is a nice mod and useful. Is there a way to get the same action if the same extrafields apply to all categories. In other words, the extrafields drop down automatically by default?
At present, if the mod is applied to the search form, the select all comes up by default (regardless of the cat id put in) and the extrafields drop down (the right action for my need), if you then do a search on a specific category it is fine also but then if you go back and 'select all' without refreshing the page, the extrafields in the search form disappear. Logic which is something like if select all then drop the extrafields. |
|
#3
|
|||
|
|||
|
Hi Eric,
Is there a different code to use for v4.1.0 Beta 5 which has the same outcome. Reason why I would like this is because the searchable date field only works on this version and that is the one I'd like to target for the search without having to select a category first. This question is open to anyone of course. |
|
#4
|
||||
|
||||
|
Yes it would be different code. I will have to do some testing on it before I can post the change.
__________________
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 |
|
#5
|
|||
|
|||
|
Excellent.
Thanks Eric, got something to tell my client now
|
|
#6
|
||||
|
||||
|
I just edited the first post in this topic with instructions for v4.1 beta.
__________________
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 |
|
#7
|
|||
|
|||
|
Genius!
I've now stripped out the option box all together so that it only shows "starts from" and the search button. If I get the calendar to stay there instead of popping up, that can be my 'bare bones' event calendar. Thank you very much Eric. |
![]() |
| Bookmarks |
| Tags |
| category, search |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Display all ads and their category | hel68c | v4 Modules / Modifications | 5 | 08-21-2008 05:36 PM |
| Modification: RSS Feeds by Category (or anything else) | jonahcoyote | v4 Modules / Modifications | 3 | 07-01-2008 12:37 PM |
| Mass Move listings of a category to another category | Success | v4 Questions & Support | 3 | 04-10-2008 11:01 AM |
| Hide a category on public pages? | HotAir | v3.1 Questions & Support | 6 | 12-05-2007 11:17 AM |
| Branding each Category | BABBSELA | v3.1 Modules & Modifications | 0 | 02-10-2007 02:17 PM |