Page 1 of 1
How to Limit Product Title Characters in Category Page
Posted: Mon Oct 09, 2017 5:30 pm
by GetinBuy1
Hello All,
I need a help. I'm using opencart 2.3.0.2 version. When the product title has more characters then it is increasing the height of the product box in the category page and also in the featured page. Please look at the image attached.
Any help is appreciated!
Thanks in advance
Re: How to Limit Product Title Characters in Category Page
Posted: Mon Oct 09, 2017 6:04 pm
by MarketInSG
Re: How to Limit Product Title Characters in Category Page
Posted: Mon Oct 09, 2017 7:44 pm
by GetinBuy1
Thank you so much it is helpful. I'm new to php so, can you please help me as where to place this ?
Do I have to place it in stylesheet.css file ?
Re: How to Limit Product Title Characters in Category Page
Posted: Tue Oct 10, 2017 2:31 am
by kestas
yes you can place it to stylesheet.css... mostly browsers has inspection function. so you can simply click F12 and play with your page...
Re: How to Limit Product Title Characters in Category Page
Posted: Tue Oct 10, 2017 2:46 am
by IP_CAM
Well, according to the Code used, this Extension should work in OC v.2.3.x as well:
Good Luck!
Ernie
---
Limit number of characters in product name on category page free, OC v.2.x
https://www.opencart.com/index.php?rout ... n_id=24964
---
You have to change the Value:
70 according to your needs!
limit_titles.vqmod.xml (VqMod Version)
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<modification>
<id><![CDATA[Limit characters in the title - category page]]></id>
<version><![CDATA[1.0]]></version>
<vqmver><![CDATA[2.5.1]]></vqmver>
<author><![CDATA[Angela Boartes - Soft Build]]></author>
<file name="catalog/controller/product/category.php">
<operation error="log">
<search position="replace"><![CDATA['name' => $result['name'],]]></search>
<add trim="true"><![CDATA[
'name' => utf8_substr($result['name'],0,70),
]]></add>
</operation>
</file>
</modification>
and if you use
OcMod, try this Code, and then rename the FILE-Name to
limit_titles.ocmod.xml (OcMod Version)
and install it by use of the OcMod-Installer:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<modification>
<name><![CDATA[Category Product Name Length]]></name>
<code><![CDATA[product_name_length]]></code>
<version><![CDATA[OC v.2.x]]></version>
<author><![CDATA[Angela Boartes - Soft Build]]></author>
<file path="catalog/controller/product/category.php">
<operation>
<search><![CDATA['name' => $result['name'],]]></search>
<add position="replace" trim="true"><![CDATA[
'name' => utf8_substr($result['name'],0,70),
]]></add>
</operation>
</file>
</modification>
Re: How to Limit Product Title Characters in Category Page
Posted: Tue Oct 10, 2017 8:52 pm
by GetinBuy1
Can you please mention the path here! I have basic working knowledge in php
Thanks☺
Re: How to Limit Product Title Characters in Category Page
Posted: Wed Oct 11, 2017 1:25 am
by IP_CAM
Well, if you really plan to play around with OC, you'll need to find out,
how Opencart works. You'll find some links on this here:
viewtopic.php?f=20&t=173059&p=655919
Good Luck !
Ernie
Re: How to Limit Product Title Characters in Category Page
Posted: Thu Jan 02, 2020 8:49 pm
by nudylady
how to do this for related products for 3.0.3.2?
Re: How to Limit Product Title Characters in Category Page
Posted: Thu Jan 02, 2020 11:32 pm
by IP_CAM
try this, just change the value (30) to the max. size allowed:
Re: How to Limit Product Title Characters in Category Page
Posted: Sun Jan 05, 2020 3:21 am
by nudylady
yes, the above worked for related products, thank you
Re: How to Limit Product Title Characters in Category Page
Posted: Mon Jun 14, 2021 6:50 pm
by HappyChukwudike
Hello Great People
Please, how can I get this done in version 3.0.3.7?
Thank you
Re: How to Limit Product Title Characters in Category Page
Posted: Mon Jun 14, 2021 7:19 pm
by straightlight
HappyChukwudike wrote: ↑Mon Jun 14, 2021 6:50 pm
Hello Great People
Please, how can I get this done in version 3.0.3.7?
Thank you
Have you tried the solution, so far? According to the suggestion above, there shouldn't be much or any difference.