Search field – how to link a customer field

  • Bryan
    Bryan
    Newbie
     
    50 points

    Hi All,

    I am trying to link a customer filed to a search field on my homepage. I’m using the September 2016 child theme of DT and would like to link the “All Locations” field to a customer field I created. Any ideas of how to achieve this would be much appreciated.

    Thanks in advance. See Screen shot attached

    Attachments:
    You must be logged in to view attached files.

    Bryan
    Bryan
    Newbie
     
    50 points

    Very eager to get the search “All Location” field linked to a custom field. Would appreciate all the help I can get. Need to know which field the current “All locations” is tied to on the listings or the theme as well.

    Thanks


    Josh
    Josh
    Super Guru
     
    13,103 points

    Hello Bryan,
    Get the custom field you want to display database key (Listing Setup >Custom Fields)
    Access the file Appearance >Editor >home.php (You can also access it directly in your child theme folder)
    Locate the below code:

    <select name="location1" class="form-control input-lg">
    <option value=""><?php echo $CORE->_e(array('button','46')); ?></option>
    <?php echo $CORE->CUSTOMFIELD_LIST('map-country'); ?>
    </select>

    Replace ‘location1’ and ‘map-country’ with your custom field database key.
    So for example if I have a custom field named Color but with database key as color then my could would be:

    <select name="color" class="form-control input-lg">
    <option value=""><?php echo $CORE->_e(array('button','46')); ?></option>
    <?php echo $CORE->CUSTOMFIELD_LIST('color'); ?>
    </select>

    Note:Your custom field must be a ‘select’ Field Type

    This reply was awarded the best answer by the topic poster.

    Bryan
    Bryan
    Newbie
     
    50 points

    @Josh,

    Many thanks. I have been able to effect the changes however seems like the search result still returns all listing instead of listing matching any of the search criteria by either “keywords”, “categories” or “Location”. Any idea of how to ensure it returns results based on selected/inputted criteria?

    In addition to this, is there a way to include a filter functionality on the search result page which can help users further narrow the search results.

    Thanks a million for this Josh. Much appreciated.



    Alex
    Newbie
     
    1 points

    Hey Bryan
    Were you able to make it work? I have the same problem. The custom fields areas seems to be pulling correct list of options, however, when chosen it doesn’t filter the listings – it displays them all.


    Josh
    Josh
    Super Guru
     
    13,103 points
Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.