VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: Ventsi Genchev on January 26, 2019, 09:25:05 AM

Title: customfield.php - Some line breaks
Post by: Ventsi Genchev on January 26, 2019, 09:25:05 AM
I think there are 2 lines in the customfield.php that need to be changed.
(/components/com_virtuemart/sublayouts/customfield.php)

1.
$value .= '</span><br>';
Must be:
$value .= '</span><br />';

2.
And I think <br /> should be removed to the following line:
$html .= $otag.$tmp.'</span><br />';
This adds a blank line everywhere (in the cart, in the order letter...). For example, add this product to your cart and you will see the blank line after the last parameter:
https://demo.virtuemart.net/multi-variant-11-detail

However, I have not tested all possible options, and I ask other developers to look at whether I am right.
Title: Re: customfield.php - Some line breaks
Post by: Studio 42 on January 26, 2019, 11:55:34 AM
I think that the render is nont nice and should never use any <br> but should use <div> so it's more logical to add CSS if you need customfield title inline or as block.
<span class="product-field-type-C">
<span> Product Width 46.0</span><br>
<span> Product Length 68.5</span><br>
<span> Weave Advanced </span><br>
</span>
Should be
<div class="product-field-type-C">
<div> Product Width 46.0</div>
<div> Product Length 68.5</div>
<div> Weave Advanced </div>
</div>
But this is the case for all customfields
Title: Re: customfield.php - Some line breaks
Post by: Ventsi Genchev on January 26, 2019, 12:03:57 PM
I absolutely agree with you, Patrick. But these changes do not depend on us.  :)
For now I will overwrite the file just because of the <br>.
Title: Re: customfield.php - Some line breaks
Post by: jenkinhill on January 26, 2019, 12:16:25 PM
My understaning is that both <br> and <br /> are acceptable in HTML5 and XHTML.  Although out of habit, when writing HTML I always use <br />
Title: Re: customfield.php - Some line breaks
Post by: Studio 42 on January 26, 2019, 22:15:36 PM
The problem is not only here.
In PDF the result is not the same too.
Using div work in all case.
Title: Re: customfield.php - Some line breaks
Post by: AH on January 28, 2019, 11:39:07 AM
tcpdf used by VM does not handle DIV and CSS well
Title: Re: customfield.php - Some line breaks
Post by: Milbo on January 28, 2019, 22:07:10 PM
Quote from: Studio 42 on January 26, 2019, 11:55:34 AM
I think that the render is nont nice and should never use any <br> but should use <div> so it's more logical to add CSS if you need customfield title inline or as block.
<span class="product-field-type-C">
<span> Product Width 46.0</span><br>
<span> Product Length 68.5</span><br>
<span> Weave Advanced </span><br>
</span>
Should be
<div class="product-field-type-C">
<div> Product Width 46.0</div>
<div> Product Length 68.5</div>
<div> Weave Advanced </div>
</div>
But this is the case for all customfields

I like that idea, how would that look like in bs4, and how would you call extra classes? to make it inline, what is the css for?
Title: Re: customfield.php - Some line breaks
Post by: Studio 42 on January 29, 2019, 15:54:18 PM
Quote from: Milbo on January 28, 2019, 22:07:10 PM
I like that idea, how would that look like in bs4, and how would you call extra classes? to make it inline, what is the css for?

To display inline you have to add with css display:inline; but why you want display the custom fields inline ?
All the customfield part should be displayed using display:block; to not break the render.
About DIV support, i dont remember me that this break PDF render, but in virtuemat perhaps because the container is span.
So using only DIVs should definitely render better