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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

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