Jump to content

[SOLVED] How to move the breadcrumb to it's own hook?


Recommended Posts

Hi,

I'm new here and started with this whole prestashop thing yesterday, so I still figuring out things.

I'm creating my own theme by modifing the existing one that comes with the prestashop pack. I'm changing everything, even the 3 column structure. I've created some more hooks to separate the modules as I please, but since the breadcrumb is not a module, how can I put it into a brand new hook?

Thanks in advance!!!

Link to comment
Share on other sites

In every template that uses breadcrumbs have the following:

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

If you want to conver it to Module, you'll need to remove the above code that manually includes the breadcrumbs to the templates. I wouldn't recommend doing this. Just search in which themplates is used breadcrumb.tpl and move the include where you want it to be.

Link to comment
Share on other sites

Ok, I've tried a bounch of things... I'm not really a programmer, just a designer who likes to play a little bit with code, so I get lost easyly.

If I remove the {include file=$tpl_dir./breadcrumb.tpl} from every page and place it at the header.tpl it always reads 'Home' even if u're not at home page, that I understand. What I'd like the breadcrumb to be is at the header of every page where it's suposed to be inserted. Right now, if I select a category, when page reloads breadcramb gets located inside the home hook where category contents are shown... Where should I insert {include file=$tpl_dir./breadcrumb.tpl} to always show up at the header of the page, instead of getting placed wherever the category contents go?

Thanks, and sorry if I'm bodering with too basic stuff...

Link to comment
Share on other sites

There one simple hack for this.

1. in breadcrumb.tpl add "id" to the div:


should be:




2. in header.tpl add:

SCRIPT{literal}

jQuery(document).ready(function() {
   if (jQuery("#old_bc").html()) {
       jQuery("#bc").html(""+jQuery("#old_bc").html()+"");
       jQuery("#old_bc").hide();
   }
});
{/literal}SCRIPT




Note that


is the place where you want the breadcrumbs to appear


"SCRIPT" shuld be the script tag:
http://www.w3schools.com/tags/tag_script.asp



  • Like 2
Link to comment
Share on other sites

  • 5 months later...

That would be a great solution for me but I have just tried and does not work. I inserted this

<script type="text/javascript">{literal}

jQuery(document).ready(function() {
   if (jQuery("#old_bc").html()) {
       jQuery("#bc").html(""+jQuery("#old_bc").html()+"");
       jQuery("#old_bc").hide();
   }
});
{/literal}</script>


before the </head> tag in header.tpl and added id="old_bc" in breadcrumb tpl.
I can not find my mistake, please help.

Link to comment
Share on other sites

  • 6 years later...

To those who can't display the breadcrumb with this method, you should check out the structure with inspect.

In the theme I was using I had a line that was hiding the breadcrumb so I had some "angry time" :)

I ended up including the breadcrumb.tpl file where I needed it, but it was a very nice "hack" and I learned from it.

 

Thanks Stan!

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