Support Forums

Problem with Display extra field in Search

This is a discussion on Problem with Display extra field in Search within the Technical Support forums, part of the Technical Support Forums category; Version 4.1.10 developer Default Template I have an extra field (Your School) which is set for display and search for ...


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 02-20-2011, 10:35 AM   #1
jw4
Junior Member
 
Join Date: Jun 2010
Posts: 17
Rep Power: 4
jw4 is on a distinguished road
Default Problem with Display extra field in Search

Version 4.1.10 developer
Default Template

I have an extra field (Your School) which is set for display and search for all categories.

In Search, default displayed is 'Search All' - when this is used/reselected, the extra field is not displayed. If a category is selected, then the extra field is shown.

I want the extra field to always be shown. I have looked at search.tpl and ajax.php but I don't know what exactly to change.

Can anyone help?

Attached screenshots for Search All (no extra field) and category Clothes (extra field displayed)

Many thanks
Jane
Attached Images
File Type: jpg screenprint - no extra field.jpg (51.1 KB, 6 views)
File Type: jpg screenprint - extra field.jpg (51.8 KB, 5 views)
jw4 is offline  
Old 02-23-2011, 11:48 PM   #2
Moderator
 
juven14's Avatar
 
Join Date: Mar 2006
Location: New Jersey
Posts: 2,029
Rep Power: 64
juven14 is a jewel in the rough
Default

Provided you are only loading a single field for all categories, you can edit the javascript to prevent updating based on the change of the category. Something like this:

Replace this section of search.tpl with either of the two below:

Code:
$("#type").change(function()
{
    $("#response").show();
    $("#optResponse").hide();
    //alert($('#type option:selected').val());
    $.ajax({
        url: 'ajax.php',
        data: 'action=extra_listing_fields&do=search§ion=' + $('#type option:selected').val(),
        type: 'post',
        success: function (msg) {
            $("#response").html(msg);
        }
    });
});
Code:
var type = 1; //this must be a universal extra field that never changes
 $.ajax({
        url: 'ajax.php',
        data: 'action=extra_listing_fields&do=search§ion=' + type,
        type: 'post',
        success: function (msg) {
            $("#response").html(msg);
        }
 });
Or you can resubmit every time the category is changed, the field if global will be reloaded along with any others:

Code:
var default_type = 1; // will default to this categories extra fields
$("#type").bind('change', function() {
    $("#response").show();
    $("#optResponse").hide();
    type = $('#type option:selected').val(); 
    if (type == '') { //every time select all is chosen it will return to the default category fields
        type = default_type;
    }
    $.ajax({
        url: 'ajax.php',
        data: 'action=extra_listing_fields&do=search§ion=' + type,
        type: 'post',
        success: function (msg) {
            $("#response").html(msg);
        }
    });
});
$("#type").trigger('change');
__________________
John Snyder
PHP Developer
juven14 is offline  
Old 02-25-2011, 12:50 PM   #3
jw4
Junior Member
 
Join Date: Jun 2010
Posts: 17
Rep Power: 4
jw4 is on a distinguished road
Default

Hi John

Problem solved with your code.

Many, many thanks
Jane
jw4 is offline  
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extra Field Search / Save Extra Field to Short Desciption tlombard Technical Support 8 03-04-2010 06:18 PM
Extra field display in checkout format problem rhound Technical Support 4 03-20-2009 03:53 PM
V4 Search Problem (when done w/Extra Field searches) goose Technical Support 1 08-17-2007 05:59 PM


All times are GMT -4. The time now is 06:13 AM.


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