limit product name in magento2

Solutions on MaxInterview for limit product name in magento2 by the best coders in the world

showing results for - "limit product name in magento2"
Hugo
01 Jun 2016
1<?php
2$productName = $_helper->productAttribute($_product, $_product->getName(), 'name');
3$len = strlen($productName);
4?>
5<a class="product-item-link" href="<?php echo /* @escapeNotVerified */ $_product->getProductUrl() ?>">
6    <?php echo substr($productName,0,50); ?>
7    <?php if($len > 50) echo '...'; ?>
8</a>
9