Skip to content

Instantly share code, notes, and snippets.

@sxalexander
Last active August 29, 2015 14:16
Show Gist options
  • Save sxalexander/1b2006f9045a836de0ef to your computer and use it in GitHub Desktop.
Save sxalexander/1b2006f9045a836de0ef to your computer and use it in GitHub Desktop.
$ magerun dev:setup:script:attribute catalog_product product_finish
<?php
$setup = new Mage_Catalog_Model_Resource_Setup('core_setup');
$attr = array (
'attribute_model' => NULL,
'backend' => NULL,
'type' => 'int',
'table' => NULL,
'frontend' => NULL,
'input' => 'select',
'label' => 'Product Finish',
'frontend_class' => NULL,
'source' => 'eav/entity_attribute_source_table',
'required' => '0',
'user_defined' => '1',
'default' => '',
'unique' => '0',
'note' => NULL,
'input_renderer' => NULL,
'global' => '1',
'visible' => '1',
'searchable' => '1',
'filterable' => '2',
'comparable' => '1',
'visible_on_front' => '1',
'is_html_allowed_on_front' => '1',
'is_used_for_price_rules' => '0',
'filterable_in_search' => '0',
'used_in_product_listing' => '1',
'used_for_sort_by' => '1',
'is_configurable' => '1',
'apply_to' => 'configurable,simple',
'visible_in_advanced_search' => '1',
'position' => '0',
'wysiwyg_enabled' => '0',
'used_for_promo_rules' => '0',
'option' =>
array (
'values' =>
array (
0 => 'Polished Chrome',
1 => 'Blue & Polished Chrome',
2 => 'Green & Polished Chrome',
3 => 'Grey & Polished Chrome',
4 => 'Brushed Nickel',
5 => 'Brushed Chrome',
6 => 'Polished Brass',
7 => 'Oil Rubbed Bronze',
8 => 'Polished Nickel',
),
),
);
$setup->addAttribute('catalog_product', 'product_finish', $attr);
$attribute = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product', 'product_finish');
$attribute->setStoreLabels(array (
));
$attribute->save();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment