smarty - Get categories in a Prestashop theme -
i'd categories in header (header.tpl
) of prestashop theme seems not working well...
my code header.tpl
:
{$childcategories= category::getchildren(0, 0, $active = true, $id_shop = false);} {printf($childcategories)}
issue : error 500
the code have written not valid smarty. prestashop uses smarty render templates. please, take rules if want avoid troubles this. also, have lot of examples in default theme of prestashop learn more coding in smarty.
the right code be:
{assign var='childcategories' value=category::getchildren(1, 1, true, false)}
arguments passed
- $id_parent : parent category id. root id category 1 , home id category 2.
- $id_lang: id language. can check in localization area id of language. if have enable multiple languages, use $language variable id. list of global variables in prestashop.
- $active: return active caregories.
- $id_shop: id of shop if have got multiple shops in instalation.
printing variables debug
if want debug or see variables, try following snippets of code:
{* print variable $childcategories *} {$childcategories|var_dump}
or:
{* print variables *} {debug}
Comments
Post a Comment