Jump to content
lord_enzo

Emoji Support In Product Descriptions

Recommended Posts

Hello, 

 

I want to put emoji symbols in the short description of some of my products. If I put the HTML code in the field, it displays nicely, but when I save the product, everything is saved until the emoji character. After the place it should be, the text is finished. 

 

If I put the code straight away in the database, it shows ok in the webpage, but if I have to enter back to the product page it saves it again without the text and the symbol. 

 

What part of the code would I need to change to make the admin panel to store the emoji in the database correctly? 

 

 

Edited by lord_enzo (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

It is possible to include it like this &#x1F609 (this is a wink smiley, see others: https://emojipedia.org/). This is tested in 1.7.4.4.

Now for the product description i did not manage to get it saved. It violates the validation; this is defined in Validate::isCatalogName($name). 

    /**
     * Check for product or category name validity
     *
     * @param string $name Product or category name to validate
     * @return bool Validity is ok or not
     */
    public static function isCatalogName($name)
    {
        return preg_match(Tools::cleanNonUnicodeSupport('/^[^<>;=#{}]*$/u'), $name);
    }

As you can see it has the "^[#]" regex, which means that # is not allowed. If you insert an emoji right away, the wysiwyg editor will convert it into "& #x something" again.

So unless you want to override this function (which i do not recommend), this will not be possible.

Share this post


Link to post
Share on other sites

I have found out that some emojis are supported by Prestashop v1.7 in meta title or description. I haven't done any extensive reserach, but emojis from Unicode standard version 1.1 are supported. List of emojis: https://emojipedia.org/unicode-1.1/

It would be great if Prestashop team added supprt for other emojis too as Google supports them in SERP and it is nice thing for SEO...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More