doug48
9/28/2015 - 6:39 AM

setup script for attribute, a full list of options

setup script for attribute, a full list of options

<?php

/* Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */
$this->startSetup();

// this is the setup we need
$setup = Mage::getResourceModel('catalog/eav_mysql4_setup', 'core_setup');

// attribute code
$attrCode = 's48_product_options_label';

// try load existing attribute, just so we don't create it twice and blow it all up
$attrId = $setup->getAttributeId(Mage_Catalog_Model_Product::ENTITY, $attrCode);

if ( ! $attrId ) {
$setup->addAttribute(
Mage_Catalog_Model_Product::ENTITY,
$attrCode,
array(
"type" => 'varchar',
"group" => 'General',
"backend" => '',
"frontend" => '',
"label" => 'Product Options Label',
"input" => 'text',
"class" => '',
"source" => '',
"is_global" => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
"visible" => true,
"required" => false,
"user_defined" => true,
"default" => 0,
"searchable" => false,
"filterable" => false,
"comparable" => false,
"visible_on_front" => true,
"used_in_product_listing" => true,
'apply_to' => 'simple,virtual',
"unique" => false,
"note" => '',
"position" => 0,
"sort_order" => 2,
)
);
}

$this->endSetup();