Search By Date

Discussion in 'Technical Support' started by julyrod, Jan 10, 2011.

  1. julyrod Customer

    v4.2.1 Developer

    default template


    Dear Friends ! , I need to create an extra field for a date, and want it to be searchable. I did a test, but the search was always empty.

    Can you please explain, how does a date works ( when doing a search )

    Thanks !
  2. Lhotch curmudgeon

    when you create an extra field you need to make sure its set as searchable. If thats done then it will only appear on the search page once a category is selected.

    The reason it works that way is because extra fields can belong to only certain categories and it doesnt make sense to display an extra field for a category that doesnt have them.
  3. julyrod Customer

    Correct !,

    "when you create an extra field you need to make sure its set as searchable. done !
    If thats done then it will only appear on the search page once a category is selected." Yes !

    The date search field appears on the search page after selecting the specific category.

    Its format is " like a " date range..

    when we input the exact date we used on the ad, and press search..

    The system does not find results. That is our doubt.

    Thanks in advance.
  4. Mike-N-Tosh Developer & Moderator

    Have you modified your search template file (or the ajax.php), because that is not the default way to search on a date field. Normally, if you select a category with a searchable date field, you get two input date fields, from <date field> to <date field> and when you click on the date field (focus), it pops up the javascript date calendar to select the date.

    It is done this way to ensure the input is correct as dates are tricky when stored. If they aren't input in the exact same format as they are stored, you will never get a match. (e.g. 2011-01-07 does not equal 1-7-2011) In addition, although a date may be displayed as 01-07-2011, it might not be stored that way in the db, because it may have been formatted to display in a different way.
  5. Lhotch curmudgeon

    When you create an "extra field" of type date THAT is the field you will be searching on NOT the date the ad was placed.
  6. julyrod Customer

    Hi !,

    In the demo website > animals & pets, there is a date field: the alligator's date of birth (dob)

    I went to the administration with demo/demo, and made this field searchable.

    Then in the front end, tried to look for it with the search option... and got no results..

Share This Page