Explainer video: hidden link
I am trying to: Show a set of 2 content blocks (in content template 519, 'single template - toilets') based on the values selected for a checklist custom field (Group 483 (toilets), field is called 'pieces'). For a specific toilet (custom post type is toilets, ID is 647), I've selected that the toilet is both a 1-piece and 2-piece toilet).
Link to a page where the issue can be seen:hidden link
I expected to see: Both the 1 piece toilet design and 2 piece toilet design blocks appear for this post
* Screenshot from the template for toilets (content template 519): hidden link
Instead, I got: Only the content block for 1 piece toilets appear (hidden link)
Questions
* Since there isn't documentation to adequately describe how the custom field needs to be configured to work with the conditional logic, can you please help me understand this?
Thanks
Hello and thank you for contacting the Toolset support.
I tried this on a clean install and I can confirm that there is a bug in the conditional block that prevents the use of conditions on the checkboxes field. I am escalating this case to our 2nd Tier for another evaluation.
In the meantime, as a workaround, you can use a custom function for the condition. Check this article https://toolset.com/documentation/programmer-reference/views/using-custom-functions-in-conditions/
I added the following function to a custom code snippet in Toolset->Settings->Custom code. And I activated the snippet:
function checkboxes_has($field, $field_value) {
$values_str = types_render_field( $field, array( "separator" => ", " ) );
$values = explode(',', $values_str);
if ( !count($values) ) return 0;
foreach( $values as $value ) {
if( $value == $field_value ) return 1;
}
return 0;
}
Then, I registered the checkboxes_has function in Toolset settings.
And then I used it in my conditional block. Check this screenshot hidden link
You can log into my test site with this URL hidden link
Check the function code here hidden link
And check the first conditional block in the content template here hidden link
I hope this helps. Let me know if you have any questions.
I do appreciate your efforts in providing a workaround. It's a bit more than we can handle.
Would you have any way of knowing whether there's a fix in the works?
I am afraid it will take some time(a few months) before we have a fix released. The development team is working on improving several Toolset fields, until then, they won't work on conditions' issues.
Please let me know if you need help implementing this workaround.