Minor fixes in the character limit of the short description in mod_eshop_product

  • Impression eStudio
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
4 months 1 week ago - 4 months 1 week ago #162911 by Impression eStudio
The "Eshop Product" module has the option to limit the number of the characters of the short description. 

In order the PHP code to do better job, especially for languages except English, the lines: 
Code:
if ($shortDescLimited > 0 && strlen($productShortDesc) > $shortDescLimited) {        $productShortDesc = substr($productShortDesc, 0, $shortDescLimited) . '...'; }

should change to: 
Code:
if ($shortDescLimited > 0 && mb_strlen($productShortDesc, 'UTF-8') > $shortDescLimited) {     $productShortDesc = trim(utf8_substr($productShortDesc, 0, $shortDescLimited)) . '...'; }

The above change refers to all the files in the folder "modules/mod_eshop_product/tmpl".
Last edit: 4 months 1 week ago by Impression eStudio.
The following user(s) said Thank You: Giang Dinh Truong

Please Log in or Create an account to join the conversation.

  • Giang Dinh Truong
  • Offline
  • Administrator
  • Administrator
More
4 months 4 days ago #163025 by Giang Dinh Truong
OK Thank you!

I will look at this.

Sincerely, Giang

Please Log in or Create an account to join the conversation.

  • Impression eStudio
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
3 months 1 week ago #163772 by Impression eStudio
Hi and thank you for fixing this issue in version 3.9.0.

I just wanted to mention one small thing here in case you want to fix it too.
The short description sometimes (depending on the editor) may include html like <p>short description</p>.
In these cases the three dots are added after these tags, so they go to a new line.
Please see the attached image.

Could you please strip the html tags?

Thanks

Please Log in or Create an account to join the conversation.

  • Giang Dinh Truong
  • Offline
  • Administrator
  • Administrator
More
3 months 1 week ago #163792 by Giang Dinh Truong
Hello Impression,

In the latest version 3.9.0, I limit the length of short description by stripping the html tag to avoid breaking layout. The ... because that line does not have enough space to display it. It does not replated to html tags because I ignore html tags.

Sincerely, Giang

Please Log in or Create an account to join the conversation.

  • Impression eStudio
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
2 months 3 weeks ago #164203 by Impression eStudio
Hi Giang,

As you can see in the code of the screenshot the html code remains in the short description.
Also I checked the code of the module mod_eshop_product and I see that you use the function StringHelper::truncate which has the parameter $allowHtml but you don't use it and the default value is true which means that the html in the description is allowed and not stripped.

Thanks for getting in these details.

Please Log in or Create an account to join the conversation.

  • Giang Dinh Truong
  • Offline
  • Administrator
  • Administrator
More
2 months 1 week ago #164568 by Giang Dinh Truong
Hello,

$allowHtml is true means that Allow HTML tags in the output, and close any open tags. It does not count html tags while truncating.

Sincerely, Giang

Please Log in or Create an account to join the conversation.

Moderators: Giang Dinh Truong