Jump to content

Category Pages blank - How to add a list of subcats


Recommended Posts

Hi all,

 

Please have a look at the attached images.

 

When clicking on a high level Category/sub cat the main page is blank.

 

When you click on the lowest level category then this displays all the products that are within it.

 

How can I configure the category pages to show links of Sub Categories in the main screen so its not just a big white blank page?

 

I have gone into theme configurator and switched on and off the 'display sub cats' that didnt work

 

Can anyone help with this?

 

I was using 1.4.6 before and it worked fine on that Prestashop - upgraded to 1.6x two months ago and cant figure out how to have the list of sub categories appear on that white space

post-271645-0-27200400-1430927221_thumb.jpg

post-271645-0-67702300-1430927224_thumb.jpg

Link to comment
Share on other sites

In the Products configuration click on the Associations tab and add the main category as an Association, this way products in sub categories will show in main.

 

Thanks for your reply.

 

I dont really want the products to show in all those high level categories I want a list of the sub categories to appear which are clickable for the customer to take them through the category levels

Link to comment
Share on other sites

What version of Prestashop are you using as normally subcategories are listed in the main category as thumbnails by default.

Look at your category.tpl file located in   themes/default_bootstrap/    around line 71 and see if you see the start of the sub-category code there.

 

Are you using default theme.

 

 

will look like this:

 

<h1 class="page-heading{if (isset($subcategories) && !$products) || (isset($subcategories) && $products) || !isset($subcategories) && $products} product-listing{/if}"><span class="cat-name">{$category->name|escape:'html':'UTF-8'}{if isset($categoryNameComplement)} {$categoryNameComplement|escape:'html':'UTF-8'}{/if}</span>{include file="$tpl_dir./category-count.tpl"}</h1>
{if isset($subcategories)}
        {if (isset($display_subcategories) && $display_subcategories eq 1) || !isset($display_subcategories) }
<!-- Subcategories -->
<div id="subcategories">

 

Link to comment
Share on other sites

 

What version of Prestashop are you using as normally subcategories are listed in the main category as thumbnails by default.

Look at your category.tpl file located in   themes/default_bootstrap/    around line 71 and see if you see the start of the sub-category code there.

 

Are you using default theme.

 

 

will look like this:

 

<h1 class="page-heading{if (isset($subcategories) && !$products) || (isset($subcategories) && $products) || !isset($subcategories) && $products} product-listing{/if}"><span class="cat-name">{$category->name|escape:'html':'UTF-8'}{if isset($categoryNameComplement)} {$categoryNameComplement|escape:'html':'UTF-8'}{/if}</span>{include file="$tpl_dir./category-count.tpl"}</h1>
{if isset($subcategories)}
        {if (isset($display_subcategories) && $display_subcategories eq 1) || !isset($display_subcategories) }
<!-- Subcategories -->
<div id="subcategories">

 

 

Hi thanks for your reply.

 

I am using 1.6x and not using the default theme.

 

Does the above change your advice?

 

I used to have 1.4.3 before with a custom theme and the subcat thumbnails were on as default

Link to comment
Share on other sites

This is because your theme does not have the code for subcategories you can try to insert the code below into your category.tpl file and see if it works.

 

Insert after the closing {/if} statement and before the {if $products} statement.

 

<div class="rte">{$category->description}</div>
                            {/if}
                            </div>
                        {/if}
                     </div>
                  {/if}
            </div>
{/if}

 

<h1 class="page-heading{if (isset($subcategories) && !$products) || (isset($subcategories) && $products) || !isset($subcategories) && $products} product-listing{/if}"><span class="cat-name">{$category->name|escape:'html':'UTF-8'}{if isset($categoryNameComplement)} {$categoryNameComplement|escape:'html':'UTF-8'}{/if}</span>{include file="$tpl_dir./category-count.tpl"}</h1>
{if isset($subcategories)}
        {if (isset($display_subcategories) && $display_subcategories eq 1) || !isset($display_subcategories) }
<!-- Subcategories -->
<div id="subcategories">
<p class="subcategory-heading">{l s='Subcategories'}</p>
<ul class="clearfix">
{foreach from=$subcategories item=subcategory}
<li>
                <div class="subcategory-image">
