Skip Navigation

[Resuelto] Conditional Output

This support ticket is created hace 7 años, 4 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 18 respuestas, has 2 mensajes.

Last updated by Daniella hace 7 años, 4 meses.

Assisted by: Minesh.

Autor
Mensajes
#462523
view.png

I am trying to make it so Sold Out (a taxonomy) items don't show up on certain pages. For example, this item is sold out, hidden link, and it is not supposed to show on this page, hidden link but it is.

I've attached the View below and I am not sure how to make it so the Sold Out items don't appear.

Thank you!

#462625

Minesh
Supporter

Languages: Inglés (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

First of all - after reviewing debug information you shared with me I found that you are using outdated Toolset plugins. We recently published new release for Toolset plugins.

*** Please make a FULL BACKUP of your database and website.***
Could you please update All Toolset plugins to it's latest official release version. You can download All Toolset plugins from:
=> https://toolset.com/account/downloads/

Now, regarding your original issue of sold out product based on which parameter the product is considered as sold out product?

#462777

When were the plugins released?
Anyway, there is a checkbox for "Sale" or "Sold Out" which is the Status of the product that my client ticks off on the product. This is how the other terms are done as well. So under Color, there is a choice of "Red". Then the Red page shows the applicable products.
Thanks!

#462782

Minesh
Supporter

Languages: Inglés (English )

Timezone: Asia/Kolkata (GMT+05:30)

Latest Toolset plugins were released a couple of days back.

Can I look at your install and check further?

*** 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 would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

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

#463061

Minesh
Supporter

Languages: Inglés (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - I understand your issue totally but why I need your wp-admin access details because I need to know your field names.

You can take following examples as reference to check checkbox value and dispaly content conditionally:

[wpv-conditional if="( '[types field="movie-industry-roles" option="0"][/types]'  eq '1' )"]
<a href="#actor">Actor</a> | 
[/wpv-conditional]
[wpv-conditional if="( '[types field="movie-industry-roles" option="1"][/types]' eq '2' )"]
<a href="#director">Director</a> | 
[/wpv-conditional]

OR

Even you can try following way:

[types field="movie-industry-roles" option="0" state="checked"]
text to display when option 0 is checked 
[/types]
 
[types field="movie-industry-roles" option="1" state="checked"]
text to display when option 0 is checked 
[/types]

More info:
https://toolset.com/documentation/customizing-sites-using-php/functions/#checkboxes

#463199

I don't think that will work in this case. I edited the Private Message with the information you need. Thanks!

#463216

Minesh
Supporter

Languages: Inglés (English )

Timezone: Asia/Kolkata (GMT+05:30)

I want to make things clear here:
=> hidden link

Your all other filters are setup with "OR" operator and you want to add status taxonomy filter with sold out items should not be displayed with "AND" operator - correct?

#463311

Yes, on the example page, all of the Red jewelry should display but the products marked as Sold Out should not. Thanks.

#463320

Minesh
Supporter

Languages: Inglés (English )

Timezone: Asia/Kolkata (GMT+05:30)

Ok - Could you please send me FTP access details. I tried to make some changes to your theme's functions.php file to add view's filter but somehow it went wrong.

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

#463323

Minesh
Supporter

Languages: Inglés (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - I need to test it first and then I will be able to ship the code to you. If will be great if you can share FTP access so I will quickly test it and share the code with you.

Is server is down or this is something from my side?

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

#463345

Minesh
Supporter

Languages: Inglés (English )

Timezone: Asia/Kolkata (GMT+05:30)

Are you able to replace the functions.php file? If so - can you do it.

Or

You need to use 'wpv_filter_query' hook to combile 'And' and 'OR' taxonomy.
https://toolset.com/documentation/user-guides/views-filters/wpv_filter_query/

You already added taxonomy with 'OR' using view's GUI but now you need to add status taxonomy and combile with 'AND'.

For example:
=> https://codex.wordpress.org/Class_Reference/WP_Query
[Section: "Nested Taxonomy Handling:"]

#463350

I can do it, please supply and I'll let you know.

#463358

Minesh
Supporter

Languages: Inglés (English )

Timezone: Asia/Kolkata (GMT+05:30)

You need to add following code to your functions.php file:

add_filter( 'wpv_filter_query', 'custom_search_criteria',10,3 );
function custom_search_criteria( $query_args ,$view_settings,$view_id ) {
 
	if($view_id == 10517 ) {
     
		$tax_status = array('taxonomy' => 'status',
						 'field' => 'id',
						 'terms' => array(109),
						 'operator'=> 'IN'
						 'include_children' => 1
                );

		$query_args['tax_query'] = array('relation'=>'AND',
								$query_args['tax_query'],
								$tax_status
										);

         
	}
 
return $query_args;
}

I hope above code will work for you as I did not able to test it. You are free to modify if needed.

#463414

The code didn't work and 'broke' the site. Thanks for your help but is there anything else I can try?

#463812

Minesh
Supporter

Languages: Inglés (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - I would like to help you but I'm helpless as I do not have access details. Is it possible to share access details with me anyhow?

I need max 1 hour to check on your install and what's causing the issue.

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

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.