Breadcrumb on product page

Alle sonstigen Fragen und Antworten (z. B. zu Modulen oder der allgemeinen technischen Realisierung)

Breadcrumb on product page

Beitragvon vmulot » 2. Mär 2015, 14:32

Hi :)
i don't know if it's really the right forum, but let's go :)
i got a product : "product xx"
we have a "tree" like that :

- root
--category_1
---sub_category
----sub_category yy

my product is in all of them but the default one is the sub_category yy

when i'm on its page, the breadrumb is :
category_1 (link) > sub_category (link)> product xx - sub_category yy (span)
i'd like to have :

category_1 (link) > sub_category (link)> sub_category yy (link) > product xx (span)

is there a way to acheive this ? is it Merconis "pb" or only Contao ?

thanks :)
vmulot
 
Beiträge: 46
Registriert: 5. Nov 2014, 15:26

Re: Breadcrumb on product page

Beitragvon supportteam » 2. Mär 2015, 18:55

I tried to reproduce this but my breadcrumb navigation doesn't look like the one you're describing. Which template are you using? Can you post the template code?
Ihr MERCONIS-Supportteam
Your MERCONIS Support Team
Benutzeravatar
supportteam
 
Beiträge: 245
Registriert: 28. Aug 2013, 16:58

Re: Breadcrumb on product page

Beitragvon vmulot » 2. Mär 2015, 21:55

can you be more specific ? :)
for breadcrumb i'm using the standard mod_breadcrumb template
vmulot
 
Beiträge: 46
Registriert: 5. Nov 2014, 15:26

Re: Breadcrumb on product page

Beitragvon supportteam » 3. Mär 2015, 08:58

In my test (latest Merconis version and latest Contao version) I added a breadcrumb navigation using the standard template "mod_breadcrumb". This should be very close to your setup. But in my case the resulting breadcrumb markup looks as follows:

Code: Alles auswählen
<div class="mod_breadcrumb block">
   <ul>
      <li class="first">
         <a title="MERCONIS Shopsystem" href="index.php/kategorie01.html">MERCONIS - Root page (foreign language) Deutsch</a>
      </li>
      <li>
         <a title="KATEGORIE01" href="index.php/kategorie01.html">KATEGORIE01</a>
      </li>
      <li>
         <a title="U-KATEGORIE01-01" href="index.php/u-kategorie01-01.html">U-KATEGORIE01-01</a>
      </li>
      <li class="active last">U-KATEGORIE01-01-01</li>
   </ul>
</div>


That's why I assumed that you probably use another template, maybe a modified one. If you don't, can you think of anything else that might be different when comparing your setup with mine? Maybe you use another contao version and maybe its mod_breadcrumb template is a little different. Could you please post the template code? Mine looks like this:

Code: Alles auswählen
<?php $this->extend('block_unsearchable'); ?>
<?php $this->block('content'); ?>

  <ul>
    <?php foreach ($this->items as $item): ?>
      <?php if ($item['isActive']): ?>
        <li class="active<?php if ($item['class']): ?> <?php echo $item['class']; ?><?php endif; ?> last"><?php echo $item['title']; ?></li>
      <?php else: ?>
        <li<?php if ($item['class']): ?> class="<?php echo $item['class']; ?>"<?php endif; ?>><a href="<?php echo $item['href']; ?>" title="<?php echo $item['title']; ?>"><?php echo $item['link']; ?></a></li>
      <?php endif; ?>
    <?php endforeach; ?>
  </ul>

<?php $this->endblock(); ?>
Ihr MERCONIS-Supportteam
Your MERCONIS Support Team
Benutzeravatar
supportteam
 
Beiträge: 245
Registriert: 28. Aug 2013, 16:58

Re: Breadcrumb on product page

Beitragvon vmulot » 3. Mär 2015, 10:14

i'm using :
Contao 3.4.4
Merconis 2.1.2 stable

I'm not overwriting the breadcrumb template, but here is the template code :
Code: Alles auswählen
<?php $this->extend('block_unsearchable'); ?>

<?php $this->block('content'); ?>

  <ul>
    <?php foreach ($this->items as $item): ?>
      <?php if ($item['isActive']): ?>
        <li class="active<?php if ($item['class']): ?> <?php echo $item['class']; ?><?php endif; ?> last"><?php echo $item['title']; ?></li>
      <?php else: ?>
        <li<?php if ($item['class']): ?> class="<?php echo $item['class']; ?>"<?php endif; ?>><a href="<?php echo $item['href']; ?>" title="<?php echo $item['title']; ?>"><?php echo $item['link']; ?></a></li>
      <?php endif; ?>
    <?php endforeach; ?>
  </ul>

<?php $this->endblock(); ?>
vmulot
 
Beiträge: 46
Registriert: 5. Nov 2014, 15:26

Re: Breadcrumb on product page

Beitragvon vmulot » 3. Mär 2015, 10:17

