If I create a new attribute as text area, what is the maximum character limit that I can put there? Is it possible to increase that limit?
I want to create a product attribute of type LONG TEXT. Is it possible?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityThe text attributes are stores in the table catalog_product_entity_text
. Their values are stores in the value
column that is of type text
.
You can see here the max lengths allowed for all column types.
This is what's important to you:
BLOB, TEXT L + 2 bytes, where L < 2^16 (64 Kilobytes)
You can also use long text for an attribute, but this is more complicated. You would have to create a table similar to catalog_product_entity_text
but with the column value
having the type LONGTEXT.
THe max storage for this is (from the same source)
LONGBLOB, LONGTEXT L + 4 bytes, where L < 2^32
But you will also have to search through the code to see where you need to tell magento to consider your new table. I have no idea what this will take.
I suggest using the TEXT attribute. It should be enough storage. If you plan to keep more than 64k in one column you might need to rethink your architecture.
The product description in Magento 1.x and 2.x is limited to 64Kb due the limitations of the MySQL field type "TEXT", which is limited to 2^16 bytes, see https://dev.mysql.com/doc/refman/5.7/en/storage-requirements.html
Depending on your requirements a possible workaround could be to store the necessary information inside a CMS block, create a own product attribute and reference the CMS block by the new product attribute. But this solution has also some limitations, e.g. the information won't be indexed by the product search, etc.
The other option would be to create a new Magento data type like catalog_product_entity_text but has huge implications on the architecture of the system.
The last and from my perspective most unsafe solution would be to change the MySQL type from text to long text of the value attribute of the table catalog_product_entity_text, which is described in the answer of https://community.magento.com/t5/Programming-Questions/Product-attribute-as-textarea-character-limit-reached/m-p/60772#M7152. This could have some negative impacts on the whole system (e.g. indexing, etc.) and should be tested carefully.