Jump to content
B. Szakacs

Breadcrumb declaration in Prestashop 1.6

Recommended Posts

Hi

 

I am trying to edit a module to be compatible with Prestashop 1.6. I managed to do some things right, but i cannot figure out the breadcrumb format and how is the current location URL is passed to the breadcrumb.

In 1.4 and 1.5 you had the following format in each TPL file: {capture path} than include the breadcrumb.tpl:

{capture name=path}<a href="mymodulelink.php">{l s='My Module Name'}</a>{/capture}
 {include file="$tpl_dir./breadcrumb.tpl"}

However, this creates a duplicate breadcrumb to display on page in Prestashop 1.6. If i remove the breadcrumb include from my TPL, the path does not show anymore, only the home icon. So it means that the capture declaration alone is not enough.

 

 

Any suggestions about where is this declared or how can the info be properly passed?

I tried to look in other modules but no luck.

 

 

Thanks!

Edited by B. Szakacs (see edit history)

Share this post


Link to post
Share on other sites

Instead of endlessly upping your question you would do better to make your question clearer. I can't understand what you mean and that very likely applies to many other people. You could make things clearer by adding some pictures.

  • Like 1

Share this post


Link to post
Share on other sites

I too have difficulties to understand your post. Not sure what you are asking about but the breadcrumb is included in header.tpl

	{if $page_name !='index' && $page_name !='pagenotfound'}
						{include file="$tpl_dir./breadcrumb.tpl"}
					{/if}

Share this post


Link to post
Share on other sites

Which module are you talking about? The breadcrumb is included on all pages except index through header.tpl (not any module).

 

If a module is including another breadcrumb.tpl breadcrumb would be included twice.

Share this post


Link to post
Share on other sites

It is a custom module built by me i am trying to edit fix and adapt. But i am not a coder, just learning the basics steps by step.

 

As i wrote, i am aware that if i include the breadcrumb in my module's TPL than it will show twice as header already has it. But i can have my capture path declaration only in my module's tpl, so it cannot be before the default breadcrumb loads, and this is where the problem is. If i do it as in my first post with capture than breadcrumb, than is OK, exepting the duplication from the header.

 

For example the wishlist module from 1.605, has in it's TPL the following

    {capture name=path}
        <a href="{$link->getPageLink('my-account', true)|escape:'html'}">{l s='My account' mod='blockwishlist'}</a>
        <span class="navigation-pipe">{$navigationPipe}</span>
        <a href="{$link->getModuleLink('blockwishlist', 'mywishlist')|escape:'html'}">{l s='My wishlists' mod='blockwishlist'}</a>
		{if isset($current_wishlist)}
	        <span class="navigation-pipe">{$navigationPipe}</span>
	        {$current_wishlist.name}
		{/if}
    {/capture}

So actually no breadcrumb include, but somehow the default  breadcrumb from header.tpl takes this capture into consideration and shows the correct path.

If i do the same in my module, no path is shown, only the house icon.

 

So how does mywishlist.tpl, which is loaded after the header, tells to Prestashop to use the path declared inside in it to display the breadcrumb?

Share this post


Link to post
Share on other sites

Hey man I had the same question. Not sure why others can't understand you want to know how to set the breadcrumb from your module, but here is an example from the blockcart module:

{capture name=path}{l s='Your shopping cart'}{/capture}

https://github.com/stnkris/PrestashopBundle/blob/5d8e1b4f55c2c93d8707ab08928758f1c8162d73/themes/default-bootstrap/order-opc.tpl#L33

 

It's worth noting that you won't find that by searching their repo on Github, because the blockcart module and all other modules have empty directories versioned and the sub-module search does not work. Otherwise if you search for text you see in the breadcrumb bar you will find the examples. I searched for "Your shopping cart" to find it.

Edited by krisives (see edit history)
  • Like 2

Share this post


Link to post
Share on other sites

Hi there,

I know it's an old question, but I found out the solution for this problem for PS 1.5 and 1.6 (and maybe previous versions but I didn't test it):

{capture name=path}{l s='Your title' mod='yournodulename'}{/capture}
{if version_compare($smarty.const._PS_VERSION_,'1.6.0.0','<')}{include file="$tpl_dir./breadcrumb.tpl"}{/if}

I hope this helps some people with the same problem in the future :)

 

Side note: Just avoid calling any smarty variable $img_dir in your module's templates, or the little "home" icon on the breadcrumb won't appear (It's a Presta's Smarty variable). I did that and was driving me crazy.

Share this post


Link to post
Share on other sites

×

Important Information

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