Products description sometimes get too long and create issue with layout. We can reduce and limit the character length.

This script helps you to display limited characters from product short description.

$sdesc = $_product->getShortDescription();<br ?--> $sdesc = trim($sdesc);
$limit = 40;
if (strlen($sdesc) > $limit) {
$sdesc = substr($sdesc, 0, strrpos(substr($sdesc, 0, $limit), ' '));
}
echo $sdesc."...";

Leave a Reply

Or

Your email address will not be published. Required fields are marked *


CAPTCHA Image
Reload Image

Find us on Facebook

Subscribe to our Newsletter