Jump to content

Hide subcategories on category page


gstar

Recommended Posts

There's a switch in the default theme so yours may not have it as an option? I would look for a template called templates/catalog/_partials/subcategories.tpl (in the theme folder) and hope the theme at least follows the same convention as the classic theme....

Link to comment
Share on other sites

7 minutes ago, Paul C said:

There's a switch in the default theme so yours may not have it as an option? I would look for a template called templates/catalog/_partials/subcategories.tpl (in the theme folder) and hope the theme at least follows the same convention as the classic theme....

I am using the classic theme.

Link to comment
Share on other sites

4 minutes ago, gstar said:

I am using the classic theme.

Well it's in that file then.

{if !empty($subcategories)}
  {if (isset($display_subcategories) && $display_subcategories eq 1) || !isset($display_subcategories) }
    <div id="subcategories" class="card card-block">
      <h2 class="subcategory-heading">{l s='Subcategories' d='Shop.Theme.Category'}</h2>
    ...
  {/if}
{/if}

Not 100% sure where the variable display_subcategories is set and don't have the code to hand to check..... You could always just modify that second line to:

{if (isset($display_subcategories) && $display_subcategories eq 0) || !isset($display_subcategories) }

A bit of a hack but it would get it working until you solve the underlying problem....

Link to comment
Share on other sites

36 minutes ago, Paul C said:

Not 100% sure where the variable display_subcategories is set and don't have the code to hand to check..... You could always just modify that second line to:

 

Have set this to 0:

image.png.5acb120ece23f30f9261d82db756aad6.png

But subcategories are still showing...

Any other ideas?

Link to comment
Share on other sites

17 minutes ago, gstar said:

Have set this to 0:

image.png.5acb120ece23f30f9261d82db756aad6.png

But subcategories are still showing...

Any other ideas?

Not what I expected :D

Try:

  {if (isset($display_subcategories) && $display_subcategories eq 0) || isset($display_subcategories) }

Not sure why the variable wouldn't be set at all!

Link to comment
Share on other sites

  • 3 weeks later...

Template files (should use child theme if classic)

/themes/classic/templates/catalog/listing/product_list.tpl

comment away around row 38 (bold text)

  <!-- {block name='subcategory_list'}
      {if isset($subcategories) && $subcategories|@count > 0}
        {include file='catalog/_partials/subcategories.tpl' subcategories=$subcategories}
      {/if}
    {/block}-->

Hope this solves your problem

  • Like 3
  • Thanks 2
Link to comment
Share on other sites

  • 4 months later...
  • 9 months later...

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