I'm trying to modify the where condition of a views query. till now I was successful with altering "order by", but I have no idea how to alter the where condition. I want to check the search_term and if it was in uppercase, transform it to lowercase so the query can find it. also there are some special characters in my language (persian) that I need to replace them before the query runs. anyone can help me where to start or what hooks or views_handlers to use?
<?php
/**
* Implementation of hook_views_query_alter
* @param type $view
* @param type $query
*/
function nashreneydev_views_query_alter(&$view, &$query) {
//krumo($query);
//krumo($view);
if ($view->name == 'custom_search') {
$search_term = $view->exposed_raw_input['combine'];
**//$query->where[0]['conditions'][0]['field']= "?????";**
$view->query->orderby[1]['field'] = "CASE node_type WHEN 'product_display' THEN 1 ELSE 2 END";
$view->query->orderby[1]['direction'] = "ASC";
$view->query->orderby[0]['field'] = "CASE node_title WHEN '".$search_term."' THEN 1 ELSE 2 END";
$view->query->orderby[0]['direction'] = "ASC";
//krumo($view->query->orderby);
}
}
?>
the devel result for where condition is as follow right now. :views_combine is equal to %s%.
CONCAT_WS(' ', node.title, ' ', field_data_body.body_value, ' ', field_data_field_author.field_author_target_id, ' ', field_data_field_translator.field_translator_target_id, ' ', field_data_field_book_tags.field_book_tags_tid) LIKE :views_combine