Post by aerogel » Wed Aug 21, 2019 9:48 pm

hi
im using OC 3.0.2.0. most of my products has a very long name and i need to have the last piece of breadcrumbs in "product page" to be cut off.
any suggestion plz.
thanks.
Last edited by aerogel on Thu Aug 22, 2019 1:05 am, edited 1 time in total.

New member

Posts

Joined
Thu Jan 04, 2018 8:14 pm

Post by thekrotek » Wed Aug 21, 2019 11:19 pm

You can add mb_substr() function to every controller, which uses breadcrumbs, and cut the breadcrumbs text by given value.

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 aerogel » Thu Aug 22, 2019 12:41 am

i found something working here for OC 2
viewtopic.php?t=175516

this is the block of code in my product.twig that generates the breadcrumb

Code: Select all

  <ul class="breadcrumb">
    {% for breadcrumb in breadcrumbs %}
    <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
    {% 
    endfor %}
  </ul>
they managed some how to edit the OC2's code to cut off the product name. im looking for smth like that. (above link)

New member

Posts

Joined
Thu Jan 04, 2018 8:14 pm

Post by thekrotek » Thu Aug 22, 2019 12:53 am

You cut it in CONTROLLER, not in template.

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 aerogel » Thu Aug 22, 2019 12:56 am

thekrotek wrote:
Thu Aug 22, 2019 12:53 am
You cut it in CONTROLLER, not in template.
i dont know how!

New member

Posts

Joined
Thu Jan 04, 2018 8:14 pm

Post by thekrotek » Thu Aug 22, 2019 1:02 am

sedra wrote:
Thu Aug 22, 2019 12:56 am
i dont know how!
If you don't have enough coding skills, you can always request a commercial support.

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 xxvirusxx » Thu Aug 22, 2019 1:36 am

You can remove this from catalog/controller/product/product.php (line 212)

Code: Select all

$data['breadcrumbs'][] = array(
	'text' => $product_info['name'],
	'href' => $this->url->link('product/product', $url . '&product_id=' . $this->request->get['product_id'])
);
or from product.twig this code, to remove entire breadcrumb

Code: Select all

  <ul class="breadcrumb">
    {% for breadcrumb in breadcrumbs %}
    <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
    {% endfor %}
  </ul>

Choose how you like.

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by paulfeakins » Thu Aug 22, 2019 6:32 pm

Or a pure CSS solution:

Code: Select all

.breadcrumb li a {
    line-height: 1em;
    max-width: 61px;
    overflow: hidden;
    display: inline-block;
}
Image

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by thekrotek » Thu Aug 22, 2019 9:17 pm

paulfeakins wrote:
Thu Aug 22, 2019 6:32 pm
Or a pure CSS solution:

Code: Select all

.breadcrumb li a {
    line-height: 1em;
    max-width: 61px;
    overflow: hidden;
    display: inline-block;
}
Image
With this you won't be able to add nice three dot ellipsis in the end :-)

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 aerogel » Fri Aug 23, 2019 5:19 pm

thank you all for your "non commercial" support!
here i admit that i used to be a software developer for sometime and i know how it feels to make a living with 10 hours and more F5-ing and debugging line by line in front of a monitor and of course i appreciate their work.
but
there are many thing beside making money that matters.
(this is my campaign slogan when I'm running for the office!)
so excited to test your suggestions one by one.

New member

Posts

Joined
Thu Jan 04, 2018 8:14 pm

Post by aerogel » Fri Aug 23, 2019 5:39 pm

xxvirusxx wrote:
Thu Aug 22, 2019 1:36 am
You can remove this from catalog/controller/product/product.php (line 212)

Code: Select all

$data['breadcrumbs'][] = array(
	'text' => $product_info['name'],
	'href' => $this->url->link('product/product', $url . '&product_id=' . $this->request->get['product_id'])
);
from now on
i have a different mindset about a "VIRUS".
thanks a lot.

New member

Posts

Joined
Thu Jan 04, 2018 8:14 pm

Post by cyclops12 » Fri Aug 23, 2019 9:20 pm

sedra wrote:
Fri Aug 23, 2019 5:39 pm
from now on
i have a different mindset about a "VIRUS".
thanks a lot.
😂😂😂😂

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by letxobnav » Fri Aug 23, 2019 10:02 pm

Code: Select all

$data['breadcrumbs'][] = array(
	'text' => mb_substr($product_info['name'], 0, strrpos(mb_substr($product_info['name'], 0, 60), ' ' )).'...',
	'href' => $this->url->link('product/product', $url . '&product_id=' . $this->request->get['product_id'])
);
this will break off the name after 60 characters and then cut it on the last space so it does not cut it inside a word.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by nightwing » Sat Apr 11, 2020 2:51 pm

You can use this free module to remove breadcrumb completely from all mobile devices:
viewtopic.php?f=183&t=217081
OCMod Installation

Regards,
Nightwing
Access to my Free Extensions: https://www.opencart.com/index.php?rout ... =nightwing


Active Member

Posts

Joined
Tue Nov 05, 2019 11:08 pm


Post by letxobnav » Sat Apr 11, 2020 4:16 pm

you thought "let's bring back a vital topic from 8 months ago".

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by nightwing » Sat Apr 11, 2020 9:20 pm

Well, I was having this problem, so I was reading through, instead of creating a new post, I just commented to help any version, 3 users, with an easy solution.
letxobnav wrote:
Sat Apr 11, 2020 4:16 pm
you thought "let's bring back a vital topic from 8 months ago".

Regards,
Nightwing
Access to my Free Extensions: https://www.opencart.com/index.php?rout ... =nightwing


Active Member

Posts

Joined
Tue Nov 05, 2019 11:08 pm

Who is online

Users browsing this forum: Baidu [Spider] and 407 guests