4

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?

2 Answers 2

5

The 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.

1
  • Thank you and +1 for the response. I tried. But couldn't get it work properly. I think saving those values in the database would be the best possible solution.
    – Sukeshini
    Jan 28, 2015 at 10:09
1

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.

1
  • Appreciate your suggestions and +1 (even though it is 3 years old question :)
    – Sukeshini
    Jan 4, 2018 at 5:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.