I'm using channel:categories and would like to show only child categories so I added the following conditional {if {parent_id} != 0}...{/if}
but get php errors as soon as I add it to the template. I tried any sort of variable check {category_description} and get errors.
The above conditional was taken from an accepted answer on another thread.
Parse error: syntax error, unexpected '{' in path\to\system\expressionengine\libraries\Functions.php(689) : eval()'d code on line 43
My template looks like this:
{!--stash 1st level category list--}
{exp:stash:set name="categories" parse_tags="yes"}{exp:gwcode_categories channel="products" depth="1" style="linear" backspace="1"}{cat_url_title}|{/exp:gwcode_categories}{/exp:stash:set}
{!--category ids for sub cats--}
{exp:stash:set name="sub_category_ids" parse_tags="yes"}{exp:gwcode_categories channel="products" output_depth="2" style="linear" backspace="1" cat_url_title="{segment_3}"}{cat_id}|{/exp:gwcode_categories}{/exp:stash:set}
{exp:stash:parse}
{exp:switchee variable="{segment_2}" parse="inward"}
{case value="#^P(/d+)$#|category|''"}
{switchee variable="{segment_3}" parse="inward"}
{case value="{stash:categories}"}{!--level 1 category listing filtered by stashed list --}
{exp:low_variables:single var="lv-products-cat-tier1"
preparse:pre_seg_id="{stash:sub_category_ids}"
preparse:pre_single_cat_id="{segment_3_category_id}"
}
{/case}{!--level 1 category listing--}
some more case checks here
{/switchee}{!--end nested switchee--}
{/case}{!--listing & category listing--}
some more case checks here
{/exp:switchee}
Finally my lv-products-cat-tier1 is a low variable with the following code where the parent conditional will wrapp the double-square div when it is working:
{!--list sub categories--}
{exp:channel:categories channel="products" show="{pre_single_cat_id}|{pre_seg_id}" style="linear"}
{if {parent_id} != 0}
yo
{/if}
<div class="col-xs-6 double-square">
<img src="http://lorempixel.com/545/270/people" alt="" class="img-responsive">
<div class="row">
<div class="pos-ab">
<div class="col-xs-6 left">
<div>
<h4><a href="/products/category/{category_url_title}">{category_name}</a></h4>
</div>
</div>
<div class="col-xs-6 right">
<div class="content">
{exp:eehive_hacksaw chars="" words="15" cutoff="" append="" allow="<p><b><a>"}
{category_description}
{/exp:eehive_hacksaw}
</div>
</div><!--right-->
</div><!--pos-ab-->
</div><!--row-->
</div><!--double square-->
{/exp:channel:categories}