Jump to content

[SOLVED]Remove subcategories text in Categories


Recommended Posts

Edit category.tpl in your theme's directory and {* comment out *} the following on lines 32-53 (in PrestaShop v1.3.2):

{if isset($subcategories)}
<!-- Subcategories -->

{l s='Subcategories'}

   {foreach from=$subcategories item=subcategory}

           <a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$subcategory.name|escape:'htmlall':'UTF-8'}">
               {if $subcategory.id_image}
                   <img src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium')}" alt="" />
               {else}
                   <img src="{$img_cat_dir}default-medium.jpg" alt="" />
               {/if}



           <a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}">{$subcategory.name|escape:'htmlall':'UTF-8'}

   {/foreach}




{/if}

Link to comment
Share on other sites

Hey Rocky

Thanks for your reply

Hmm if i comment out the code it removes the entire product page..

Im using version 1.3.1.1

This is the code from my category.tpl

Could you look thru the code please? :)

{include file=$tpl_dir./breadcrumb.tpl} 
{include file=$tpl_dir./errors.tpl}

{if $category->id AND $category->active}

       {$category->name|escape:'htmlall':'UTF-8'}
       {*{$nb_products|intval} {if $nb_products>1}{l s='products'}{else}{l s='product'}{/if}*}


   {if $scenes}
       <!-- Scenes -->
       {include file=$tpl_dir./scenes.tpl scenes=$scenes}
   {else}
       <!-- Category image -->
       {if $category->id_image}
getCatImageLink($category->link_rewrite, $category->id_image, 'category')}" alt="{$category->name|escape:'htmlall':'UTF-8'}" title="{$category->name|escape:'htmlall':'UTF-8'}" id="categoryImage" />
       {/if}
   {/if}

   {if $category->description}
{$category->description}
   {/if}
   {if isset($subcategories)}
   <!-- Subcategories -->

{l s='Subcategories'}

       {foreach from=$subcategories item=subcategory}

getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$subcategory.name|escape:'htmlall':'UTF-8'}">
                   {if $subcategory.id_image}
getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium')}" alt="" />
                   {else}

                   {/if}



getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}">{$subcategory.name|escape:'htmlall':'UTF-8'}

       {/foreach}




   {/if}
   {if $products}
           {include file=$tpl_dir./product-list.tpl products=$products}
       {elseif !isset($subcategories)}

{l s='There is no product in this category.'}
       {/if}
{elseif $category->id}

{l s='This category is currently unavailable.'}
{/if}

Link to comment
Share on other sites

Try the following:

{include file=$tpl_dir./breadcrumb.tpl} 
{include file=$tpl_dir./errors.tpl}

{if $category->id AND $category->active}
{strip}
       {$category->name|escape:'htmlall':'UTF-8'}
{*        
           {if $nb_products == 0}{l s='There are no products.'}
           {else}
               {if $nb_products == 1}{l s='There is'}{else}{l s='There are'}{/if} 
               {$nb_products} 
               {if $nb_products == 1}{l s='product.'}{else}{l s='products.'}{/if}
           {/if}
*}{/strip}


   {if $scenes}
       <!-- Scenes -->
       {include file=$tpl_dir./scenes.tpl scenes=$scenes}
   {else}
       <!-- Category image -->
       {if $category->id_image}

           <img src="{$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category')}" alt="{$category->name|escape:'htmlall':'UTF-8'}" title="{$category->name|escape:'htmlall':'UTF-8'}" id="categoryImage" />

       {/if}
   {/if}

   {if $category->description}
{$category->description}
   {/if}
   {if isset($subcategories)}
   <!-- Subcategories -->

{l s='Subcategories'}

       {foreach from=$subcategories item=subcategory}

               <a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$subcategory.name|escape:'htmlall':'UTF-8'}">
                   {if $subcategory.id_image}
                       <img src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium')}" alt="" />
                   {else}
                       <img src="{$img_cat_dir}default-medium.jpg" alt="" />
                   {/if}



               <a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}">{$subcategory.name|escape:'htmlall':'UTF-8'}

       {/foreach}




   {/if}

   {if $products}
           {include file=$tpl_dir./product-sort.tpl}
           {include file=$tpl_dir./product-list.tpl products=$products}
           {include file=$tpl_dir./pagination.tpl}
       {elseif !isset($subcategories)}

{l s='There are no products in this category.'}
       {/if}
{elseif $category->id}

{l s='This category is currently unavailable.'}
{/if}

Link to comment
Share on other sites

  • 1 month later...

This does not work for me. It removed the entire subcategory

{include file=$tpl_dir./breadcrumb.tpl} 
{include file=$tpl_dir./errors.tpl}

{if $category->id AND $category->active}

       {$category->name|escape:'htmlall':'UTF-8'}
{$nb_products|intval} {if $nb_products>1}{l s='products'}{else}{l s='product'}{/if}


   {if $scenes}
       <!-- Scenes -->
       {include file=$tpl_dir./scenes.tpl scenes=$scenes}
   {else}
       <!-- Category image -->
       {if $category->id_image}
getCatImageLink($category->link_rewrite, $category->id_image, 'category')}" alt="{$category->name|escape:'htmlall':'UTF-8'}" title="{$category->name|escape:'htmlall':'UTF-8'}" id="categoryImage" />
       {/if}
   {/if}

   {if $category->description}
{$category->description}
   {/if}
   {if isset($subcategories)}
   <!-- Subcategories -->

{l s='Subcategories'}

       {foreach from=$subcategories item=subcategory}

getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$subcategory.name|escape:'htmlall':'UTF-8'}">
                   {if $subcategory.id_image}
getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium')}" alt="" />
                   {else}

                   {/if}



getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}">{$subcategory.name|escape:'htmlall':'UTF-8'}

       {/foreach}




   {/if}

   {if $products}
           {include file=$tpl_dir./product-sort.tpl}
           {include file=$tpl_dir./product-list.tpl products=$products}
           {include file=$tpl_dir./pagination.tpl}
       {elseif !isset($subcategories)}

{l s='There is no product in this category.'}
       {/if}
{elseif $category->id}

{l s='This category is currently unavailable.'}
{/if}

Link to comment
Share on other sites

Makes no difference. It should work. Make sure you are editing the right theme. If you have force_compile set to false, then you should temporarily change it to true, or clear out your Smarty cache in tools/smarty/compile (except index.php).

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...