Magento by default showing more word in the Short Description ,But some time we want to reduce the length of Short description
We can use this code wherever we required the Short Description should come with limit words
This script helps you limit characters form Product Short Description.
We can use this code wherever we required the Short Description should come with limit words
<?php $sdesc = $_product->getShortDescription(); $sdesc = trim($sdesc); $limit = 40; if (strlen($sdesc) > $limit) { $sdesc = substr($sdesc, 0, strrpos(substr($sdesc, 0, $limit), ' ')); } ?> <?php echo $sdesc."..."; ?>
This script helps you limit characters form Product Short Description.
Here's the code from 1.7.0.2 for list.phtml - LOOKING FOR HELP ON HOW TO ADD T HE LIMIT CHARACTER C
ReplyDeleteproductAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
Thanks,
Greg
you can just replace this line by
ReplyDeleteecho $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description')
by above code ......OR
You can change like this
echo $_helper->productAttribute($_product, nl2br($sdesc), 'short_description')
Hope this will work for you