Author Topic: HTML codes in category description breaks category list layout in admin  (Read 851 times)

sandomatyas

  • Jr. Member
  • **
  • Posts: 304
When you use HTML codes in category description and open the VM categories menu item the layout is broken.
I checked the layout file in administrator/components/com_virtuemart/views/category/tmpl/default.php and there is this code part:
Code: [Select]
<?php
/*$descr = htmlspecialchars_decode($cat->category_description);
echo shopFunctionsF::limitStringByWord(JFilterOutput::cleanText($descr),200);*/
echo shopFunctionsF::limitStringByWord($cat->category_description,200); ?>

I'm not sure why JFilterOutput::cleanText was removed but but it fixes the problem.

It's in 3.2.14 and 3.2.15, too

StefanSTS

  • Global Moderator
  • Full Member
  • *
  • Posts: 550
  • VirtueMart Version: VM 4.2 on Joomla 4.5
Re: HTML codes in category description breaks category list layout in admin
« Reply #1 on: September 10, 2018, 19:55:59 pm »
I think, you have to be more specific when you say "use HTML codes2.

I never had problems with that, except customers used non valid HTML; then the category list gets broken from time to time.

Regards
Stefan


--
Stefan Schumacher
www.jooglies.com - VirtueMart Invoice Layouts

Please use only stable versions with even numbers for your live shop! Use Alpha versions only if you know what risk you are taking.

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4387
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: HTML codes in category description breaks category list layout in admin
« Reply #2 on: September 10, 2018, 20:43:56 pm »
I think, you have to be more specific when you say "use HTML codes2.

I never had problems with that, except customers used non valid HTML; then the category list gets broken from time to time.

Regards
Stefan



Sure it break
shopFunctionsF::limitStringByWord($cat->category_description,200);
do not check for html, if it shorten the string before a closing TD or TABLE, then it not render right.

StefanSTS

  • Global Moderator
  • Full Member
  • *
  • Posts: 550
  • VirtueMart Version: VM 4.2 on Joomla 4.5
Re: HTML codes in category description breaks category list layout in admin
« Reply #3 on: September 11, 2018, 12:31:32 pm »
Hi sandomatyas,

if there are open HTML tags because the end tags were cut off, it will break.
I don't know why the Joomla function was removed, but there might have been a reason.

Maybe something like this:
echo shopFunctionsF::limitStringByWord(strip_tags($cat->category_description),200);
could help to get rid of the tags first and then cut the string if it does not work in your case.

In VM 3.2.15.9925 the category description doesn't break by the way. Looks like the HTML tags are removed in a different way.

Regards
Stefan
--
Stefan Schumacher
www.jooglies.com - VirtueMart Invoice Layouts

Please use only stable versions with even numbers for your live shop! Use Alpha versions only if you know what risk you are taking.