I have two grid inputs and I need to have a conditional statement that says: if all fields of both grids are equal to 0, output some text. The way I'm trying to do this is by changing a variable value based on an EE if.
<?php $var = 0; ?>
{ex_product_dimensions_g}
{if ex_product_dimensions_g:height != "0" || ex_product_dimensions_g:width != "0" || ex_product_dimensions_g:depth != "0"}
{ex_product_dimensions_g:height}(h) x {ex_product_dimensions_g:width}(w) x {ex_product_dimensions_g:depth}(d)<br>
{if:else}
<?php $var++; ?>
{/if}
{/ex_product_dimensions_g}
{product_dimensions_case_g}
{if product_dimensions_case_g:height != "0" || product_dimensions_case_g:width != "0" || product_dimensions_case_g:depth != "0"}
{product_dimensions_case_g:height}(h) x {product_dimensions_case_g:width}(w) x {product_dimensions_case_g:depth}(d) (inc. Flightcase)<br>
{if:else}
<?php $var++; ?>
{/if}
{/product_dimensions_case_g}
<?php
if ($var >= 2):
echo 'Not specified';
endif;
?>
For some reason though $var seems to always increment regardless of the content in the grid input. Can the EE if statements be used for what I am trying to achieve, or is there a better way to do this?