Looking to find a way to make a line break e.g <br /> on a product name.

I want the Manufacture name to site above the model. enter image description here

  • there is no difference between names in your question. Dec 15, 2015 at 5:06
  • You should add more details to the question and clarify your problem a little more than this. In it's current form, it is not clear what you are asking.
    – Prateek
    Dec 15, 2015 at 6:13
  • Just so i understand you have a product name of Manufacture Model Awesomeness and you want to do the following: Manufacture <br /> Model Awesomeness on a product page?
    – rob3000
    Dec 15, 2015 at 6:14
  • Sorry about lack of details in original post. It was a late night.. See updated post with photo. Photo on the left is how it currently looks, photo on the right is how I want the product name to look. Dec 15, 2015 at 15:19
  • You can increase the font size of the product title so that LK-9370 goes onto a different line. Aug 5, 2019 at 10:48

3 Answers 3


Try to print out a product name after replacing the first whitespace character with <br />:

$productName = $_helper->productAttribute($_product, $_product->getName(), 'name');
echo preg_replace('/\s{1}/u', '<br/>', $productName, 1);

Default template located here: app/design/frontend/base/default/template/catalog/product/list.phtml

Change at lines ~55 & ~96:

<h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></a></h2>


<h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo preg_replace('/\s{1}/u', '<br/>', $_helper->productAttribute($_product, $_product->getName() , 'name'), 1); ?></a></h2>

I needed to do the same so I used str_replace.

I've added ' - ' (space dash space) in all the product titles I wanted my line break (You can use ' --- ' if you're using the ' - ' with other titles)

Then I've looked for

<?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?>

in list.phtml & list_featured_slider.phtml and I replaced it with

   $productname = $_helper->productAttribute($_product, $_product->getName(), 'name');
   $newproductname = str_replace(' - ', '<br />', $productname);

echo $newproductname 

Worked for me just fine ;)

You can do it in view.phtml as well if you need the line break on product page


Thanks to your hints, here my working solution to replace "-" with < br> in the product title (category view = app/design/frontend/base/default/template/catalog/product/list.phtml):

<strong class="product name product-item-name">
      <a class="product-item-link" href="<?php echo $_product->getProductUrl() ?>">
      <?php echo str_replace(' - ', '<br />', $_helper->productAttribute($_product, $_product->getName() , 'name')); ?></a>


POLO RALPH LAUREN Uomo - Giacca leggera antivento in nylon blu

Giacca leggera antivento in nylon blu

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.