 |

mainebound
User
Feb 1, 2008, 10:58 AM
Post #1 of 12
(2370 views)
Shortcut
|
|
Search for Date Range
|
Can't Post
|
|
I call pages on my site up with a link like this: http://werealty.net/listman/exec/search.cgi?search=1&lfield12_match=Waterview&template=_search_wv.html&sort_order=5,123,forward What I want to do is search a listing date field and say any property dated to day or in the past 30 days should appear. In other words, I want all listings added in the last 30 days to show. Can this be done? How might I do that? Thanks!
|
|
|  |
 |

MikeB
Staff
/ Moderator

Feb 5, 2008, 1:10 PM
Post #2 of 12
(2143 views)
Shortcut
|
|
Re: [mainebound] Search for Date Range
[In reply to]
|
Can't Post
|
|
Hi mainebound, Thanks for the post! I just wanted to clarify one quick thing about what you had mentioned in your post. Did you have a field that you were using for "Listed Date" already? If so, can you just let me know what you're usually putting in this field as a value? If I have a bit more detail about how Listings Manager is running on this site I can have a look at this for you and see if I can offer some suggestions on ways to set this up. I look forward to hearing from you! Cheers, Mike Briggs - Product Specialist support@interactivetools.com
Hire me! Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.
|
|
|  |
 |

mainebound
User
Feb 6, 2008, 4:10 AM
Post #3 of 12
(2088 views)
Shortcut
|
|
Re: [MikeB] Search for Date Range
[In reply to]
|
Can't Post
|
|
We have a field set up as a text field. We have yet to begin populating it - but I'd thought that it would be mm/dd/year format. This is the only field that we would be searching on - we want all records that meet this date and are less than 30 days old. Does that make sense?
|
|
|  |
 |

MikeB
Staff
/ Moderator

Feb 7, 2008, 12:56 PM
Post #4 of 12
(2018 views)
Shortcut
|
|
Re: [mainebound] Search for Date Range
[In reply to]
|
Can't Post
|
|
Hi, Thanks for the update! If you'd like to create a link like the on you provided but with a 30 day search window as well you could probably set this up with a bit of JavaScript. First, you'll want to ensure that in your new date field you enter the date in this format: YYYYMMDD This way, it'll actually look like one longer number that you can compare. If you'd prefer not to use this format for your live site, you can just add another field so one will be used for the live site and another for searching. I've set up some JavaScript that will take today's date, subtract 30 and create a string in the same format I outlined above. This string will then be used as the "min" value for Listings Manager search so anything larger than this number (ie. more recent) will come up in the results. Here's the JavaScript you can use. This outputs the link for you so you'll just put it on your site wherever you'd like to link to the listing form the last 30 days:
<script type="text/javascript"> function zeropad(number,minLength) { outstr=number.toString(); while(outstr.length<minLength) outstr='0'+outstr; return outstr; } var oldDate=new Date(); oldDate.setDate(oldDate.getDate()-30); document.write(oldDate); var Month = oldDate.getMonth()+1; var Day = oldDate.getDate(); document.write('<a href="/listman/exec/search.cgi?search=1&lfield12_match=Waterview&template=_search_wv.html&sort_order=5,123,forward&lfieldX_min='+ oldDate.getFullYear() + zeropad(Month,2) + zeropad(Day,2) + '">Link</a>'); </script> You'll just want to change two things in the last line of code. One is "lfieldX_min" and you'll want to replace the "X" with the actual field you're using for your date. Also, you'll probably want to change the text that says "Link" to suit what you'd like the link to say on your site. I hope this helps! Cheers, Mike Briggs - Product Specialist support@interactivetools.com
Hire me! Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.
|
|
|  |
 |

mainebound
User
Feb 10, 2008, 9:21 AM
Post #5 of 12
(1869 views)
Shortcut
|
|
Re: [MikeB] Search for Date Range
[In reply to]
|
Can't Post
|
|
Okay, next question. Now my client isn't sure they want to go this route. Rather, can they enter an "expiration date" per say, and then have the listing cease to appear in the lookup after that date? The listings will all show elsewhere, but they want to control what they consider "new" in the display, but do not want to have to go back in and change a setting as one might do with a featured listing. Thanks in advance for your help!
|
|
|  |
 |

MikeB
Staff
/ Moderator

