Jump to content

Conditional Output in Custom Template Based on Radio Button Custom Fields


admin-1506155825

Recommended Posts

This is about the implementation of conditional outputs based on custom fields in custom templates
https://www.jreviews.com/docs/theme-resources/customize-layout-of-custom-fields#field-value-multiple-options

In this case we are seeking to hide the inquiry form on a listing when it is marked sold.  That is, the radiobutton field 'jr_listingstatus' has the option value 'soldout'.

This is inserted directly into a custom template. However, neither the 'in_array'.... or '! in_array'.... if arguments work as expected.  

Ideas for the correct implementation?

	<?php if (! in_array('soldout', $CustomFields->fieldValue('jr_listingstatus',$listing))): ?>

	<h2 class="a-header-class" id="an-id"><span class="jrHeadingText"><?php __t("Title");?></span></h2>

	<?php $permission = $this->perm->__('listing')->setListing($listing); 

	if ($permission->allowsInquiries() && $permission->canSendInquiry())
	{
	
	echo $this->element("inquiry_widget");
	}

	?>

	<?php endif; ?>

 

Link to comment
×
×
  • Create New...