XF 2.2 Having 2 resource custom fields append to eachother

Berb

Member
Hi,

So an issue I've got is that I have a custom field value I want to display on my resource. It uses the format "Min" - "Max" as a range, for example 4-8 or 12-16.

I have custom fields entered on resource submission for the Min value and the Max value, currently they display like this:

Min 12
Max 16

Where instead I'd like them to display like:

Count 12-16

I've tried putting a conditional statement in the custom_fields_macros template "custom_fields_values" macro that contains the for loop controlling the resource field display, but to no luck.
 
Solution
Update: I've figured out a hack job version of a fix for this.

1) Ensure your custom fields are in the correct order
2) In the custom_fields_macros template, find the foreach loop that handles resource custom field display
3) Add in elseif conditional statements for the field values you want to append. For the first field, create a variable that stores the field value. For the second, use whatever HTML you want to display the fields then just call on the variable.

HTML:
<xf:elseif is ="$fieldDefinition.field_id == 'min'" />
                <xf:set var="$min" value="{$fieldValue}"/>
            <xf:elseif is ="$fieldDefinition.field_id == 'max'" />   
                <dl class="{$valueClass}" data-field="{$fieldId}">...
Update: I've figured out a hack job version of a fix for this.

1) Ensure your custom fields are in the correct order
2) In the custom_fields_macros template, find the foreach loop that handles resource custom field display
3) Add in elseif conditional statements for the field values you want to append. For the first field, create a variable that stores the field value. For the second, use whatever HTML you want to display the fields then just call on the variable.

HTML:
<xf:elseif is ="$fieldDefinition.field_id == 'min'" />
                <xf:set var="$min" value="{$fieldValue}"/>
            <xf:elseif is ="$fieldDefinition.field_id == 'max'" />   
                <dl class="{$valueClass}" data-field="{$fieldId}">
                    <dt><span class="customFieldIcon" id="count"></span></dt>
                    <dd>{$minPlayers} - {$fieldValue}</dd>
                </dl>

Let me know if I've done this the right way or if there was a much simpler solution.
 
Solution
Back
Top Bottom