Feb 12, 2008, 12:33 AM
Post #6 of 12
(1802 views)
Shortcut
|
|
Re: [mainebound] Search for Date Range
[In reply to]
|
Can't Post
|
|
Hi, Thanks for posting, it's good to hear from you! From what you've outlined here, this should be something you can set up for the "New Listings" section of your site and it would just involve a couple of tweaks to the code that I had provided for you in my previous post. In that code the JavaScript was set up to output a date from 30 days ago. From there the date was used as a minimum value in the search link to return any listings that were within the last 30 days. With a couple of tweaks to that code we should be able to set it up so it'll search with a minimum date of today. This way only listings that have this "expiration" date set to sometime after today will show up in these search results. If this sounds like something that will work for you, just let me know and I'll provide you with the code for that. I hope this helps! Cheers, Mike Briggs - Product Specialist support@interactivetools.com
Hire me! Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.
|
|
|  |
 |

mainebound
User
Feb 22, 2008, 11:54 AM
Post #7 of 12
(1608 views)
Shortcut
|
|
Re: [MikeB] Search for Date Range
[In reply to]
|
Can't Post
|
|
Mike, yes, this is the way we've finally decided to go. I've got a field set up called "Expire" and the the expiration dates are entered YEARMMDD. What do I do next? Can you help me with the code to accomplish this showing only those listings that are less than the expiration date? Many thanks!
|
|
|  |
 |

Jake
Staff
/ Moderator

Feb 26, 2008, 1:18 PM
Post #8 of 12
(1558 views)
Shortcut
|
|
Re: [mainebound] Search for Date Range
[In reply to]
|
Can't Post
|
|
Hi mainebound, Mike hasn't been in the last couple of days, but I'll have him follow-up with you when he's in next - I'd help if I could, but I'm not too handy with javascript. ----------------------------------------------------------- Cheers, Jake Swanson - Product Specialist support@interactivetools.com
Hire me! Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.
|
|
|  |
 |

MikeB
Staff
/ Moderator

Feb 27, 2008, 1:58 PM
Post #9 of 12
(1541 views)
Shortcut
|
|
Re: [mainebound] Search for Date Range
[In reply to]
|
Can't Post
|
|
Hi, Thanks for your patience with this mainebound! I've had a look at what you're hoping to set up and the code is basically the same as what I provided for you above, with just a couple of quick changes. Here's the whole block of JavaScript you can use for your link:
<script type="text/javascript"> function zeropad(number,minLength) { outstr=number.toString(); while(outstr.length<minLength) outstr='0'+outstr; return outstr; } var Today=new Date(); var Month = Today.getMonth()+1; var Day = Today.getDate(); document.write('<a href="/listman/exec/search.cgi?search=1&lfield12_match=Waterview&template=_search_wv.html&sort_order=5,123,forward&lfieldX_min='+ Today.getFullYear() + zeropad(Month,2) + zeropad(Day,2) + '">Link</a>'); </script> Basically this code will grab today's date and will insert this into your search query for the value "lfieldX_min". The field "lfieldX" that's referenced here will be your new "Expire" field so you can replace the X with the field number from Listings Manager. From there, this search query will look for any listing that has a date in the "Expire" field that is later than today's date. Give this a try and let me know if you have any questions about this! Cheers, Mike Briggs - Product Specialist support@interactivetools.com
Hire me! Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.
|
|
|  |
 |

mainebound
User
Feb 27, 2008, 2:09 PM
Post #10 of 12
(1538 views)
Shortcut
|
|
Re: [MikeB] Search for Date Range
[In reply to]
|
Can't Post
|
|
Mike, where on the page should I place this code?
|
|
|  |
 |

MikeB
Staff
/ Moderator

Feb 27, 2008, 2:16 PM
Post #11 of 12
(1535 views)
Shortcut
|
|
Re: [mainebound] Search for Date Range
[In reply to]
|
Can't Post
|
|
Hi, Thanks for the post! You mentioned in your first post that you use a link like this to point to your search results: http://werealty.net/listman/exec/search.cgi?search=1&lfield12_match=Waterview&template=_search_wv.html&sort_order=5,123,forward What you'd want to do is find the page on your site where you have this link, and replace that with the JavaScript I provided you. I hope this helps! Cheers, Mike Briggs - Product Specialist support@interactivetools.com
Hire me! Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.
|
|
|  |
 |

mainebound
User
Feb 27, 2008, 2:34 PM
Post #12 of 12
(1533 views)
Shortcut
|
|
Re: [MikeB] Search for Date Range
[In reply to]
|
Can't Post
|
|
Excellent! Seems to work well. Thank you!
|
|
|  |
|