I have properties that have a rental price. The rental price is a field collection with a value (price) and period (per month, per week). You can sort the properties by price (low to high, or high to low) using an exposed filter. The problem is that if someone enters 2000 per month it is being registered as more expensive than a property that is 600 per week (2400 per month). So I want to divide the monthly values by 4 in order to have equal calculation.

What hook do I need to use in order to process the value field just before it is used to sort the properties?

1 Answer 1


you can change query of view by this hook_views_query_alter(&$view, &$query)

This hook is a core hook of views api but you can override it in you custom moduel like MYMODULENAME_views_query_alter

In this hook you can get parameters by exposed filter's and change views query based on these parameters.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.