1

I'm trying to display an additional product attribute when managing a product's attributes.

I've set up the attribute as follows:

https://i.stack.imgur.com/AMSa7.jpg

the descriptions (addable and editable by admin users in the config section) need to be displayed as a multi select dropdown.

I've written the following to programmatically add the attribute for products:

<?php
/* @var $this Mage_Core_Model_Resource_Setup */
$installer = $this;
$installer->startSetup();

$installer->addAttribute('catalog_product', 'additional_product_description', array(
    'group'                => 'General',
    'type'              => 'text',
    'backend'           => 'adminhtml/system_config_backend_serialized_array', // ***** NOT SURE IF THIS IS CORRECT, PLEASE ADVISE *****
    'frontend_input'    => '',
    'frontend'          => '',
    'label'             => 'Additional Product Descriptions',
    'input'             => 'multiselect',
    'class'             => '',
    'source'            => '***** ***** ***** NEED HELP HERE ***** ***** *****',
    'global'             => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,//can be SCOPE_WEBSITE or SCOPE_STORE
    'visible'           => true,
    'used_in_product_listing' =>true, //can also be false
    'frontend_class'     => '',
    'required'          => false,//can be true
    'user_defined'      => true,
    'default'           => '',
    'searchable'        => false,//can be true
    'filterable'        => false,//can be true
    'comparable'        => false,//can be true
    'visible_on_front'  => false,//can be true
    'unique'            => false,
    'position'            => 60,//put any number here
));

$installer->endSetup();

I can't figure out what I am supposed to use as the source - could anyone please advise?

The system.xml that sets up the serialized array I want to use for the attribute is the following:

<fields>
    <descriptions translate="label">
        <label>Product Descriptions</label>
        <frontend_model>runwaysale_productdescription/adminhtml_descriptions</frontend_model>
        <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
        <sort_order>0</sort_order>
        <show_in_default>1</show_in_default>
        <show_in_website>1</show_in_website>
        <show_in_store>1</show_in_store>
    </descriptions>
</fields>

I have already tested, and the config section works without any issues, I now need to add an attribute field to the products' attributes.

Any help would be massively appreciated.

1

0

Your Answer

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

Browse other questions tagged or ask your own question.