Go Back   Mosets Community > Archives > Mosets Hot Property 1.0 > Discussions, Troubleshooting and Problems

 
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-11-2009, 01:30 AM
simonlogan simonlogan is offline
Junior Member
 
Join Date: Feb 2009
Posts: 23
Question Adding a new range to the search

Hi, i've created an advanced search form as a module which submits to the main component and works fine, however I have a field which is "AvailableDate" (ie when the rental property will become available) and want to allow users to search on this field.

By default it will only return an exact match (ie i search for January and only properties that become available in january will be returned) whereas what I really want is to be able to search by a range (ie available from January to March so that any properties becoming available in January, February or March will be returned. I could set up the field as a list but how can I get the advanced search to search on this range?

Basically i want this field to do the same as the price from/to range. I know i might need to hack the search function but would be willing to give this a go. Can anyone give me some pointers?
  #2  
Old 03-11-2009, 09:50 AM
pantelisorfanos pantelisorfanos is offline
Mosets'd
 
Join Date: Jul 2008
Posts: 57
Default

Quote:
Originally Posted by simonlogan View Post
Hi, i've created an advanced search form as a module which submits to the main component and works fine, however I have a field which is "AvailableDate" (ie when the rental property will become available) and want to allow users to search on this field.

By default it will only return an exact match (ie i search for January and only properties that become available in january will be returned) whereas what I really want is to be able to search by a range (ie available from January to March so that any properties becoming available in January, February or March will be returned. I could set up the field as a list but how can I get the advanced search to search on this range?

Basically i want this field to do the same as the price from/to range. I know i might need to hack the search function but would be willing to give this a go. Can anyone give me some pointers?
check the file:
/component/com_hotproperty/models/advsearch.php

in there find the lines that says: "# ------------ Created"
and also check from the price similar code the "range.text" and she if you apply it there..
i havent tried personally but i believe that this is the place you are looking for to start
  #3  
Old 03-12-2009, 10:07 PM
simonlogan simonlogan is offline
Junior Member
 
Join Date: Feb 2009
Posts: 23
Default solved

Hmm, though I'd already posted a reply to this yesterday but nevermind!

Just for everyone's reference, I got it working but had to set the new field as a core field in order to allow it be searchable by a range (though my PHP skills aren't that great so it's entirely probable that somebody more talented could have got this working as a regular additional field.

To get the search working I modified advsearch.php adding a new case and then I had to modify properties.php in the administration folder to ensure that the field was updated and inserted.
  #4  
Old 03-12-2009, 11:32 PM
pantelisorfanos pantelisorfanos is offline
Mosets'd
 
Join Date: Jul 2008
Posts: 57
Default

Quote:
Originally Posted by simonlogan View Post
Hmm, though I'd already posted a reply to this yesterday but nevermind!

Just for everyone's reference, I got it working but had to set the new field as a core field in order to allow it be searchable by a range (though my PHP skills aren't that great so it's entirely probable that somebody more talented could have got this working as a regular additional field.

To get the search working I modified advsearch.php adding a new case and then I had to modify properties.php in the administration folder to ensure that the field was updated and inserted.
do you want to share the solution with us?
  #5  
Old 03-12-2009, 11:59 PM
simonlogan simonlogan is offline
Junior Member
 
Join Date: Feb 2009
Posts: 23
Default Solution

Well dont' take this as gospel as it took me a while to figure out and I was trying things in several different ways but this is basically what I did (and if anyone wants specific further help they can message me directly):

Added in a new field into the hp_prop_ef table directly using a MySQL frontend (rather than doing it via the admin panel). I set iscore to 1 and the search_type to range_3. This allows the field to be searched on with a range of dates.

Added a new field into the hp_properties table (again directly using a MySQL frontend), date format, null to No. This is to store the date value.

Edited components/models/advsearch.php and added a new case into around line 102 - i basically copied and pasted the case for created and modified fields and ended up not needing to change the code at all but figure it's better to keep this field seperate from those other core ones. I then copied and pasted again lines 383-397 which retrieves a min and max date range based upon the entries in the database and changed the code to apply it to my new field by changing "modified" to my new field's name.

Then all i had to do was edit administrator/components/com_hotproperty/tables/property.php and added in my new field on line 48 just under the list of variables in the array. This allowed the field to be inserted and updated in the properties table.

I did other small edits too like changing how the date was displayed on the pages using php date() function but that was just for cosmetic reasons more than anything else.

I've no doubt missed out some stuff there as I was just feeling my way through it as I went but I hope that's enough to help some people.
  #6  
Old 03-13-2009, 07:42 AM
pantelisorfanos pantelisorfanos is offline
Mosets'd
 
Join Date: Jul 2008
Posts: 57
Default

Quote:
Originally Posted by simonlogan View Post
Well dont' take this as gospel as it took me a while to figure out and I was trying things in several different ways but this is basically what I did (and if anyone wants specific further help they can message me directly):

Added in a new field into the hp_prop_ef table directly using a MySQL frontend (rather than doing it via the admin panel). I set iscore to 1 and the search_type to range_3. This allows the field to be searched on with a range of dates.

Added a new field into the hp_properties table (again directly using a MySQL frontend), date format, null to No. This is to store the date value.

Edited components/models/advsearch.php and added a new case into around line 102 - i basically copied and pasted the case for created and modified fields and ended up not needing to change the code at all but figure it's better to keep this field seperate from those other core ones. I then copied and pasted again lines 383-397 which retrieves a min and max date range based upon the entries in the database and changed the code to apply it to my new field by changing "modified" to my new field's name.

Then all i had to do was edit administrator/components/com_hotproperty/tables/property.php and added in my new field on line 48 just under the list of variables in the array. This allowed the field to be inserted and updated in the properties table.

I did other small edits too like changing how the date was displayed on the pages using php date() function but that was just for cosmetic reasons more than anything else.

I've no doubt missed out some stuff there as I was just feeling my way through it as I went but I hope that's enough to help some people.
gr8. thank you for sharing. btw do you have a website i can see it action?
  #7  
Old 03-13-2009, 08:24 AM
simonlogan simonlogan is offline
Junior Member
 
Join Date: Feb 2009
Posts: 23
Default

Not just yet as the site is still in development but should be launched early next week and so I'll post a link then.
  #8  
Old 03-14-2009, 02:26 AM
pantelisorfanos pantelisorfanos is offline
Mosets'd
 
Join Date: Jul 2008
Posts: 57
Default

Quote:
Originally Posted by simonlogan View Post
Not just yet as the site is still in development but should be launched early next week and so I'll post a link then.
ok waiting for then
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +8. The time now is 12:42 PM.

Copyright © 2005-2010 Mosets Consulting

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.