News:

Support the VirtueMart project and become a member

Main Menu

Must use <br> for line break in short description

Started by chrlar, April 09, 2013, 15:45:27 PM

Previous topic - Next topic

chrlar

Updated:
We are using Joomla 2.5.9
VM 2.0.20b

-----

If we use " in our text in a product's short description field, it kind of fails. Or that is, at the end of a paragraph:
Rally asfaltdekk i 15"<br>Kommer i flere størrelser, og i soft, medium & hard.

We have to use line break, or it doesn't make a new line.

If we use two ' it works.
Rally asfaltdekk i 15''<br>Kommer i flere størrelser, og i soft, medium & hard.

The text after the " and half the tag is displayed all the way on top of the page.
(See image)
(The text is almost the same as the background, so I have highlighted it.)

It is possible to use two of the ' characters, but since we're not the only administrators of the VM store, we would prefer it if we could also use the " character.
Because we sell tyres and rims, and their size descriptions are in inches.

What is easier; to allow quotes and tag, or to automatically make a line break like in the long description field...?

:)

This code is in the administrator/components/com_virtuemart/views/product/tmpl/product_edit_description.php


<fieldset>
<legend><?php echo JText::_('COM_VIRTUEMART_PRODUCT_FORM_S_DESC'?></legend>
<textarea class="inputbox" name="product_s_desc" id="product_s_desc" cols="65" rows="3" >
<?php echo $this->product->product_s_desc?></textarea>
</fieldset>

<fieldset>
<legend><?php echo JText::_('COM_VIRTUEMART_PRODUCT_FORM_DESCRIPTION'?></legend>
<?php echo $this->editor->display('product_desc'$this->product->product_desc'100%;''550''75''20', array('pagebreak''readmore') ) ; ?>
</fieldset>


Would it help if the editor was used for the short description field as well? Then it would save the line breaks as HTML and < br >?

:)

[attachment cleanup by admin]

chrlar

The problem is actually in category view. Because in product detail view, the short description is not displayed.
But too much fuss about the code in the s_desc field (back end) messes up the html in the product detail view.

(I use two ' instead of " .)

[attachment cleanup by admin]

chrlar

So the fact remains, we need to use a <br> in order for the lines to break in category view.

So this: (s_desc form field)
This is to be on the first line.
And this it to be on the second line, as a new line.


turns to this: (category view)
This is to be on the first line. And this it to be on the second line, as a new line.

And then using <br>: (s_desc form field)
This is to be on the first line. <br>
And this it to be on the second line, as a new line.


turns to this: (category view)
This is to be on the first line.
And this it to be on the second line, as a new line.


All I'm saying is that it would be nice to get a line break without having to write <br>.

:)

Milbo

hmm, lol interesting.

Which editor do oyu use? I think the editor is responsible for this.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

chrlar

Which editor? Hmmm.

For Joomla I always use Firefox... (IE doesn't work with Joomla)
And in Joomla we use the TinyMCE, but there is no editor in use for the s_desc field (backend)...

:)

chrlar

#5
Is it possible to use an editor for the product_s_desc form as well as the product_desc form?

To change this
<textarea class="inputbox" name="product_s_desc" id="product_s_desc" cols="65" rows="3" >
<?php echo $this->product->product_s_desc?></textarea>


to

<?php echo $this->editor->display('product_s_desc'$this->product->product_s_desc'100%;''250''75''20', array('pagebreak''readmore') ) ; ?>

to make it like product_desc form:
<fieldset>
<legend><?php echo JText::_('COM_VIRTUEMART_PRODUCT_FORM_DESCRIPTION'?></legend>
<?php echo $this->editor->display('product_desc'$this->product->product_desc'100%;''550''75''20', array('pagebreak''readmore') ) ; ?>
</fieldset>


:)

Milbo

No, I mean which joomla editor, TinyMC, or JCE?
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

chrlar

#7
As I wrote three posts ago:
... And in Joomla we use the TinyMCE, but there is no editor in use for the s_desc field (backend)...

;)

PRO


chrlar

Maybe I'm a little slow in this area... But I don't see how that helps me? :-\

All I need is the line break in the category view if/when I make a line break in the s_desc form field backend...

:)

PRO

Quote from: chrlar on April 10, 2013, 22:37:59 PM
Maybe I'm a little slow in this area... But I don't see how that helps me? :-\

All I need is the line break in the category view if/when I make a line break in the s_desc form field backend...

:)

here is something someone did with 1.1
https://forum.virtuemart.net/index.php?topic=72519.msg241758#msg241758


You could do the same with a   > etc.


chrlar

But doesn't this mean that for every . (punctuation mark) there will be a line break?
<?php $product_s_desc str_replace'.''.<br />'$product_s_desc ); ?>

We have over 10000 products, so it's a bit risky making that change, since we may risk that there will be line breaks where we don't want line breaks... ?
:-\

But thanks for trying to help.. :)

PRO

Quote from: PRO on April 10, 2013, 22:20:07 PM
just write a little function and use "codes"

Like i did here
http://forum.virtuemart.net/index.php?topic=109549.0



thats why I said use CODES


Like  >=<br>

<?php $product->product_s_desc = str_replace( '>', '<br />', $product->product_s_desc ); ?>
       <?php echo $product->product_s_desc; ?>



short desc

blah,blah,blach>more blah,blah,blah

shows

Blah,blah,blah
more blah,blah,blah


chrlar

I think I'm looking for something with the code "nl2br();", but I'm not quite sure how to use it. Or if it will work at all, if the text in the database is all in one long text string. Since s_desc form field is a non-editor textarea.

That's why I was thinking about making the non-editor textarea into an editor textarea, like the one for the long description.

Either way, is this someting to think about for the developers? :)