Page 1 of 1

Increase Character Limit for Page (Information) Titles

Posted: Sat Feb 10, 2018 3:18 am
by MarcPinnell
Using OC 3.02. In the admin, Pages (Information) titles have a character limit of 64 (at least that's what the error message says, I think it is actually less based on testing). Is there a good reason for this? If not, is there a simple way to increase that limit? I am working with a client that does a lot of seminars and the titles seem to run closer to 80 characters pretty regularly.

Re: Increase Character Limit for Page (Information) Titles

Posted: Sat Feb 10, 2018 4:51 am
by uksitebuilder
This is done for Search Engine purposes. The most a search engine will display as the title in search results is ~64 characters.

However, if you need to up the count, you can do the following:

Run an SQL command on your database to increase the characters from 64 to 255 (the max for a VARCHAR field)

Code: Select all

ALTER TABLE `oc_information_description` CHANGE `title` `title` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
Edit admin/controller/catalog/information.php

find:

Code: Select all

if ((utf8_strlen($value['title']) < 1) || (utf8_strlen($value['title']) > 64)) {
Change to:

Code: Select all

if ((utf8_strlen($value['title']) < 1) || (utf8_strlen($value['title']) > 255)) {
Edit: admin/language/en-gb/catalog/information.php

find:

Code: Select all

$_['error_title']            = 'Information Title must be between 1 and 64 characters!';
Change to:

Code: Select all

$_['error_title']            = 'Information Title must be between 1 and 255 characters!';

Re: Increase Character Limit for Page (Information) Titles

Posted: Sat Feb 10, 2018 5:09 am
by MarcPinnell
Perfect! Thank you very much. Just saved me a bunch of digging. I had just opened the DB when your message came in! :)
uksitebuilder wrote:
Sat Feb 10, 2018 4:51 am
This is done for Search Engine purposes. The most a search engine will display as the title in search results is ~64 characters.

However, if you need to up the count, you can do the following:

Run an SQL command on your database to increase the characters from 64 to 255 (the max for a VARCHAR field)

Code: Select all

ALTER TABLE `oc_information_description` CHANGE `title` `title` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
Edit admin/controller/catalog/information.php

find:

Code: Select all

if ((utf8_strlen($value['title']) < 1) || (utf8_strlen($value['title']) > 64)) {
Change to:

Code: Select all

if ((utf8_strlen($value['title']) < 1) || (utf8_strlen($value['title']) > 255)) {
Edit: admin/language/en-gb/catalog/information.php

find:

Code: Select all

$_['error_title']            = 'Information Title must be between 1 and 64 characters!';
Change to:

Code: Select all

$_['error_title']            = 'Information Title must be between 1 and 255 characters!';

Re: Increase Character Limit for Page (Information) Titles

Posted: Tue Nov 19, 2019 5:33 pm
by egmajo
This works!!
But in my case it works at my secondary languages,
In my main language I get ...

Re: Increase Character Limit for Page (Information) Titles

Posted: Tue Nov 19, 2019 5:47 pm
by letxobnav
This is done for Search Engine purposes. The most a search engine will display as the title in search results is ~64 characters.
Then why is meta_title VARCHAR 255?