Skip Navigation

[Resuelto] Filter about categories dont set condition

This support ticket is created hace 7 meses. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Este tema contiene 12 respuestas, tiene 3 mensajes.

Última actualización por Waqar hace 6 meses, 2 semanas.

Asistido por: Waqar.

Autor
Mensajes
#2691497

Hi,

i have a view with simple Fields and i filter it with a dropdown about categories - > in url-parameter wpv-land.

All is good, but when i reset the filter to default value "bitte auswählen" - now it show all posts and the wpv-land parameter will removed from url.

Now i want to hide all posts.. - i try the following code - it works, but not if i reset the dropdown:

[wpv-conditional if="('[wpv-search-term param="wpv-land"]' ne '' )"]

<h3>[wpv-post-title]</h3>
[types field='strase'][/types], [types field='plz'][/types] [types field='ort'][/types]<br>
[wpv-conditional if="( $(wpcf-telefon) ne '' )"][types field='telefon'][/types]<br>[/wpv-conditional]
[wpv-conditional if="( $(wpcf-fax) ne '' )"][types field='fax'][/types]<br>[/wpv-conditional]
[wpv-conditional if="( $(wpcf-e-mail) ne '' )"][types field='e-mail'][/types]<br>[/wpv-conditional]
[wpv-conditional if="( $(wpcf-url) ne '' )"][types field='url'][/types]<br>[/wpv-conditional]

[/wpv-conditional]

[wpv-conditional if=" ( '[wpv-search-term param="wpv-land"]' eq '') "] no [/wpv-conditional]

i searched the forum but nothing works - What is the Problem with it?

enlace oculto

best regards - alex

#2691560

Minesh
Supporter

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Do you want to hide the results displayed by view until user select the taxonomy filter?

I checked the URL you shared but I do not see anything related on it. Do I require to login as admin to see the issue?

Can you please share bit more details and share what is your exact requirement and share admin access details with problem URL and exact steps to see the issue.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2692023

Minesh
Supporter

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

Can you please check now:

I've added the following filter hook to "Custom Code" section offered by Toolset with code snippet namely "toolset-custom-code":

add_filter( 'wpv_filter_query', 'func_show_no_result_on_default_select_option', 10, 3 );
      
function func_show_no_result_on_default_select_option( $query_args, $setting,$view_id ) {
     
    if($view_id == 8393){
         
              if(defined('DOING_AJAX') and  DOING_AJAX ) {
                
                if( !isset($query_args['tax_query']) or empty($query_args['tax_query']) ) {
              
                		$query_args['post__in'] = array(0);
           		} 
       }
    }
    return $query_args;
}

More info:
- https://toolset.com/documentation/programmer-reference/adding-custom-code/using-toolset-to-add-custom-code/#adding-custom-php-code-using-toolset
- https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

#2692027

hi, - thx - that is it!

can you tell me why this condition is not working in output-editor of view:
[wpv-conditional if=" ( '[wpv-search-term param="wpv-land"]' eq '') "] [wpml-string context="wpv-views"]Choose a country.[/wpml-string] [/wpv-conditional]

i try to show this message also on start/first load - how can i do this in loop-editor like:
[wpv-no-items-found]
[wpml-string context="wpv-views"]Choose a country.[/wpml-string]
[/wpv-no-items-found]

Los hilos nuevos creados por Minesh y vinculados a este se encuentran a continuación:

https://toolset.com/es/forums/topic/split-filter-about-categories-dont-set-condition-conditional-display/

#2692032

Minesh
Supporter

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

As per our support policy. We entertain only one question per ticket. This will help other users searching on the forum as well as help us to write problem resolution summery for the original issue reported.

May I kindly ask you to open a new ticket with every new question you may have.

For now I'll split the ticket with your new question and you're welcome to mark resolve this ticket. We will continue for your new question with the following split ticket:
- https://toolset.com/forums/topic/split-filter-about-categories-dont-set-condition-conditional-display/

#2692044

Hi, but this is what i asked in first post 😉 - should i open a new ticket also? - thx - best regards

#2692052

Minesh
Supporter

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

Thank you. You're welcome to mark resolve this ticket.

#2692617

Hi Minesh - i dont understand this now - in CustomCode i dont change something, but when i set the dropdown, after choosing a language, back to "bitte auswählen" - there are no more countries/taxonomies in dropdown. Look at this link: enlace oculto

And can i set the dropdown to a single default post that shows only if page first load.

thx - alex

#2692678
custom-search-settings.png

Hi Alex,

I'm following up on this ticket as Minesh is on vacation.

In the view 'Partner-Suche-01', I've updated the search settings so that it 'Always shows all values for inputs'.
( screenshot attached )

Now, it is showing the other country taxonomy options, always, even when the default option "bitte auswählen" is selected back.

regards,
Waqar

#2693213

Hi Waqar - thx - can i also set a post to display if in dropdown "bitte auswählen" choosed? That means one post as default if nothing selected in Dropdown?

best regards - alex

#2693565

If you'd like to show a default post, when the "bitte auswählen" option is selected, you can replace the '0' in the custom code that Minesh provided, with the ID of the target post.
( screenshot: enlace oculto )

#2693578

Hi Waqar - thx this is working - can i set these post at first page load too? - I mean if you the page load at first time:
enlace oculto

thx - alex

#2693827

I've noticed that you managed to make this work, by including another conditional segment in the view.

You're welcome to mark this ticket as resolved and start a new one, for each new question or concern.

#2693828

thx Waqar and Minesh - good helping!