cancel
Showing results for 
Search instead for 
Did you mean: 

Limit of Product Name in Product Catalog Magento 2.3

SOLVED

Re: Limit of Product Name in Product Catalog Magento 2.3

Hello @eCom_Microware 

 

if works then mark as a solution.


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Limit of Product Name in Product Catalog Magento 2.3

And. for add utf8_enconde for special characters ??

How?

Re: Limit of Product Name in Product Catalog Magento 2.3

Solved this error

Unable to serialize value. Error: Malformed UTF-8 characters, possibly incorrectly encoded

 

<?php /* @escapeNotVerified */ $name = $_helper->productAttribute($_product, $_product->getName(), 'name'); ?>
<?php echo $name = strlen($name ) > 75 ? mb_substr($name ,0,75,'UTF-8')."..." : $name ;?>

Re: Limit of Product Name in Product Catalog Magento 2.3

I have added this code but the product name is still only one 1 line.

I have run setup:di:compile, cache:clean, cache:flush, static-content:deploy, indexer:reindex and nothing changes.

Also, is it possible to have it go onto more than 2 lines?

 

EDIT: Nevermind, i realised this doesnt do the 2 line break, i fixed it by using:

<?php echo $name = wordwrap($name, 20, "<br />\n",false);?>

Re: Limit of Product Name in Product Catalog Magento 2.3

Hi all,

 

I'm trying to do this on Magento 2.3.5 but when inserting the code, it is throwing a zend exception error, any idea why?

Re: Limit of Product Name in Product Catalog Magento 2.3

I tried this one but in 2.4.5 it didn't produced any result. Any advice?