Post by Mosstyn » Tue Aug 01, 2017 7:15 am

Hi, Sorry if this is duplicate post, I've had a good search but could not find an answer. I'm looking to remove the link from the last breadcrumb on my information pages.

I.E. For my FAQ page, my breadcrumb would be "Home >> FAQ". I want to keep the 'FAQ' part but remove the link so it's just text.

I've edited my category and product TPL files to actually remove the last breadcrumb as I think this look neater, but for the pages with only two breadcrumbs, I think it looks odd to remove and just have "Home" so thought it better to remove the link if possible.

Thanks in advance.

New member

Posts

Joined
Tue Aug 01, 2017 7:02 am

Post by thekrotek » Tue Aug 01, 2017 7:29 am

Nope, it doesn't look odd with only 2 breadcrumb items. You can safely remove the link for last item on all pages.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by Mosstyn » Tue Aug 01, 2017 4:27 pm

But I wouldn't have two items if I removed the last breadcrumb on "Home >> FAQ". I would only have "Home", and I think that would look odd. I would, if possible like to keep the last breadcrumb, but just with no link.

New member

Posts

Joined
Tue Aug 01, 2017 7:02 am

Post by thekrotek » Tue Aug 01, 2017 4:47 pm

I didn't say anything about removing the last item. You shouldn't do this anywhere, not only when thre're only 2 items.

So yes, remove a link from last breadcramb and it will look great. Since you're familiar with TPL files, you'll do it easily. Not sure, what's your issue.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by Mosstyn » Tue Aug 01, 2017 7:25 pm

Sorry if I didn't make myself clear, despite my being able to remove the breadcrumbs that I didn't need, removing the hyperlinks seems to be more tricky. But.....it seems to have worked now. Just removing the <a href> elements in the TPL. I must not have refreshed the page properly. Thank you,

New member

Posts

Joined
Tue Aug 01, 2017 7:02 am

Post by Mosstyn » Wed Aug 02, 2017 6:02 am

.....although now none of the breadcrumbs have a hyperlink. So the question remains - how to remove the hyperlink from the last breadcrumb whilst keeping the others?

New member

Posts

Joined
Tue Aug 01, 2017 7:02 am

Post by thekrotek » Wed Aug 02, 2017 6:15 am

Add check for last array key:

Code: Select all

foreach ($breadcrumbs as $key => $breadcrumb) {
    if ($key == (count($breadcrumbs) - 1)) {
        // skip the <a> tag
    }
}

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by Mosstyn » Wed Aug 02, 2017 8:12 am

Thanks for your patience. Does that go in between the first <?PHP> call and the <li> tag in the TPL?

New member

Posts

Joined
Tue Aug 01, 2017 7:02 am

Post by thekrotek » Wed Aug 02, 2017 3:10 pm

Well... If you edited TPL before, you should've seen this foreach clause already. You just need to edit it a bit.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am

Who is online

Users browsing this forum: No registered users and 3 guests