Magento – Limit Displayed Characters From Product Short Description

By | July 22, 2012
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

getShortDescription();
$sdesc = trim($sdesc);
$limit = 40;
if (strlen($sdesc) > $limit) {
$sdesc = substr($sdesc, 0, strrpos(substr($sdesc, 0, $limit), ' '));
} ?>

This script helps you limit characters form Product Short Description.

4 thoughts on “Magento – Limit Displayed Characters From Product Short Description

  1. Magento Blog

    Here’s the code from 1.7.0.2 for list.phtml – LOOKING FOR HELP ON HOW TO ADD T HE LIMIT CHARACTER C
    productAttribute($_product, $_product->getShortDescription(), ‘short_description’) ?>

    Thanks,
    Greg

    Reply
  2. Sandeep Gulati

    you can just replace this line by

    echo $_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

    Reply
  3. Pingback: Limit Displayed Characters for Product Name and Short Description – Magento – Moyen Uddin

Leave a Reply