Hi there...
Im trying to make a range between 2 fields for a search form, but can't seem to accomplish to make it work like I want...
Firstly I have made 2 fields with integer(list) but with those I could not even come close to what I want because there isn't any greater than and lesser than operators, so now I have tried making my fields normal integers instead...
So the scenario I want is....
The 2 fields in the node is a price min. and a price max.
Then I want these 2 fields in the search form for ppl to search by, and this I can make, but if I have a pricerange in the node saying min. 5000 and max. 10.000
and ppl then input min. 4000 and max. 6000 in the form I want that result to appear, because their max. is in the range of the nodes range, but obviously it wont because they entered a min. below the nodes min.
If I could have used integers(lists) with greater than og lesser than this would have been much easier.....
But can this scenario be accomplished any way?
Comments
Comment #1
acoustika commentedWell I spend some hours now researching and I problably will need to make a hook_views_form_alter, but since I have no clue as to how to do this I wonder if anyone could help me...
I've managed to make a module and get views to pick if up and reading on other post to do somethink like
But then the next thing i need to do is in common language to make it do something like
if both field_max and field_min is set in the form AND field_max >= db_field_min THEN show that result regardless if field_max < db_field_max
field_min and field_max is both 2 integers fields..... Anyone have a clue as to how to alter the query to do this?
Comment #2
acoustika commentedManaged to et a little further.....
So how do I do the check against a speccific value from the query here?, i my case the min. value from my min_field in the database
Comment #3
jurveen commentedWhat about using the exposed filters in Views? There you can choose the operator for the field (less than, equals, etc.), and make filter groups with logical operators. I guess with the right ORs and ANDs you can compose a set that compares the input of the filters to the 2 fields. Much easier than writing your own module. :)
Comment #4
kars-t commentedDear fellow Drupal enthusiasts,
This issue is now lasting for a very long time in the issue queue and was unfortunately never solved. As Drupal is a open source project, everyone is helping on a voluntary basis. That this was not solved is nothing personal and means no harm. But perhaps no one had time to deal with this issue, maybe it is too complex, or the problem was not described comprehensibly.
But this issue is not the only one. There are thousands of issues on Drupal.org that have never been worked on or could not be processed. This means that we are building a wave that is unmanageable and it is a problem for the Drupal project as a whole. Please help us keep the issue queue smaller and more manageable.
Please read again, "Making an issue report" and see if you can improve the issue. Test the problem with the current Core and modules. Maybe the problem doesn't exist anymore, is a duplicate or has even been solved within this issue but never closed.
Help can also be found for it on IRC and in the user groups.
In order to close this issue, I have set this issue to "Closed (won't fix)".
If there is new information, please re-open the issue by changing the status to active.
--
This issue was edited with the help of Issue Helper