Jump to content

Prestashop subcategories returns null


mat94600

Recommended Posts

Hi,

 

After upgrading prestashop 1.5 to 1.6 i cannot view subcategories on new shop, with the old shop i have this structure on category page :

 

  • Category name
    - subcategory 1 name
    - subcategory 2 name
    ...
  • Category name 2
    - sucategory 2 name
    etc...
     

On new shop after upgrade, i only have :

  • Category name
     

Category.tpl
 

<div id="subcategories">
		{foreach from=$subcategories item=subcategory name="subcategory"}

		<h2 class="title_block"><a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" class="cat_name">{$subcategory.name|escape:'htmlall':'UTF-8'}</a></h2>
		{math equation="ceil(count/3)" count=$subcategory.subcategories|count assign=modulo}
		{$subcategory.subcategories|@debug_print_var} /* <=== HERE I DEBUG SUBCATEGORIES */
		{foreach from=$subcategory.subcategories item=subsubcategory name="subsubcategory"}
		
		{if $modulo==1 || $smarty.foreach.subsubcategory.iteration%$modulo==1 }
		<ul class="inline_list">
			{/if}
			<li class="clearfix">
				<a href="{$link->getCategoryLink($subsubcategory.id_category, $subsubcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" class="cat_name">{$subsubcategory.name|escape:'htmlall':'UTF-8'}</a>
			</li>
			{if $smarty.foreach.subsubcategory.iteration%$modulo==0 || $smarty.foreach.subsubcategory.iteration==$subcategory.subcategories|count}
		</ul>
		{/if}
		{/foreach}
		<br class="clear"/>
		{/foreach}
	</div>
	{else}
		<div id="subcategories">
			{math equation="ceil(count/2)" count=$subcategories|count assign=modulo}
			{foreach from=$subcategories item=subcategory name="subcategory"}
			{if $modulo==1 || $smarty.foreach.subcategory.iteration%$modulo==1 }
			<ul class="inline_list_2">
				{/if}
				<li class="clearfix">
					<a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" class="cat_name">{$subcategory.name|escape:'htmlall':'UTF-8'}</a>
				</li>
				{if $smarty.foreach.subcategory.iteration%$modulo==0 || $smarty.foreach.subcategory.iteration==$subcategories|count}
			</ul>
			{/if}
			{/foreach}
			<br class="clear"/>
		</div>
	{/if}

As you can see, i have debugged {$subcategory.subcategories} and it returns "null" on front. so why it's not returns subcategories , so my question :

Why it's returns null on 1.6, something has changed on the controller of the category? 

 

thank you

 

 

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...