I’m running EE 2.2.2 - I’m using the following code to output some rather basic XML.
Problem is that {parent_id} variable is always returning the value 0. Even when the category has a parent category.
{exp:channel:entries dynamic="no" channel="products" category_group="8"}
{/exp:channel:entries}When using the channel categories tag pair the categories are output with the correct parent_id.
{exp:channel:categories channel="products" style="linear" dynamic="no" category_group="8"}
{if parent_id == 0}<category>{/if}
{if parent_id != 0}<sub_category>{/if}
<id>{category_id}</id>
{parent_id}</parent_id>
<url_title>{category_url_title}</url_title>
<name>{exp:xml_encode}{category_name}{/exp:xml_encode}</name>
{if parent_id != 0}</sub_category>{/if}
{if parent_id == 0}</category>{/if}
{/exp:channel:categories}Suggestions as to why the {categories} variable pair wouldn’t have the correct value for {parent_id}?
PS. there is no nesting going on.