HTML codes in category description breaks category list layout in admin

Started by sandomatyas, September 10, 2018, 15:19:24 PM

Previous topic - Next topic

sandomatyas

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

StefanSTS

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

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.

StefanSTS

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.