<a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'html':'UTF-8'}" title="{$subcategory.name|escape:'html':'UTF-8'}" class="img">
{if $subcategory.id_image}
<img class="replace-2x" src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium_default')|escape:'html':'UTF-8'}" alt="" width="{$mediumSize.width}" height="{$mediumSize.height}" />
{else}
<img class="replace-2x" src="{$img_cat_dir}{$lang_iso}-default-medium_default.jpg" alt="" width="{$mediumSize.width}" height="{$mediumSize.height}" />
{/if}
</a>
                    </div>
<h5><a class="subcategory-name" href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'html':'UTF-8'}">{$subcategory.name|truncate:25:'...'|escape:'html':'UTF-8'}</a></h5>
{if $subcategory.description}
<div class="cat_desc">{$subcategory.description}</div>
{/if}
</li>
{/foreach}
</ul>
</div>
        {/if}
{/if}
 
 
{if $products}
Link to comment
Share on other sites

 

This is because your theme does not have the code for subcategories you can try to insert the code below into your category.tpl file and see if it works.

 

Insert after the closing {/if} statement and before the {if $products} statement.

 

<div class="rte">{$category->description}</div>
                            {/if}
                            </div>
                        {/if}
                     </div>
                  {/if}
            </div>
{/if}

 

<h1 class="page-heading{if (isset($subcategories) && !$products) || (isset($subcategories) && $products) || !isset($subcategories) && $products} product-listing{/if}"><span class="cat-name">{$category->name|escape:'html':'UTF-8'}{if isset($categoryNameComplement)} {$categoryNameComplement|escape:'html':'UTF-8'}{/if}</span>{include file="$tpl_dir./category-count.tpl"}</h1>
{if isset($subcategories)}
        {if (isset($display_subcategories) && $display_subcategories eq 1) || !isset($display_subcategories) }
<!-- Subcategories -->
<div id="subcategories">
<p class="subcategory-heading">{l s='Subcategories'}</p>
<ul class="clearfix">
{foreach from=$subcategories item=subcategory}
<li>
                <div class="subcategory-image">
<a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'html':'UTF-8'}" title="{$subcategory.name|escape:'html':'UTF-8'}" class="img">
{if $subcategory.id_image}
<img class="replace-2x" src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium_default')|escape:'html':'UTF-8'}" alt="" width="{$mediumSize.width}" height="{$mediumSize.height}" />
{else}
<img class="replace-2x" src="{$img_cat_dir}{$lang_iso}-default-medium_default.jpg" alt="" width="{$mediumSize.width}" height="{$mediumSize.height}" />
{/if}
</a>
                    </div>
<h5><a class="subcategory-name" href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'html':'UTF-8'}">{$subcategory.name|truncate:25:'...'|escape:'html':'UTF-8'}</a></h5>
{if $subcategory.description}
<div class="cat_desc">{$subcategory.description}</div>
{/if}
</li>
{/foreach}
</ul>
</div>
        {/if}
{/if}
 
 
{if $products}

 

 

 

Hi,

 

Where would that be?

 

Here is the file... I cant seem to find the exact same RTE part.....

 

 

 

*

* Do not edit or add to this file if you wish to upgrade PrestaShop to newer

* versions in the future. If you wish to customize PrestaShop for your

* needs please refer to http://www.prestashop.com for more information.

*

*  @author PrestaShop SA <[email protected]>

*  @copyright  2007-2014 PrestaShop SA

*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)

*  International Registered Trademark & Property of PrestaShop SA

*}

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

