Author Topic: How do I put a line break in a product's Short Description  (Read 908 times)

nicolafw

  • Beginner
  • *
  • Posts: 34
How do I put a line break in a product's Short Description
« on: July 23, 2012, 07:39:02 AM »
Hi,

this question has been posted two years ago concerning VM 1.1: http://forum.virtuemart.net/index.php?topic=72519.0.

Is there an solution for VM 2?

I'm using:
Joomla 2.5
VM 2.0.6

I tried this without success:
Code: [Select]
<p class="product_s_desc">
<?php $product_s_desc str_replace'.''<br />'$product_s_desc ); ?></p>
<?php echo shopFunctionsF::limitStringByWord($product->product_s_desc300'...'?>
<?php ?>
in components/com_Virtuemart/views/category/tmpl/default.php

nicolafw

  • Beginner
  • *
  • Posts: 34
Re: How do I put a line break in a product's Short Description
« Reply #1 on: July 25, 2012, 01:47:47 AM »
Does anybody have any idea how to solve this? It cannot be very difficult, but I'm clueless with php.

ivus

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 540
  • - YAY me... proud member of the 500 club...
Re: How do I put a line break in a product's Short Description
« Reply #2 on: July 25, 2012, 04:21:58 AM »
Hi nicolafw,

Yeah a line break is a hidden character. To force the line to wrap use the following code.

Code: [Select]

<p class="product_s_desc"><?php $product_s_desc str_replace"\n"'<br />'$product_s_desc ); ?></p>


Replace "\n" ... new line.

I hope this helps.

nicolafw

  • Beginner
  • *
  • Posts: 34
Re: How do I put a line break in a product's Short Description
« Reply #3 on: July 26, 2012, 12:00:59 PM »
No, it did not help. Is in components/com_Virtuemart/views/category/tmpl/default.php the proper document?

ivus

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 540
  • - YAY me... proud member of the 500 club...
Re: How do I put a line break in a product's Short Description
« Reply #4 on: July 26, 2012, 12:03:37 PM »
whoops, should have been:

Code: [Select]

<p class="product_s_desc"><?php $product_s_desc str_replace"\n"'<br />'$product->product_s_desc ); ?></p>


nicolafw

  • Beginner
  • *
  • Posts: 34
Re: How do I put a line break in a product's Short Description
« Reply #5 on: July 30, 2012, 01:50:16 AM »
Thanks, but it still does not work. It is in line 249, isn't it?

Code: [Select]
<?php // Product Short Description
if(!empty($product->product_s_desc)) { ?>

<p class="product_s_desc"><?php $product_s_desc str_replace"\n"'<br />'$product->product_s_desc ); ?></p>
<?php echo shopFunctionsF::limitStringByWord($product->product_s_desc300'...'?>
<?php ?>


This is my site, maybe that helps: http://www.helden.ch/jupgrade/

srseale

  • Beginner
  • *
  • Posts: 47
Re: How do I put a line break in a product's Short Description
« Reply #6 on: July 31, 2012, 09:08:12 AM »
Perhaps I misunderstand your question.  I looked at your reference to VM 1.1 and it describes the need to put a line break HTML tag in the short description of a product.  HTML tags are supported in the VM 2.0 Short Description field.  Just insert <br /> wherever you need it...

Hope this helps...

ivus

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 540
  • - YAY me... proud member of the 500 club...
Re: How do I put a line break in a product's Short Description
« Reply #7 on: July 31, 2012, 09:14:26 AM »
Hi nicolafw,

OK, so I can see you're not too proficient with PHP. If you want to use it in your current code, use the following:

Code: [Select]

    <?php // Product Short Description
    
if(!empty($product->product_s_desc)) { 
$product_s_desc str_replace"\n"'<br />'$product->product_s_desc );
    
echo shopFunctionsF::limitStringByWord($product_s_desc300'...');
    }
    
?>



I hope this helps.

VirtueMart Forum

Re: How do I put a line break in a product's Short Description
« Reply #7 on: July 31, 2012, 09:14:26 AM »