A
A
Andrey Andreev2017-10-30 12:00:41
Unicode
Andrey Andreev, 2017-10-30 12:00:41

Opencart 2.3 in categories in product short description problem with encoding, question marks?

opencart 2.3 in categories in the short description of the product encoding problem, question marks. 59f6e893f0cf9223833324.png
when trimming the length, there are problems with encoding ; the
length changes in the template of the category
catalog/view/theme/template/product/category.tpl

<div class="description-small">
  <?php if(strlen($product['description']) > 120) { echo substr($product['description'], 0, 120) . '..'; } else { echo $product['description']; } ?>
</div>

tried mb_strlen, did not help

in the controller file
catalog/controller/product/category.php
'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get($this->config->get('config_theme') . '_product_description_length')) . '..',

Help me figure out why

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Immortal_pony, 2017-10-30
@maaaaaaan

tried mb_strlen, did not help

It is necessary to replace all str* functions with mb_str*. In this case, mb_strlen and mb_substr are needed
<?php 
if(mb_strlen($product['description']) > 120) { 
    echo mb_substr($product['description'], 0, 120) . '..'; 
} else {
    echo $product['description']; } 
?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question