{if isset($category)}

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

        {if $scenes || $category->description || $category->id_image}

            <div class="content_scene_cat">

                 {if $scenes}

                     <div class="content_scene">

                        <!-- Scenes -->

                        {include file="$tpl_dir./scenes.tpl" scenes=$scenes}

                        {if $category->description}

                            <div class="cat_desc rte">

                            {if Tools::strlen($category->description) > 350}

                                <div id="category_description_short">{$description_short}</div>

                                <div id="category_description_full" class="unvisible">{$category->description}</div>

                                <a href="{$link->getCategoryLink($category->id_category, $category.link_rewrite)|escape:'html':'UTF-8'}" class="lnk_more">{l s='More'}</a>

                            {else}

                                <div>{$category->description}</div>

                            {/if}

                            </div>

                        {/if}

                        </div>

                    {else}

                    <!-- Category image -->

                    <div class="content_scene_cat_bg" {if $category->id_image}style="background:url({$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category_default')|escape:'html':'UTF-8'}) 0 top no-repeat; background-size:contain; min-height:{$categorySize.height}px;" {/if}>

                        

                     

                     </div>

                  {/if}

            </div>

        {/if}

        

        {if $products}

            <div class="content_sortPagiBar clearfix">

                <div class="sortPagiBar clearfix">

                    {include file="./product-sort.tpl"}

                    {include file="./product-compare.tpl"}

                </div>

                <div class="top-pagination-content clearfix">

                </div>

            </div>

            {include file="./product-list.tpl" products=$products}

            <div class="content_sortPagiBar">

                <div class="bottom-pagination-content row clearfix">

                    {include file="./nbr-product-page.tpl"}

                    <div class="col-md-6 col-sm-6 col-sms-6">

                        {include file="./pagination.tpl" paginationId='bottom'}

                    </div>

                </div>

            </div>

        {/if}

    {elseif $category->id}

        <p class="alert alert-warning">{l s='This category is currently unavailable.'}</p>

    {/if}

{/if}

Link to comment
Share on other sites

Hi,

 

Where would that be?

 

Here is the file... I cant seem to find the exact same RTE part.....

 

 

 

*

* Do not edit or add to this file if you wish to upgrade PrestaShop to newer

* versions in the future. If you wish to customize PrestaShop for your

* needs please refer to http://www.prestashop.com for more information.

*

*  @author PrestaShop SA <[email protected]>

*  @copyright  2007-2014 PrestaShop SA

*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)

*  International Registered Trademark & Property of PrestaShop SA

*}

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

{if isset($category)}

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

        {if $scenes || $category->description || $category->id_image}

            <div class="content_scene_cat">

                 {if $scenes}

                     <div class="content_scene">

                        <!-- Scenes -->

                        {include file="$tpl_dir./scenes.tpl" scenes=$scenes}

                        {if $category->description}

                            <div class="cat_desc rte">

                            {if Tools::strlen($category->description) > 350}

                                <div id="category_description_short">{$description_short}</div>

                                <div id="category_description_full" class="unvisible">{$category->description}</div>

                                <a href="{$link->getCategoryLink($category->id_category, $category.link_rewrite)|escape:'html':'UTF-8'}" class="lnk_more">{l s='More'}</a>

                            {else}

                                <div>{$category->description}</div>

                            {/if}

                            </div>

                        {/if}

                        </div>

                    {else}

                    <!-- Category image -->

                    <div class="content_scene_cat_bg" {if $category->id_image}style="background:url({$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category_default')|escape:'html':'UTF-8'}) 0 top no-repeat; background-size:contain; min-height:{$categorySize.height}px;" {/if}>

                        

                     

                     </div>

                  {/if}

            </div>

        {/if}

        (past code here)

        {if $products}

            <div class="content_sortPagiBar clearfix">

                <div class="sortPagiBar clearfix">

                    {include file="./product-sort.tpl"}

                    {include file="./product-compare.tpl"}

                </div>

                <div class="top-pagination-content clearfix">

                </div>

            </div>

            {include file="./product-list.tpl" products=$products}

            <div class="content_sortPagiBar">

                <div class="bottom-pagination-content row clearfix">

                    {include file="./nbr-product-page.tpl"}

                    <div class="col-md-6 col-sm-6 col-sms-6">

                        {include file="./pagination.tpl" paginationId='bottom'}

                    </div>

                </div>

            </div>

        {/if}

    {elseif $category->id}

        <p class="alert alert-warning">{l s='This category is currently unavailable.'}</p>

    {/if}

{/if}

Look at the code above and paste as I have shown let me know if it works for you.

Link to comment
Share on other sites

Hi

 

On PS1.6 go Backoffice->Modules.

 

Do you have a ThemeEditor module for this theme?

 

If so go to the Category Pages tab where you have the option to switch on/off display of subcategories.

 

Another thing to check is the Category Block module. Set the "Maximum Depth" to 0 to show all subcategories.

 

My tuppence worth.

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