Jump to content

Design => Pages | Saving deletes the page content!


Lukas Truninger

Recommended Posts

I recently updated to 1.7.6.7. Today, I wanted to update some information on a design page. Saving the page did delete the complete page content ( in all languages !!). The other fields (Title, Meta title, ....) seams to be ok.
When I reopen the page to edit, I get always following text in the page content field: "of 21844 characters allowed". But also this text is not displayed on frontend ....????
I did retest the behavior, writing just "Test" into the page content. Same issue - it is deleted when I save the page. On frontend, the page content is empty (not even "Test"). I did not have this issue with previous 1.7.6.2.

Link to comment
Share on other sites

at first  I would check data
something like that:

SELECT id_cms, length(content) as contentlength,meta_title,id_lang, left(content,100) as contentstarts FROM `ps_cms_lang`

the type VARCHAR limit is 21844 characters, but content range in ps_cms_lang is longtext.
Check also structure of table where you store page

Edited by EvaF (see edit history)
Link to comment
Share on other sites

You should look for who it causes - the problem is certainly in table structure.... (plugin tables?, ps tables?)

in mysql or in BO ->advanced parameters->database

try this query:

SELECT 	TABLE_SCHEMA,TABLE_NAME,COLUMN_NAME,ORDINAL_POSITION,	COLUMN_DEFAULT,	IS_NULLABLE,DATA_TYPE ,CHARACTER_MAXIMUM_LENGTH 	
    FROM INFORMATION_SCHEMA.COLUMNS
    WHERE COLUMN_NAME IN ('content')
        AND TABLE_SCHEMA='XXX'


where 'XXX' is your database name
 

Link to comment
Share on other sites

As I told at the beginning, the content is deleted when saving the cms page. The corresponding field in the database is empty. Things did work fine before I updated to the latest version, and I wonder a bit how PS can release an update with such terrible bugs. I need a solution urgently, as my page currently is destroyed.

Screen Shot 2020-09-19 at 09.01.17.png

Link to comment
Share on other sites

ok, you are certainly use some plugins/theme - Leo???

if i run the query above on my test db - then the result looks:

PS25.thumb.png.6ec24c7a98260b5dc3ceb5b769f38f28.png

f,e field ps_btmegamenu.content is of type text (max size = 65535B)

But i am using utf-8 -  what means:

A text column can be up to 65,535 bytes.

An utf-8 character can be up to 3 bytes.

So... your actual limit can be 21,844 characters.

(see http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html)

therefore i suggest to increase the content field capacity to MEDIUMTEXT (length limit is 16M) or LONGTEXT (length limit is 4G.) at the tables that PS/or your plugins use

 

 

 

Edited by EvaF (see edit history)
Link to comment
Share on other sites

One again: It is an issue of updated controller (or whatever) PS files (php), not database. It is not an issue about length limit. It does not even work with 4 letters (as described above)

In the meantime, I could extract the page content from a backup and copy/paste it into the database field directly. Page is now shown correct in frontend, but it cannot be edited via Prestashop admin. There is a terrible BUG in PS controler (actually, there are a bunch of bugs, but this one is very bad!)

I have had installed the tinymcepro from myprestashop, but in the meantime I have uninstalled it and deleted the var/cache

Link to comment
Share on other sites

imho the error occurs, if you try to store in some table ( not into the table ps_cms_lang) content, that exceeded 21844 chars and field "content" is of type "TEXT"
In this case Mysql refuses store the record and returns error. Prestashop takes care exception and does not process other sql query ( therefore your page is not  stored into the table)

I can be wrong of course, because I do not know your set of additional modules... But imho the problems lies in one of them

 

Link to comment
Share on other sites

It does not only "not store" the changes, but it deletes the content! If there is some text in the content database field, and then I store an update text, result is an empty content field. Thus it does write to the database. And why should it store the content in an other database filed than what it belongs to? If it does, there is a bug.

Edited by Lukas Truninger
spelling (see edit history)
Link to comment
Share on other sites

I have checked your error message and have found out, that it can  come from 

src/PrestaShopBundle/Form/Admin/Type/FormattedTextareaType.php

class FormattedTextareaType extends AbstractType
{
    /**
     * Max size of UTF-8 content in MySQL text column
     */
    const LIMIT_TEXT_UTF8 = 21844;

this limit is tested, when in options of "FormattedTextareaType" is the option:

 'counter_type' => 'recommended',

 

try to find in your Prestashop directory all occurences of 'counter_type'

(in my prestashop 1.7.6.7 instance (exclude cache directory)  are only two occurences (both in src/PrestaShopBundle/Form/Admin/Product/ProductSeo.php)
( i can store the pages that are greater than 21844 characters)
all other occurences can caused your problem

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...