VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: sandomatyas on September 10, 2018, 15:19:24 PM

Title: HTML codes in category description breaks category list layout in admin
Post by: sandomatyas on September 10, 2018, 15:19:24 PM
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:
<?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
Title: Re: HTML codes in category description breaks category list layout in admin
Post by: StefanSTS 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


Title: Re: HTML codes in category description breaks category list layout in admin
Post by: Studio 42 on September 10, 2018, 20:43:56 PM
Quote from: StefanSTS 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



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.
Title: Re: HTML codes in category description breaks category list layout in admin
Post by: StefanSTS 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