Jump to content
meserlian

Exclude a specific category from Categories Block

Recommended Posts

Hi, 

Trying to exclude a specific category (id 169) from the category block, but can't seem to figure it out. 

www.cyoffers.com

 

Share this post


Link to post
Share on other sites

My Bad, 

 

I would like to disable from the left navigation, but still be able to access it from the top navigation.

 

Thanks for the quick reply.

Share this post


Link to post
Share on other sites

hello

you can do it only with template modification file.

let me know what ps version you use and what module version you've got

i will prepare code for you

Share this post


Link to post
Share on other sites

great!

 

here is the code:

{if $node.id != 20}
<li {if isset($last) && $last == 'true'}class="last"{/if}>
	<a href="{$node.link|escape:'htmlall':'UTF-8'}" {if isset($currentCategoryId) && $node.id == $currentCategoryId}class="selected"{/if}
		title="{$node.desc|strip_tags|trim|escape:'htmlall':'UTF-8'}">{$node.name|escape:'htmlall':'UTF-8'}</a>
	{if $node.children|@count > 0}
		<ul>
		{foreach from=$node.children item=child name=categoryTreeBranch}
			{if $smarty.foreach.categoryTreeBranch.last}
				{include file="$branche_tpl_path" node=$child last='true'}
			{else}
				{include file="$branche_tpl_path" node=$child last='false'}
			{/if}
		{/foreach}
		</ul>
	{/if}
</li>
{/if}

code above {if $node.id != 20} means:

if category id is different than 20, then display link.

so the category with id will be hidden.

  • Like 2

Share this post


Link to post
Share on other sites

great!

 

here is the code:

{if $node.id != 20}
<li {if isset($last) && $last == 'true'}class="last"{/if}>
	<a href="{$node.link|escape:'htmlall':'UTF-8'}" {if isset($currentCategoryId) && $node.id == $currentCategoryId}class="selected"{/if}
		title="{$node.desc|strip_tags|trim|escape:'htmlall':'UTF-8'}">{$node.name|escape:'htmlall':'UTF-8'}</a>
	{if $node.children|@count > 0}
		<ul>
		{foreach from=$node.children item=child name=categoryTreeBranch}
			{if $smarty.foreach.categoryTreeBranch.last}
				{include file="$branche_tpl_path" node=$child last='true'}
			{else}
				{include file="$branche_tpl_path" node=$child last='false'}
			{/if}
		{/foreach}
		</ul>
	{/if}
</li>
{/if}

code above {if $node.id != 20} means:

if category id is different than 20, then display link.

so the category with id will be hidden.

 

What if we want to exclude more than one category?

Share this post


Link to post
Share on other sites

What if we want to exclude more than one category?

 

add additional conditions in if clause:

 

{if $node.id != 20 || $node.id !=21 || $node.id !=99 || $node.id=129} etc.

  • Like 1

Share this post


Link to post
Share on other sites

Hello,Thank you

 

{if $node.id != 11 }

{if $node.id != 11 AND $node.id != 13 AND $node.id != 14 AND $node.id != 15 }

 

Thank you

