Jump to content

Help with the catergories panel


byt
 Share

Recommended Posts

Hi,
I would like to setup the catergories bar with sub headings:

For example

Catergory <- not clickable but with a backdrop like the presta demoshop 'all new products' button
product <- clickable
product < - clickable
Catergory <-- not clickable but with backdrop like the presta demoshop 'all new products' button
product
product
product
Catergory

Im sure you get the idea, how can I do this? what files do I need to edit?

Thanks guys, hope someone will be kind enough to help!

Share this post


Link to post
Share on other sites

  • 7 months later...

Hey all, sorry to bump this up but I am wondering the same thing, and more importantly how do I change around the listing in the categories block? When I add a new category it lists everything alphabetically, how do I change the order of how they appear?

THANKS!!

Share this post


Link to post
Share on other sites

You can change the order of categories by prefixing them with a number then a period. For example, "01.First Category", "02.Second Category", etc.

To display the first level of categories with headings instead of links, change lines 9-13 of modules/blockcategories/blockcategories.tpl from:

{if $smarty.foreach.blockCategTree.last}
           {include file=$branche_tpl_path node=$child last='true'}
{else}
           {include file=$branche_tpl_path node=$child}
{/if}



to:

{if $smarty.foreach.blockCategTree.last}
           {include file=$branche_tpl_path node=$child depth=1 last='true'}
{else}
           {include file=$branche_tpl_path node=$child depth=1}
{/if}



and in modules/blockcategories/category-tree-branch.tpl, change line 2 from:

{$node.name|escape:html:'UTF-8'}



to:

{if $depth > 1}{else}
{/if}{$node.name|escape:html:'UTF-8'}{if $depth > 1}{else}{/if}



and lines 6-10 from:

{if $smarty.foreach.categoryTreeBranch.last}
           {include file=$tpl_dir./category-tree-branch.tpl node=$child last='true'}
{else}
           {include file=$tpl_dir./category-tree-branch.tpl node=$child last='false'}
{/if}



to:

{if $smarty.foreach.categoryTreeBranch.last}
           {include file=$tpl_dir./category-tree-branch.tpl node=$child depth=$depth+1 last='true'}
{else}
           {include file=$tpl_dir./category-tree-branch.tpl node=$child depth=$depth+1 last='false'}
{/if}



This will make the first-level categories paragraphs instead of links. You can add code like the following to your global.css to style the headings:

div#categories_block_left ul.tree p { background-color: light-blue }

Share this post


Link to post
Share on other sites

Change the following code on lines 586-590 of classes/Tools.php from:

if ($category->id == 1)
   return ''.$path.'';



to:

if ($category->id == 1)
{
   $path = substr($path, strpos($path, '') + 41 + sizeof(Configuration::get('PS_NAVIGATION_PIPE')));
   return ''.$path.'';
}



and line 619 from:

return self::getPath($id_category, Category::hideCategoryPosition($category->name), true).''.$pipe.' '.htmlentities($end, ENT_NOQUOTES, 'UTF-8').'';



to:

return ($category->id_parent == 1 ? '' : self::getPath($id_category, Category::hideCategoryPosition($category->name), true).''.$pipe.' ').''.htmlentities($end, ENT_NOQUOTES, 'UTF-8').'';

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

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