0

I am working with facetapi & facetapi_pretty_paths for my product search. I already created the widget ,it is showing facet in drop down list . Now i have the problem ,that when i search any thing the first search is working fine ,but after that the widget field value is not set as of path alias . I followed this module .

In the facet_select.module

/**
 * Widget that renders facets as dropdowns.
 */
class FacetapiSelectDropdowns extends FacetapiWidgetLinks {

  /**
   * Renders the links.
   */
  public function execute() {
    static $count = 0;
    $count++;

    $element = &$this->build[$this->facet['field alias']];
    print_r(&$this);exit;
    if(count($element) > 1){
      $options['choose'] = t('- choose -');
    }
    foreach ($element as $value => $item) {

       //here i want pretty path alias value  $options[?]

       $options[$item['#path']] = $item['#markup'];
    }
    if (end($options) !== '(-)') {
      if (!isset($form_state)) {
        $form_state = array();
      }
      $element = facetapi_selectbox_facet_form($form_state, $options, $count);
    }
  }
}

Is i am doing it wrong ?

Any help is most welcome . Thank you.

EDIT: here is the widget function

function facetapi_selectbox_facet_form($form_state, $options, $count = 0) {
  drupal_add_js(drupal_get_path('module', 'facetapi_selectbox') .'/js/facetapi_select.js');

  $name = 'facetapi_selectbox_facet_form_' . $count;
  $form['facets'] = array(
    '#type' => 'select',
    '#id' => $name,
    '#default_value' => '',
    '#options' => $options,
    //'#attributes' => array('onchange' => "top.location.href=document.getElementById('$name').options[document.getElementById('$name').selectedIndex].value"),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
  );
  return $form;
}
  • That module is only available as a development release so it's not ready for product sites. Also this seems to be about a bug in the module so should be posted in the issue queue, not here. Whilst the module is Minimally maintained the last update was in February so it looks like there is still active development there. – Felix Eve Apr 29 '14 at 11:30
  • thank you for your replay, ya i am writing another module referencing that with fixed of all the bug it is working properly ,when only one search at a time i.e, if i select any of the option it will be redirect to the referencing link . now i want that in the submitted page don't change the option value keep it as is because i have the option of select two option at a time.see my EDIT – Lucifer Apr 29 '14 at 11:58
  • So just to be clear is this a bug due to code in the Facetapi Select module or is it due to code you've written? – Felix Eve Apr 29 '14 at 12:00
  • i am adding extra feature to it so i need this . – Lucifer Apr 29 '14 at 12:05

Your Answer

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

Browse other questions tagged or ask your own question.