Hi there,
As my product titles are quite long i’d like to have them over 1, 2 or even 3 lines on the home page and in the category listings.
From what i’ve researched i need to modify the file list.phtml which can be found here :
/var/www/html/app/design/frontend/Smartwave/porto/Magento_Catalog/templates/product
I’ve tried inserting the code :
<?php echo $name = wordwrap($name, 20, "<br />\n",false);?>
In this section :
<strong class="product name product-item-name">
<a class="product-item-link"
href="<?php echo $_product->getProductUrl() ?>">
<?php echo $_helper->productAttribute($_product, $_product->getName(), 'name'); ?>
<?php echo $name = wordwrap($name, 20, "<br />\n",false);?>
</a>
</strong>
Then recompiled, static-content:deploy etc…
Then when i go to a category i get the error :
1 exception(s):
Exception #0 (Exception): Notice: Undefined variable: name in /var/www/html/app/design/frontend/Smartwave/porto/Magento_Catalog/templates/product/list.phtml on line 241
Which is the line I’ve just modified.
Also nothing has changed on the homepage.
Can any body help with an easy solution?
Thanks.