Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter Ashish

    (@ashishpatel1992)

    As you already know if we have lots of checkbox in page it doesnt looks much prettier… So give a thought of having Dropdown checkboxes.

    Plugin Author TC.K

    (@wp_dummy)

    If you using js to bind into the checkbox, you can using the selector id ‘tax-check-x’ where is x is number of the checkbox set you want to bind.
    eg.:

    $('#tax-check-1').....

    If you don’t want using the method above you can use uwpqsf_tax_field_checkbox filter to customize the checkbox. Please refer to this thread , there was an example how to add multi select to the form.

    Thread Starter Ashish

    (@ashishpatel1992)

    Hello,
    I have used the code provided on the post but it searches only when ALL Salary option is selected and doesnt work for individual selection.
    I am using the code from here

    you can see the site here

    Plugin Author TC.K

    (@wp_dummy)

    You need to add [] to the name field:
    $html .= '<select multiple id="tdp-'.$c.'" class="tdp-class-'.$c.'" name="taxo['.$c.'][term][]">';

    Thread Starter Ashish

    (@ashishpatel1992)

    after adding
    $html .= '<select multiple id="tdp-'.$c.'" class="tdp-class-'.$c.'" name="taxo['.$c.'][term][]">';
    the ‘ALL salary’ option started giving no results and selecting multiple items as usual resulted no results.

    I revered back to code
    $html .= '<select multiple id="tdp-'.$c.'" class="tdp-class-'.$c.'" name="taxo['.$c.'][term][]">';

    and I am in a state where only ‘All salary’ works but selecting multiple items wont.

    Thread Starter Ashish

    (@ashishpatel1992)

    Opps.

    Reverted back to code
    $html .= '<select multiple id="tdp-'.$c.'" class="tdp-class-'.$c.'" name="taxo['.$c.'][term]">';

    Thread Starter Ashish

    (@ashishpatel1992)

    ALso,
    I see following error in debug log
    ===================================

    Erreur de la base de données WordPress Unknown column 'wp_term_relationships.term_taxonomy_id' in 'where clause' pour la requête SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  LEFT JOIN wp_postmeta ON wp_posts.ID = wp_postmeta.post_id  WHERE 1=1  AND (
      wp_term_relationships.term_taxonomy_id IN (545,546,547,548,549,551,552,553,554,556,557,558,559,560,561,562,575)

    =====================================

    I am not sure why I am only getting these sql errors. I have verified in database and wp_term_relationships.term_taxonomy_id exists.

    Thread Starter Ashish

    (@ashishpatel1992)

    One thing to notice about it is everything works good when using Ajax Method.
    Why is the problem only with normal search method?

    Plugin Author TC.K

    (@wp_dummy)

    This is because there is bug in WordPress which have not fix yet.

    Thread Starter Ashish

    (@ashishpatel1992)

    Ok. Thanks for the info. Finally I had moved to Ajax method which is working with the code provided above by you
    $html .= '<select multiple id="tdp-'.$c.'" class="tdp-class-'.$c.'" name="taxo['.$c.'][term][]">';

    Only a small problem. Selecting a single or multiple fields result in search and works.
    But ‘All Salary’ option is resulting in no results since I have added []
    Here All salary refers to the option by which it selects all items.

    Here is my code:
    ==================================

    add_filter('uwpqsf_addtax_field_multiselect','multiselect_front','',11);
    function multiselect_front($type,$exc,$hide,$taxname,$taxlabel,$taxall,$opt,$c,$defaultclass,$formid,$divclass){
    
    	$eid = explode(",", $exc);
    	$args = array('hide_empty'=>$hide,'exclude'=>$eid );
    	$taxoargs = apply_filters('uwpqsf_taxonomy_arg',$args,$taxname,$formid);
        $terms = get_terms($taxname,$taxoargs);
    	$count = count($terms);
    
    	$html  = '<div class="'.$defaultclass.' '.$divclass.'" id="tax-select-'.$c.'"><span class="taxolabel-'.$c.'">'.$taxlabel.'</span>';
    	$html .= '<input  type="hidden" name="taxo['.$c.'][name]" value="'.$taxname.'">';
    	$html .= '<input  type="hidden" name="taxo['.$c.'][opt]" value="'.$opt.'">';
    	$html .= '<select size="5" multiple id="tdp-'.$c.'-'.$i.'" class="tdp-class-'.$c.'" name="taxo['.$c.'][term][]">';
    		if(!empty($taxall)){
    			$html .= '<option selected value="uwpqsftaxoall">'.$taxall.'</option>';
    		}
    			if ( $count > 0 ){
    					foreach ( $terms as $term ) {
    					$selected = (isset($_GET['taxo'][$c]['term']) && $_GET['taxo'][$c]['term'] == $term->slug) ? 'selected="selected"' : '';
    					$html .= '<option value="'.$term->slug.'" '.$selected.'>'.$term->name.'</option>';}
    		}
    	$html .= '</select>';
    	$html .= '</div>';
    	return $html;
    }

    ============================================
    Thanks

    Plugin Author TC.K

    (@wp_dummy)

    You probably need js to control the select all behavior.

    $('[id^=tdp-').click(function() {
       if($(this).val() == 'uwpqsftaxoall'){
         $(this, 'option').prop('selected', true);}
        }
    });

    I did not try this code though.

    Or you can try remove the select all from the multi select and put it outside the select box. And then bind it to js. Example here.

    Thread Starter Ashish

    (@ashishpatel1992)

    Hello,
    Ok there seems to be a misunderstanding.
    See open this link
    Try selecting ‘All Location’ and search you wont get result.
    the try selecting locations mentioned except ‘All Location’ option.
    You will see that result appears.
    So since I added [] in name=”taxo[‘.$c.’][term][]“>
    $html .= '<select multiple id="tdp-'.$c.'" class="tdp-class-'.$c.'" name="taxo['.$c.'][term][]">';

    ‘All location’ doesnt work and selecting multiple location works.

    earlier before adding [] in name=”taxo[‘.$c.’][term]”> .
    All location was working and selecting multiple location didnt work.

    So looks like problem with only ‘All Location’ selection.
    Check the link above to test.

    Plugin Author TC.K

    (@wp_dummy)

    I think you misunderstanding the ‘select all’ option. If you notice when you using checkboxes, when you select all, it will checked all the checkboxes option, so the js mentioned above does the same thing.

    When you are using chekboxes/multi select, the query took it as an array of data. So, you must the terms (options) to be selected in order to sending the data as the query.
    Previously when the name without the [] , it will treat the input as single value (not array), so that’s why it’s not working.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Replacing Plugin Function in class for styling’ is closed to new replies.