Page 1 of 1

product name character limiting in category view

Posted: Thu Jan 12, 2012 11:47 pm
by Univest
Hi guys

Im wondering how to limit the name of the product to for example 20 charachters and show ... at the end of the name.

how do I recode this to do the above for example:

<div class="productname_custom"><?php echo $product['name']; ?></div >

Thank you in advance

Re: product name character limiting in category view

Posted: Fri Jan 13, 2012 12:43 am
by OpenCart Addons
Hey,

In catalog / controller / product / category.php
Find:

Code: Select all

'name'        => $result['name'],
Replace With:

Code: Select all

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

Cheers,
Joel.

Re: product name character limiting in category view

Posted: Fri Jan 13, 2012 1:49 am
by Univest
Thanks a lot Joel

Works like a charm! :-)

Cheers mate

Re: product name character limiting in category view

Posted: Mon Aug 27, 2018 8:37 pm
by tingwing
for the product's name of latest,featured,special,bestseller module
go to /public_html/catalog/controller/extension/module/latest.php,featured.php,special.php,bestseller.php
find
'name' => $result['name'],

and change to
//'name' => $result['name'],
'name' => substr($result['name'],0,50) . '&hellip;',