Scholar

Modify breadcrumbs path to add shop page as parent?

Hi there.

 

I'm setting up my shop right now with the "Clean Lines" template. The product pages automatically have breadcrumbs, which is great, but they begin at the category level:

 

category > subcategory

 

I want them to begin at my "shop" page, which I built as a standard page.

 

shop > category > subcategory

 

In the HTML, the breadcrumbs are imported by some script that changes:

{{> commerce/product/breadcrumbs}}

into a <ul> element. I don't see this script anywhere, so I don't think I can modify it.

 

Essentially I just need to add one or two <li> elements at the front of this list to navigate back to my main shop. Is there any quickfix way to do this? Or any way to change the mysterious script?

 

Thanks!

 

 

8 REPLIES
Community Manager

Re: Modify breadcrumbs path to add shop page as parent?

You might be able to do that with some additional style. For example, you add some HTML code before it for what you need, then style it and the breadcrumb code so that it visually looks like it's all the same unordered list.

- Adam
Senior Community Specialist
Scholar

Re: Modify breadcrumbs path to add shop page as parent?

Oh ok that makes sense. Thanks Adam. I'll give it a shot!

Scholar

Re: Modify breadcrumbs path to add shop page as parent?

Ok– no luck taking this route. Jumping through some serious hoops I made a little progress, but the problem I keep running into is that another document is overriding my CSS, and this is across a variety of elements.

 

I go into main.less, _store.less, etc. and make the proper changes, but after publishing it's as though nothing changed. Using my browser's "inspect" element, I see that the CSS is coming from a document main-style.css, which is nowhere to be found in the site editor.

 

Am I mistaken in interpreting this to mean there is a document that supercedes all of the other style documents? And if so, why bother with the other ones at all? Is this an error in the theme coding?

Community Manager

Re: Modify breadcrumbs path to add shop page as parent?

Can you post a link a page of your site showing this, @rchlmade? I'll take a look.

- Adam
Senior Community Specialist
Scholar

Re: Modify breadcrumbs path to add shop page as parent?

Thank you - I've been trying to resolve the same issue.  I want to use my service offering page as parent in breadcrumbs instead of the default category link. I'm using the Birdseye theme and it doesn't include a breadcrumbs.tpl. If I provide my own breadcrumbs.tpl then can that override the default that is currently being used?

 

Thank you

Scholar

Re: Modify breadcrumbs path to add shop page as parent?

I decided to change templates. If I run into the same problem again I will update here!
Scholar

Re: Modify breadcrumbs path to add shop page as parent?

@rchlmade - how did changing templates solve the problem for you? No breadcrumbs or did your changes keep this time?

Thanks

Scholar

Re: Modify breadcrumbs path to add shop page as parent?

Something like this should do the trick:

 

1. Create a new partial under Partials/commerce/product. Name it my-breadcrumbs.tpl.

2. Add code (substitute href with your url):

 

<ul id="wsite-com-breadcrumbs" class="wsite-com-product-breadcrumbs">
    <li class="wsite-com-breadcrumb">
        <a href="/" class="wsite-com-link">
            <span class="wsite-com-link-text">
                Shop
            </span>
        </a>
    </li>
    <li class="wsite-com-breadcrumb">
        <span class="wsite-com-breadcrumb-arrow">&gt;</span>
    </li>
    {{> commerce/product/breadcrumbs}}
</ul>

 

3. In main.tpl change {{> commerce/product/breadcrumbs}} to {{> commerce/product/my-breadcrumbs}}