Helper comment text for product attributes
-
22-10-2019 - |
문제
I'm wondering if there's an easy way to create comment help text for custom product attributes (or really for any product attributes - even some core attributes could use some helper text to make it a bit more clear what they do).
What I mean by comment help text is for example what you get when you use <comment>
in system.xml
.
So, for example, let's say you wanted to add a comment under Meta Title in the Meta Information tab of a product edit page to say "This is what will show up in the browser title bar".
I just noticed that Meta Description as an example already has some comment help text ("Maximum 255 chars") underneath it, but from a quick glance I'm not seeing where that would be defined under the Attribute details under Catalog > Manage Attributes > meta_description
I haven't done much digging yet into the core code to hunt for this yet, so my apologies if this is a really stupid question!
해결책
Ha...this is a good one.
The field in the db that determines the text under the attribute field is note
from the eav_attribute
table.
I never noticed that you can't change that from the UI.
I've created a lot of attributes that have a 'comment' below the fields but never change one.
To add that you need to specify this in the install script:
$this->addAttribtue('catalog_product', 'attribute_code_here', array(
....
'note' => 'This will be displayed below the field',
....
));
To change it for one attribute you can add this in an install/upgrade script.
$this->updateAttribute('catalog_product', 'attribute_code_here', 'note', 'This will be displayed below the field');
I can't believe that I've missed this in all the million versions I've used so far.
[EDIT]
See the definition of the meta_description
attribute in Mage_Catalog_Model_Resource_Setup::installEntities()
.
'meta_description' => array(
'type' => 'varchar',
'label' => 'Meta Description',
'input' => 'textarea',
'required' => false,
'note' => 'Maximum 255 chars',
'class' => 'validate-length maximum-length-255',
'sort_order' => 3,
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
'group' => 'Meta Information',
),