Hi,
I would like to transform the breadcumb of my website
My present breadcumb is : Products > Famille > Name Page Product It's the name of pages
I would like to have name of items : Products > Paillette > Name product
I don't find the solutions ! !
Hi,
I would like to transform the breadcumb of my website
My present breadcumb is : Products > Famille > Name Page Product It's the name of pages
I would like to have name of items : Products > Paillette > Name product
I don't find the solutions ! !
You can go to Templates in the backend, and copy and modify mod_breadcrumb.tpl to your liking.
Magnificent beard by the way....
yes but I don't know the name of the variables or items..
how do I do? {{name_catalog::name_field}} ?
and the links ! how to build links ?
I'm lostops:
Sorry Tom, I don't know as I've never used Catalogue.![]()
it's pity ! !
nobody has a solution to change the breadcrumb in catalog reader ?
Hi Tom,
I've had to something similar before. Here's an example:
http://www.ralphsuttondesigns.com/3d-ar ... as-wreath/
I had to replace the category name and the product name in the breadcrumbs.
It's not that easy to explain (or reproduce the code) because there was some other unrelated things going as well in my code. The gist of what I did was...
1. Use the "parseFrontendTemplate" hook to intercept the "mod_breadcrumb" template.
2. Get the current page ID via $GLOBALS['objPage']->id to check that the current page needs to have its breadcrumb modified.
3. Get the current catalog item alias via $this->Input->get('items') and then query my catalog table to get the item title, E.g.4. Use str_replace() to replace the page title with the catalog item title in the breadcrumb template. E.g.Code:"$row = $this->Database->preprare("SELECT title FROM " . my_catalog_table . " WHERE alias=?")->limit(1)->execute($this->Input->get('items'))->row();
I know I've glossed over a lot of the details, but hopefully this will at least point you in the right direction. Getting the item's category is a bit trickier, but follows the same principal.Code:$strContent = str_replace($GLOBALS['objPage']->pageName, $row['title'], $strContent);
Brian
hi, thank you for your help
it's not easy for me because my english is not good ! lol
I saw it at first looks complicated!
1) I need to work in mod_breadcrumb.html5 or ModuleBreadcrumb.php ?
2) Are you sure to syntax :Because I have errorCode:$this->Database->preprare(Code:Fatal error: Call to a member function preprare() on a non-object
$this->Database->prepare
thank'
I have always a error !
errorCode:<?php echo $row = $this->Database->prepare("SELECT ref FROM ".cat_ferroviaire." WHERE alias=?")->limit(1)->execute($this->Input->get('items'))->row(); ?>Code:Fatal error: Call to a member function prepare() on a non-object in...
no idea sorry
Where are you putting this code?
For $this->Database to work you need to use it within a class that extends one of the Contao core classes or import the database class first by using $this->import('Database'). You're getting this error because $this->Database isn't an object.Code:<?php echo $row = $this->Database->prepare("SELECT ref FROM ".cat_ferroviaire." WHERE alias=?")->limit(1)->execute($this->Input->get('items'))->row(); ?>
If you are trying to use the code in a template then this is what is causing the error.
You might be able to fix it by adding $this->import('Database'); before your code. I don't know if this works within a template or not.
Hope that helps!
no error message for the moment
how to display the result of request ?
ok it's true...
I have a last question :Code:<span class="active"> <?php $this->Input->get('items'); $this->import('Database'); $objDB = $this->Database->prepare("SELECT ref FROM ".cat_ferroviaire_fr." WHERE alias=?")->limit(1)->execute($this->Input->get('items')); echo $objDB->ref; ?> </span>
How to display the correct breadcumbs depending on the class of modules ?
I do 2 breadcumbs : 1 for the website and 1 to the catalog reader page's
I'd like to add a condition based on the class..
is it possible ? Because it's always false in my pageCode:if($this->cssID=='product'){...} else{}
I found to change the breadcumbs only in page of catalog reader :
My mod_breadcrumb.html5 :Code:<?php global $objPage; ?> <?php if($objPage->cssClass == 'products'): ?> ... <?php else: ?> ... <?php endif; ?>
Thank you everyone for your help !Code:<?php global $objPage; ?> <?php if($objPage->cssClass == 'products'): ?> <div class="<?php echo $this->class; ?> block"<?php echo $this->cssID; ?><?php if ($this->style): ?> style="<?php echo $this->style; ?>"<?php endif; ?>> <?php if ($this->headline): ?> <<?php echo $this->hl; ?>><?php echo $this->headline; ?></<?php echo $this->hl; ?>> <?php endif; ?> <?php foreach ($this->items as $item): ?> <?php if ($item['isActive']): ?> <span class="active"> <?php $this->Input->get('items'); $this->import('Database'); $objDB = $this->Database->prepare("SELECT ref_product FROM ".cat_my_catalog." WHERE alias=?")->limit(1)->execute($this->Input->get('items')); echo $objDB->ref_product; ?> </span> <?php else: ?> "><?php echo $item['link']; ?> > <?php endif; ?> <?php endforeach; ?> </div> <?php else: ?> <div class="<?php echo $this->class; ?> block"<?php echo $this->cssID; ?><?php if ($this->style): ?> style="<?php echo $this->style; ?>"<?php endif; ?>> <?php if ($this->headline): ?> <<?php echo $this->hl; ?>><?php echo $this->headline; ?></<?php echo $this->hl; ?>> <?php endif; ?> <?php foreach ($this->items as $item): ?> <?php if ($item['isActive']): ?> <?php echo $this->cssID; ?> <span class="active"><?php echo $item['link']; ?></span> <?php else: ?> "><?php echo $item['link']; ?> > <?php endif; ?> <?php endforeach; ?> </div> <?php endif; ?>![]()
Yeah -- sorry for throwing you off track a bit. I wrote that in a rush and forgot that you either need to import 'Database', or extend a Contao class if were you doing it the hooks way. I do that a lot -- need to slow down, because I'm not really all that helpful.
But glad you found the solution.
Meanwhile, I did some digging and there actually is a "generateBreadcrumb" hook too that is undocumented. Looks like it passes an array of the items as well as the Breadcrumb object, and wants an array of items returned.
Very cool for future reference. I have a project now that I think I'll try that out on...
Brian
Bookmarks