improved better search
activated terms filtration regarding useinadvancedsearch term field added all children of level 2 terms
This commit is contained in:
parent
4237cb8edb
commit
d2cffdeddd
@ -731,11 +731,13 @@ function materio_search_api_advanced_search_form($form, &$form_state){
|
|||||||
foreach ($tree as $term) {
|
foreach ($tree as $term) {
|
||||||
// dsm($term, "term");
|
// dsm($term, "term");
|
||||||
|
|
||||||
|
if($term->field_used_on_advanced_search['und'][0]['value'] == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
$children = taxonomy_get_children($term->tid, $vid);
|
$children = taxonomy_get_children($term->tid, $vid);
|
||||||
// dsm($children, "children");
|
// dsm($children, "children");
|
||||||
|
|
||||||
if($term->field_used_on_advanced_search['und'][0]['value'] == 0
|
if(!count($children))
|
||||||
|| !count($children))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$form['slider']['voc-'.$vid]['tree-'.$term->tid] = array(
|
$form['slider']['voc-'.$vid]['tree-'.$term->tid] = array(
|
||||||
@ -761,26 +763,29 @@ function materio_search_api_advanced_search_form($form, &$form_state){
|
|||||||
|
|
||||||
$options = array();
|
$options = array();
|
||||||
foreach ($children as $tid => $child) {
|
foreach ($children as $tid => $child) {
|
||||||
// $child = taxonomy_term_load($child->tid);
|
$child = taxonomy_term_load($child->tid);
|
||||||
// if($child->field_used_on_advanced_search['und'][0]['value'] == 0){
|
// dsm($child, 'child');
|
||||||
// continue;
|
if($child->field_used_on_advanced_search['und'][0]['value'] == 0){
|
||||||
// }
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$children2 = taxonomy_get_children($child->tid, $vid);
|
// $children2 = taxonomy_get_children($child->tid, $vid);
|
||||||
|
$children2 = taxonomy_get_children_all($child->tid, $vid);
|
||||||
// dsm($children2, "children2");
|
// dsm($children2, "children2");
|
||||||
|
|
||||||
if(count($children2))
|
if(!count($children2))
|
||||||
$options[$tid] = $child->name;
|
continue;
|
||||||
|
|
||||||
|
$options[$tid] = $child->name;
|
||||||
|
|
||||||
$classes2 = array("treelevel2", $child->tid);
|
$classes2 = array("treelevel2", $child->tid);
|
||||||
|
|
||||||
$options2 = array();
|
$options2 = array();
|
||||||
$dflt_values2 = array();
|
$dflt_values2 = array();
|
||||||
foreach ($children2 as $tid2 => $child2) {
|
foreach ($children2 as $tid2 => $child2) {
|
||||||
// $child2 = taxonomy_term_load($child2->tid);
|
$child2 = taxonomy_term_load($tid2);
|
||||||
// if($child2->field_used_on_advanced_search['und'][0]['value'] == 0){
|
if($child2->field_used_on_advanced_search['und'][0]['value'] == 0)
|
||||||
// continue;
|
continue;
|
||||||
// }
|
|
||||||
|
|
||||||
$options2[$tid2] = $child2->name;
|
$options2[$tid2] = $child2->name;
|
||||||
|
|
||||||
@ -832,6 +837,21 @@ function materio_search_api_advanced_search_form($form, &$form_state){
|
|||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function taxonomy_get_children_all($tid, $vid = 0, $key = 'tid'){
|
||||||
|
$c = taxonomy_get_children($tid, $vid, $key);
|
||||||
|
$result = array();
|
||||||
|
foreach ($c as $t => $d){
|
||||||
|
$result[$t] = $d;
|
||||||
|
$below = taxonomy_get_children_all($t, $vid, $key);
|
||||||
|
if (!empty($below)) {
|
||||||
|
foreach ($below as $nt => $nd){
|
||||||
|
$result[$nt] = $nd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
function materio_search_api_advanced_search_form_validate($form, &$form_state){
|
function materio_search_api_advanced_search_form_validate($form, &$form_state){
|
||||||
// dsm($form, '$form');
|
// dsm($form, '$form');
|
||||||
// dsm($form_state, '$form_state');
|
// dsm($form_state, '$form_state');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user