News:

Looking for documentation? Take a look on our wiki

Main Menu

How do I put a line break in a product's Short Description

Started by nicolafw, July 23, 2012, 15:39:02 PM

Previous topic - Next topic

nicolafw

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:
<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

Does anybody have any idea how to solve this? It cannot be very difficult, but I'm clueless with php.

ivus

Hi nicolafw,

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



<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

No, it did not help. Is in components/com_Virtuemart/views/category/tmpl/default.php the proper document?

ivus

whoops, should have been:



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


nicolafw

Thanks, but it still does not work. It is in line 249, isn't it?

<?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

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

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:



    <?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.