How to use Emoji in CMS Opencart? - Solution 100%
How to use Emoji in CMS Opencart? - Solution 100%
Описание
You've probably come across many websites that use Emoji (emoticons). They can be seen in the Title, Description, Breadcrumbs, or even in the letters you receive via newsletter.
Emoji is the best option to highlight you in Google search engine results. There is an 85% chance that a potential client will come to you, because visually your site stands out from the usual gray mass in the search results. And imagine, in CMS Opencart it is also possible, even necessary, to use Emoji!
If you have already tried to insert emoticons through the site’s admin panel, but when saving they are replaced with a question mark symbol or another, then the reason for this is the encoding.
Now about the most important thing, how to make uft8mb4 encoding to display Emoji?
- 1. Decide where you need to display emoticons, this could be the title of the main page, category description, etc. We will change the encoding exactly where you need it, because changing it throughout the site is not recommended.
- 2. Next, you need to go into the database, find the name of the desired table and change the encoding in it using a simple SQL query:
ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
* table_name - we replace it with the table name.
Frequently used places:
oc_category, oc_category_description - Category and its description;
oc_product, oc_product_description - Product, product description;
oc_review or oc_comment (depending on the Opencart version) - Comments or reviews.
By analogy, you can change the encoding to utf8mb4 in those places where you want. - 3. After we need to change the encoding in the connection to the database in the file /system/library/db/mysqli.php, namely, we change the line $this->connection->set_charset("utf8") to $this->connection-> set_charset("utf8mb4")
That's all, this method allows you to use emoji anywhere in your online store based on CMS Opencart!
If something didn’t work out for you, or you have questions, write about it in the comments.