The html generated is :
Code: Alles auswählen
<div class="mod_breadcrumb breadcrumbs block">
  <ul>
                  <li class="first"><a href="index.php/accueil.html" title="NEUT">NEUT</a></li>
                        <li><a href="index.php/nos-produits.html" title="Nos produits">Nos produits</a></li>
                        <li><a href="index.php/autour-du-pied.html" title="Autour du pied">Autour du pied</a></li>
                        <li><a href="index.php/chaussures-therapeutiques-c-h-u-p-c-h-u-t.html" title="Chaussures thérapeutiques C.H.U.P / C.H.U.T">Chaussures thérapeutiques C.H.U.P / C.H.U.T</a></li>
                        <li class="active last">ACTIVITY ®Podartis - A volume variable (C.H.U.T.)</li>
            </ul>


</div>


i think it should be

Code: Alles auswählen
<div class="mod_breadcrumb breadcrumbs block">
  <ul>
                  <li class="first"><a href="index.php/accueil.html" title="NEUT">NEUT</a></li>
                        <li><a href="index.php/nos-produits.html" title="Nos produits">Nos produits</a></li>
                        <li><a href="index.php/autour-du-pied.html" title="Autour du pied">Autour du pied</a></li>
                        <li><a href="index.php/chaussures-therapeutiques-c-h-u-p-c-h-u-t.html" title="Chaussures thérapeutiques C.H.U.P / C.H.U.T">Chaussures thérapeutiques C.H.U.P / C.H.U.T</a></li>
<li><a href="index.php/a-volume-variable-c.h.u.t" title="....">A volume variable (C.H.U.T.)</a></li>
                        <li class="active last">ACTIVITY ®Podartis</li>
            </ul>
</div>

Or something very similar to that, the last item should be the product name
vmulot
 
Beiträge: 46
Registriert: 5. Nov 2014, 15:26

Re: Breadcrumb on product page

Beitragvon supportteam » 3. Mär 2015, 11:45

Okay, now I know what's happening.

The Merconis frontend module "product singleview" adds the name of the currently displayed product to the page title. The result is a page title that looks like "product name - original page title". The breadcrumb uses the page title and not the page name, so by adding the product name to the page title we also add it to the breadcrumb item.

If the breadcrumb navigation is positioned above the product singleview module in the layout, the breadcrumb uses the original page title because the product singleview module hasn't altered it yet. That's why we couldn't reproduce the behaviour at first. But if it is below, it uses the page title that already is prefixed with the product name.

So, basically, there are two things that you could do:

#1 Change the order of the breadcrumb module and the product singleview module in your layout (if that's possible in your case)
#2 Create your custom breadcrumb template that uses a regular expression to strip the product name from the breadcrumb item's name (the page title)

With option #1 you don't have the product name in your breadcrumb at all. With option #2 you could use the separated product name and page title to build the output exactly like you want it.
Ihr MERCONIS-Supportteam
Your MERCONIS Support Team
Benutzeravatar
supportteam
 
Beiträge: 245
Registriert: 28. Aug 2013, 16:58

Re: Breadcrumb on product page

Beitragvon vmulot » 3. Mär 2015, 11:52

Ho, ok i see.

i find it quite strange, i mean breadcrumb is quite often (maybe always) at top of page, will Merconis fix something for that ?
i can't do the #1, i'm gonna try the second one even if t's not the best solution :)
vmulot
 
Beiträge: 46
Registriert: 5. Nov 2014, 15:26

Re: Breadcrumb on product page

Beitragvon vmulot » 3. Mär 2015, 16:30

Hm i did a test like you said,

i put the breadcrumb module after the product viewer, but nothing changed.
i updated merconis to have latest vesrion but still the same :/
the last item is formated like that : product Name - last category name
vmulot
 
Beiträge: 46
Registriert: 5. Nov 2014, 15:26

Re: Breadcrumb on product page

Beitragvon supportteam2 » 4. Mär 2015, 19:07

Seems like there's a little misunderstanding. Of course in most cases the breadcrumb is positioned on top of the page. And that's the point: the problem should not occur if the breadcrumb module comes first/on top. The problem should only exist if the product singleview module gets rendered first and the breadcrumb module gets rendered after that, using the page title that has already been altered by the product singleview module.

Because you experience the problem, I assumed that in your case the breadcrumb module was positioned somewhere below the product singleview module in your layout. If I understand you correctly, it was always positioned above, which would be correct and in this case I can't reproduce the behaviour...

Okay, let's dig a little deeper. Is your breadcrumb navigation included in the layout or as a content element in an article? If it's in the layout, could you provide a screenshot showing which modules you have included in the layout and in which order they are?

Here's an example where I added two breadcrumbs to the layout and the first one doesn't show the product name but the second does:

breadcrumb_layout_order.png
breadcrumb_layout_order.png (91.66 KiB) 25087-mal betrachtet
Ihr MERCONIS-Supportteam
Your MERCONIS Support Team
Benutzeravatar
supportteam2
 
Beiträge: 408
Registriert: 4. Mär 2015, 14:05

Nächste

Zurück zu Sonstiges / Misc.

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 0 Gäste