{function printTemplateCategory}
   {if $product_templates[$category]}
      {$category = $product_templates[$category]}
      {block "render-template-category"}
         <div class="product-template" id="product-template-{$category.id}">
            <div>
               {foreach $category.values as $template}
                  {$template.text|inline_edit nofilter}
               {/foreach}
            </div>
         </div>
      {/block}
   {/if}
{/function}

{if isset($position) and $product_templates[$position]}
   {foreach $product_templates[$position] as $category => $_}
      {printTemplateCategory category=$category}
   {/foreach}
{elseif !isset($position)}
   {printTemplateCategory category=$category}
{/if}
