Created
April 30, 2015 10:02
-
-
Save standa/fdfc87af4008b8f367f0 to your computer and use it in GitHub Desktop.
magento_category_attribute.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This script creates a custom category attribute 'H1 Test' | |
* | |
* @link http://fabrizioballiano.net/2012/02/08/create-a-custom-category-attribute-in-magento/ | |
* | |
* @author Standa | |
* @version 2015-02-12 | |
*/ | |
require_once '../app/Mage.php'; | |
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID)); | |
$installer = Mage::getModel('catalog/resource_eav_mysql4_setup'); //new Mage_Catalog_Model_Resource_Eav_Mysql4_Setup; | |
$attribute = array( | |
'type' => 'text', | |
'label'=> 'H1 Title', | |
'input' => 'text', | |
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, | |
'visible' => true, | |
'required' => false, | |
'user_defined' => true, | |
'default' => "", | |
'group' => "General Information" | |
); | |
$installer->addAttribute('catalog_category', 'h1', $attribute); | |
$installer->endSetup(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment