- Posts: 112
- Thank you received: 1
Don't allow HTML in product descriptions
10 years 1 week ago #249997
by darrelluk
Don't allow HTML in product descriptions was created by darrelluk
-- HikaShop version -- : 3.7.1
-- HikaMarket version -- : 1.7.1
-- Joomla version -- : 3.6.2
I was told to post this in Hikamarket.
How do I prevent users from using HTML in product descriptions? What code and where do I need to change on the Product page so that it keeps it to simple text?
Thx, Darrell
-- HikaMarket version -- : 1.7.1
-- Joomla version -- : 3.6.2
I was told to post this in Hikamarket.
How do I prevent users from using HTML in product descriptions? What code and where do I need to change on the Product page so that it keeps it to simple text?
Thx, Darrell
Please Log in or Create an account to join the conversation.
10 years 1 week ago #250004
by darrelluk
Replied by darrelluk on topic Don't allow HTML in product descriptions
Finally figured how to stop vendors from using crazy font sizes, colours etc.
System > Global Configuration > Text Filters
Find the filter group you have assigned to your vendors.
> Filter type = NO HTML
> Filter Tags = p,br,b,i (to allow basic formatting)
You then go to...
Components > Hikashop > Hikamarket > Configuration > Editor > plg_editors_none
This will remove the editor altogether on the product description field and prevent any HTML tags apart from the ones allowed above to be used, even if you paste text in.
Thx, Darrell
System > Global Configuration > Text Filters
Find the filter group you have assigned to your vendors.
> Filter type = NO HTML
> Filter Tags = p,br,b,i (to allow basic formatting)
You then go to...
Components > Hikashop > Hikamarket > Configuration > Editor > plg_editors_none
This will remove the editor altogether on the product description field and prevent any HTML tags apart from the ones allowed above to be used, even if you paste text in.
Thx, Darrell
Please Log in or Create an account to join the conversation.
10 years 1 week ago - 10 years 1 week ago #250029
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Replied by Jerome on topic Don't allow HTML in product descriptions
Hi,
Thanks for your post in that section.
In the HikaMarket product class (administrator/components/com_hikamarket/classes/product.php), you will find that code
You can replace that code by
So you will have a new hidden setting to completely remove all HTML tags in the product description when a vendor edit a product.
You can also replace in the same file
By
So the variants will also have that hidden setting available.
Please note that the patch will be integrated into next HikaMarket release.
For more details about "strip_tags" : php.net/manual/en/function.strip-tags.php
Regards,
Thanks for your post in that section.
In the HikaMarket product class (administrator/components/com_hikamarket/classes/product.php), you will find that code
Code:
$product->product_description = JRequest::getVar('product_description','','','string',JREQUEST_ALLOWRAW);
if((int)$config->get('vendor_safe_product_description', 1)) {
$safeHtmlFilter = JFilterInput::getInstance(null, null, 1, 1);
$product->product_description = $safeHtmlFilter->clean($product->product_description, 'string');
}
Code:
$product->product_description = JRequest::getVar('product_description','','','string',JREQUEST_ALLOWRAW);
if((int)$config->get('vendor_safe_product_description', 1)) {
$safeHtmlFilter = JFilterInput::getInstance(null, null, 1, 1);
$product->product_description = $safeHtmlFilter->clean($product->product_description, 'string');
}
$strip_tags = $config->get('vendor_striptags_product_description', '');
if(!empty($strip_tags)) {
$product->product_description = strip_tags($product->product_description, $strip_tags);
}
You can also replace in the same file
Code:
$product->product_description = JRequest::getVar('product_variant_description','','','string',JREQUEST_ALLOWRAW);
$safeHtmlFilter = JFilterInput::getInstance(null, null, 1, 1);
$product->product_description = $safeHtmlFilter->clean($product->product_description, 'string');
Code:
$product->product_description = JRequest::getVar('product_variant_description','','','string',JREQUEST_ALLOWRAW);
if((int)$config->get('vendor_safe_product_description', 1)) {
$safeHtmlFilter = JFilterInput::getInstance(null, null, 1, 1);
$product->product_description = $safeHtmlFilter->clean($product->product_description, 'string');
}
$strip_tags = $config->get('vendor_striptags_product_description', '');
if(!empty($strip_tags)) {
$product->product_description = strip_tags($product->product_description, $strip_tags);
}
Please note that the patch will be integrated into next HikaMarket release.
For more details about "strip_tags" : php.net/manual/en/function.strip-tags.php
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Last edit: 10 years 1 week ago by Jerome.
Please Log in or Create an account to join the conversation.
Moderators: Obsidev
Time to create page: 0.168 seconds