While doing a code in Magento, you might have met with the problem where special characters like ä were not properly displayed.
Today we are going to talk about this problem and it’s solution.
We faced same situation as shown in screen shot.
To resolve this issue, we used grid renderer for subject column.
First you have to create new admin theme for email gird override.
Create Files like this:
1 |
app/design/adminhtml/[VendorName]/[ThemeName]/registration.php |
1 2 3 4 5 6 7 |
<?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::THEME, 'adminhtml/[VendorName]/[ThemeName]', __DIR__ ); |
1 2 3 4 5 6 7 |
<?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::THEME, 'adminhtml/[VendorName]/[ThemeName]', __DIR__ ); |
1 |
app/design/adminhtml/[VendorName]/[ThemeName]/theme.xml |
1 2 3 4 |
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd"> <title>[VendorName] [ThemeName]</title> <parent>Magento/backend</parent> </theme> |
Now Override the email grid in our new theme and add renderer in subject like below:
1 |
app/design/adminhtml/Dahlquist/General/Magento_Email/layout/adminhtml_email_template_grid_block.xml |
1 2 3 4 5 6 7 |
<block class="Magento\Backend\Block\Widget\Grid\Column" name="adminhtml.system.email.template.grid.columnSet.subject" as="subject"> <arguments> <argument name="header" xsi:type="string" translate="true">Subject</argument> <argument name="index" xsi:type="string">template_subject</argument> <argument name="renderer" xsi:type="string">[VendorName]\[ModuleName]\Block\Adminhtml\Template\Grid\Renderer\Testing</argument> </arguments> </block> |
In last part, “Testing” is block file name. But, you can use any name of the class and create in your any custom or existing module:
1 |
[VendorName]\[ModuleName]\Block\Adminhtml\Template\Grid\Renderer\Testing |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<?php namespace [VendorName]\[ModuleName]\Block\Adminhtml\Template\Grid\Renderer; class Testing extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { public function render(\Magento\Framework\DataObject $row) { $result = $row->getTemplateSubject(); $convertString = ''; if (isset($result)) { $convertString = utf8_encode($result); } return __($convertString); } } |
Now You can see in admin side email grid will look like this:
[crayon-63e0a40e36ad3366253048/] Using above fucntion Images can be imported directly from...
Override view block using di.xml and add the below code...
You can check a list of called layout XML for...
Follow the below steps to install and set up PWA...
If you want to remove all leading zero's from order,...
Let our Magento expert connect to discuss your requirement.
We offer Magento
certified developers.
Our Magento clientele
is 500+.
We sign NDA for the
security of your projects.
We’ve performed 100+
Magento migration projects.
Free quotation
on your project.
Three months warranty on
code developed by us.