Author Topic: customfield.php - Some line breaks  (Read 587 times)

Ventsi Genchev

  • Jr. Member
  • **
  • Posts: 265
    • Audio Store
customfield.php - Some line breaks
« 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.
No pain, no gain, no site!

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3821
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: customfield.php - Some line breaks
« Reply #1 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

Ventsi Genchev

  • Jr. Member
  • **
  • Posts: 265
    • Audio Store
Re: customfield.php - Some line breaks
« Reply #2 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>.
No pain, no gain, no site!

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 27426
  • Always on vacation
    • Jenkin Hill Internet
Re: customfield.php - Some line breaks
« Reply #3 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 />
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VM 3.4.3.10057 on Joomla 3.9.8 PHP 7.0.33
Testing VM .3.6.0.10075 on Joomla 3.9.8

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3821
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: customfield.php - Some line breaks
« Reply #4 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.

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2896
  • VirtueMart Version: 3.4
Re: customfield.php - Some line breaks
« Reply #5 on: January 28, 2019, 11:39:07 am »
tcpdf used by VM does not handle DIV and CSS well
regards
A

Joomla 3.9.1
php 7.1

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9838
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: customfield.php - Some line breaks
« Reply #6 on: January 28, 2019, 22:07:10 pm »
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?
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3821
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: customfield.php - Some line breaks
« Reply #7 on: January 29, 2019, 15:54:18 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