Welcome, Guest
Username: Password: Remember me
Use this Category for your support questions about Responsive Joomla Virtuemart Template - CoolMart (SKU# FLEX-00014)

TOPIC: Wrong display when HTML tag in short desc(flypage)

Wrong display when HTML tag in short desc(flypage) 6 years 2 months ago #7436

Hello,

I put product short description part into the product flypage. If product short description include html tags, incorrectly displayed on the top of the website. I try FF, IE, Chrome, always looks wrong.
I know, do not use HTML code in product short desc filed. :)
Nevertheless, I'd like use HTML font formatting codes in short desc (Bold, red font or something).
Attached detailed picture or in live my test site.
www.tintacentrum.hu/new/index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=8901&virtuemart_category_id=96

What is the solution?

Thanks
Sandor
Attachments:
Last Edit: 6 years 2 months ago by Sándor Boda.
The topic has been locked.

Wrong display when HTML tag in short desc(flypage) 6 years 2 months ago #7479

The reason why "short description" requires plain texts, because that field is used to generate the "META" og:description tag for Facebook. (in case the product gets "liked" or "shared on Facebook" the short description is used to show as the description for the product).

When you put HTML tags in the META tag, it gets really messy and breaks everything:

Attachment Pasted_Image_11_27_13__3_39_AM-8.png not found



The only way to make it work is to "disable" the META description generation by using the short description field.

To disable it, open this PHP file:
/templates/flexible_coolmart/html/com_virtuemart/productdetails/default.php

and remove (Or comment it out) this line:
$document->addCustomTag('<meta property="og:description" content="'.$this->product->product_s_desc.'"/> ');

The problem will be solved. (there won't be extra texts at the top of the page)

BUT BE AWARE, if your product gets "like" or "Shared on Facebook" there won't be any description anymore. This is the drawback of disabling this line.

You can alternatively use the PHP function of strip_tags() (us1.php.net/strip_tags) to remove the HTML tags before using the short description to generate the og:description META tag, something like;

instead of using this:
$document->addCustomTag('<meta property="og:description" content="'.$this->product->product_s_desc.'"/> ');

use short description after the HTML tags get removed by strip_tags() function:
$document->addCustomTag('<meta property="og:description" content="'.strip_tags($this->product->product_s_desc).'"/> ');

I am not sure if the strip_tags() will remove all the HTML tags you use in the short description though, i haven't tested it. But give it a try. Or completely eliminate the og:description META tag generation from the default.php file i gave above.

Regards.
Support.
The topic has been locked.

Wrong display when HTML tag in short desc(flypage) 6 years 2 months ago #7491

Thanks for fast reply and solution.
strip_tags() function works.

Regards,
Sandor
The topic has been locked.

Wrong display when HTML tag in short desc(flypage) 6 years 2 months ago #7505

hmm. then i should better include this strip_tags() function permanently to template, (in case any one will ever use HTML tags inside the short description field).

Thanks for updating this topic.

Case solved. Topic closed.

Regards,
Support.
The topic has been locked.
Time to create page: 0.227 seconds

MaterialMart

for Virtuemart 3

Google's Material Design has finally arrived to Virtuemart

Virtumart Template - MaterialMart Virtumart Template - CleanMart Virtumart Template - CleanMart Virtumart Template - CleanMart

Fully responsive!

Buy Now   |   Live Demo