2

I have an extension that allows an admin to select attributes from a list to show in tabs on the detail page on the frontend.

The list of attributes is filtered by the type "text" and "textarea". The values of these attributes are then echoed in the tabs.

However, I just noticed that both the "Tier Price" and "Group Price" attributes show in the list. On checking those 2 attributes, I found that they are indeed of the "text" type:

Tier attribute

I'm wondering why that is, considering the input for them is most definitely not a simple text box:

admin input

and they in fact output an array.

4

Tim Bezhashvyly's answer is only half the answer. Tier prices and group prices are set as a text field for a reason.

In Magento, the different attribute types determine in which table the value is saved. For example, there are the tables catalog_product_entity_text and catalog_product_entity_varchar. Both tables have their own field type.

When the field type is being set to text, the data will be saved in catalog_proudct_entity_text giving it 65535 bytes per entry. Would it be varchar, it would be saved to the catalog_product_entity_varchar table, only allowing 255 bytes to be used per entry. Since tier pricing and group pricing are being saved as a serialized array, the amount of bytes used per entry for storage can easily exceed 255, so the text table is being used to store this.

| improve this answer | |
1

"Text" is just a type of field validation in admin area.

Most likely it was set to "text" w/o any special reason as tier prices have quite a custom input interface.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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