Home > Software engineering >  Set Limit Title Product Opencart
Set Limit Title Product Opencart

Time:03-03

I try to limit the length of a title product name to 20 characters in the category page. I tried to change

'name' => $ result ['name'], to
'name' => substr ($ result ['name'], 0.20). '& hellip;',

in / controller / product / category.php as I found over internet, but it didn't work. I use Opnecart3 with Journal3 theme. Can someone help me? Thank you in advance.

CodePudding user response:

your substr function syntax is wrong

'name'=>substr($result['name'],0,20)

CodePudding user response:

To correctly substr in OC you should use this syntax.

'name' => utf8_substr(trim(strip_tags(html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8'))), 0, 20) . '...',
  • Related