Edited by lm59 (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

Im59, try this format:

 

{if $node.id != 11 AND $node.id !=13 AND $node.id !=14 AND $node.id !=15}

Share this post


Link to post
Share on other sites

Hi, and thank you for your post

 

UP for 1.6

 

I would like authorised only one category from categories block

 

OR

 

I would like masked specific category  from categories block

 

any one ?

 

many thanks

 

regards

Share this post


Link to post
Share on other sites

Hi, and thank you for your post

 

UP for 1.6

 

I would like authorised only one category from categories block

 

OR

 

I would like masked specific category  from categories block

 

any one ?

 

many thanks

 

regards

I would like to know this as well... Trying to exclude two categories from the category block in 1.6.0.9.

 

P.S: Figured it out .

Edited by Loonary (see edit history)

Share this post


Link to post
Share on other sites

Hey i want to remove image from one category and display images for all other category..How can i do that?i brought the images to block category left.i want to remove the image from one category from there.

Share this post


Link to post
Share on other sites

Hey i want to remove image from one category and display images for all other category..How can i do that?i brought the images to block category left.i want to remove the image from one category from there.

 

what is your code at the moment? can you show it ?

+ for what category (id) you want to disable these images? by images you mean cateogry heading image?

Share this post


Link to post
Share on other sites

Hi Vekia

 

<li {if isset($last) && $last == 'true'}class="last"{/if}>
    <a
    href="{$node.link|escape:'html':'UTF-8'}"{if isset($currentCategoryId) && $node.id == $currentCategoryId} class="selected"{/if} title="{$node.desc|strip_tags|trim|escape:'html':'UTF-8'}"><img src="{$link->getCatImageLink($category->link_rewrite, $node.id)}"/>
    
        {$node.name|escape:'html':'UTF-8'}
    </a>
    {if $node.children|@count > 0}
        <ul>
            {foreach from=$node.children item=child name=categoryTreeBranch}
                {if $smarty.foreach.categoryTreeBranch.last}
                    {include file="$branche_tpl_path" node=$child last='true'}
                {else}
                    {include file="$branche_tpl_path" node=$child last='false'}
                {/if}
            {/foreach}
        </ul>
    {/if}
</li>

 

This is my category-tree-btanch.tpl and the underlined part is the code i added to bring the category image to the category block left. But currently 'categories with no image added' is displaying thumbnail with no image.i have attached that image with this. so i want to write a conditon so that if no image is added to the category only the category name should be shown and the thumbnail is not shown.

 

hope u understand the problem .Pls help me

Sorry im not able to upload that image an error msg is coming.I hope u got what i meant with the thumbnail with no image.

Share this post


Link to post
Share on other sites

this is block categories, there is no images by default

im lost a little.

you use some customization of this module?

Share this post


Link to post
Share on other sites

Can you help me please? 


- How to insert products from affiliate stores such as - amazon, ebay....?


- Did you know a module, where I can insert my ID from: amazon, ebay..... etc, and automatically insert products

Share this post


Link to post
Share on other sites

HI vekia..

I have attached a screen shot of my page with this.In that in category block there is no image added to category giftcard.but its displaying a thumbnail like that.I want to remove that. I want a general if condition so that if no image is added to category it shouldnot display a thumbnail like that.post-895020-0-15130200-1422597882_thumb.png

 

I am not using a customized version.the images added to a category from backoffice is displayed there in the category block.The code for that is in my yesterday's post. Pls help

Edited by neerajlm10 (see edit history)

Share this post


Link to post
Share on other sites

Hi everyone, my solution for Prestashop 1.6.x  si here:

 

1. I created 3 categories (with id 80, 81 and 82 as well)

 

2. I edited some lines in blockcategories.tpl file like this:

 

This:

<div class="block_content">
   <ul class="tree {if $isDhtml}dhtml{/if}">
      {foreach from=$blockCategTree.children item=child name=blockCategTree}
         {if $smarty.foreach.blockCategTree.last}
            {include file="$branche_tpl_path" node=$child last='true'}
         {else}
            {include file="$branche_tpl_path" node=$child}
         {/if}
      {/foreach}
   </ul>
</div> 

To this:

<div class="block_content">
   <ul class="tree {if $isDhtml}dhtml{/if}">
      {foreach from=$blockCategTree.children item=child name=blockCategTree}
         {if $child.id !=80}
            {if $child.id !=81}
               {if $child.id !=82}
                  {if $smarty.foreach.blockCategTree.last}
                     {include file="$branche_tpl_path" node=$child last='true'}
                  {else}
                     {include file="$branche_tpl_path" node=$child}
                  {/if}
               {/if}
            {/if}
         {/if}
      {/foreach}
   </ul>
</div> 

Shape {if $child.id !=80 || $child.id !=81 || $child.id !=82} didnt work for me, but you can try it ;)

 

This is not total cosher solution, but absolutly works ;) 

Share this post


Link to post
Share on other sites

Hi, it is not working for me in 1.6.0.14 :/

 

Is there another solution?

Share this post


Link to post
Share on other sites

I cant get this working in 1.6.0.14 either.

Is there another solution to try??

 

// Sara

Share this post


Link to post
Share on other sites

Sorry it is working for me in 1.6.0.14!

I made a typo, that is why is was not working :)

Share this post


Link to post
Share on other sites

Hi everyone, my solution for Prestashop 1.6.x  si here:

 

1. I created 3 categories (with id 80, 81 and 82 as well)

 

2. I edited some lines in blockcategories.tpl file like this:

 

This:

<div class="block_content">
   <ul class="tree {if $isDhtml}dhtml{/if}">
      {foreach from=$blockCategTree.children item=child name=blockCategTree}
         {if $smarty.foreach.blockCategTree.last}
            {include file="$branche_tpl_path" node=$child last='true'}
         {else}
            {include file="$branche_tpl_path" node=$child}
         {/if}
      {/foreach}
   </ul>
</div> 

To this:

<div class="block_content">
   <ul class="tree {if $isDhtml}dhtml{/if}">
      {foreach from=$blockCategTree.children item=child name=blockCategTree}
         {if $child.id !=80}
            {if $child.id !=81}
               {if $child.id !=82}
                  {if $smarty.foreach.blockCategTree.last}
                     {include file="$branche_tpl_path" node=$child last='true'}
                  {else}
                     {include file="$branche_tpl_path" node=$child}
                  {/if}
               {/if}
            {/if}
         {/if}
      {/foreach}
   </ul>
</div> 

Shape {if $child.id !=80 || $child.id !=81 || $child.id !=82} didnt work for me, but you can try it ;)

 

This is not total cosher solution, but absolutly works ;)

This solution works perfectly on PS 1.6.1.6

Thank you very much.

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More