<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category   Mage
 * @package    Mage_Catalog
 * @copyright  Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */


/**
 * Catalog entity setup
 *
 * @category   Mage
 * @package    Mage_Catalog
 * @author     Magento Core Team <core@magentocommerce.com>
 */
class Mage_Catalog_Model_Resource_Eav_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup
{

    /**
     * Enter description here...
     *
     * @return array
     */
    public function getDefaultEntities()
    {
        return array(
            'catalog_category' => array(
                'entity_model'      => 'catalog/category',
                'attribute_model'   => 'catalog/resource_eav_attribute',
                'table'             => 'catalog/category',
                'attributes'        => array(
                    'name' => array(
                        'type'              => 'varchar',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'Name',
                        'input'             => 'text',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => true,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                    'is_active' => array(
                        'type'              => 'int',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'Is Active',
                        'input'             => 'select',
                        'class'             => '',
                        'source'            => 'eav/entity_attribute_source_boolean',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                    'url_key' => array(
                        'label'             => 'URL key',
                        'backend'           => 'catalog/category_attribute_backend_urlkey',
                        'required'          => false,
                    ),
                    'description' => array(
                        'type'              => 'text',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'Description',
                        'input'             => 'textarea',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                    'image' => array(
                        'type'              => 'varchar',
                        //'backend'          => 'catalog/category_attribute_backend_image',
                        //'frontend'         => 'catalog/category_attribute_frontend_image',
                        'backend'           => 'catalog/category_attribute_backend_image',
                        'frontend'          => '',
                        'label'             => 'Image',
                        'input'             => 'image',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                    'meta_title' => array(
                        'type'              => 'varchar',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'Page Title',
                        'input'             => 'text',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                    'meta_keywords' => array(
                        'type'              => 'text',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'Meta Keywords',
                        'input'             => 'textarea',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                    'meta_description' => array(
                        'type'              => 'text',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'Meta Description',
                        'input'             => 'textarea',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                    'display_mode' => array(
                        'type'              => 'varchar',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'Display Mode',
                        'input'             => 'select',
                        'class'             => '',
                        'source'            => 'catalog/category_attribute_source_mode',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                    'landing_page' => array(
                        'type'              => 'int',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'CMS Block',
                        'input'             => 'select',
                        'class'             => '',
                        'source'            => 'catalog/category_attribute_source_page',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                    'is_anchor' => array(
                        'type'              => 'int',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'Is Anchor',
                        'input'             => 'select',
                        'class'             => '',
                        'source'            => 'eav/entity_attribute_source_boolean',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),

                    'path' => array(
                        'type'              => 'static',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'Path',
                        'input'             => '',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
                        'visible'           => false,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                    'position' => array(
                        'type'              => 'static',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'Position',
                        'input'             => '',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
                        'visible'           => false,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                    'all_children' => array(
                        'type'              => 'text',
                        //'backend'          => 'catalog/entity_category_attribute_backend_tree_children',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => '',
                        'input'             => '',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
                        'visible'           => false,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                    'path_in_store' => array(
                        'type'              => 'text',
                        //'backend'           => 'catalog/entity_category_attribute_backend_tree_path',
                        'backend'           => '',
                        'frontend'          => '',
                        'table'             => '',
                        'label'             => '',
                        'input'             => '',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
                        'visible'           => false,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                    'children' => array(
                        'type'              => 'text',
                        //'backend'           => 'catalog/entity_category_attribute_backend_tree_children',
                        'frontend'          => '',
                        'table'             => '',
                        'label'             => '',
                        'input'             => '',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
                        'visible'           => false,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                    'url_path' => array(
                        'type'              => 'varchar',
                        'frontend'          => '',
                        'table'             => '',
                        'label'             => '',
                        'input'             => '',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => false,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => true,
                    ),
                    'custom_design'         => array(
                        'type'              => 'varchar',
                        'label'             => 'Custom Design',
                        'frontend'          => '',
                        'table'             => '',
                        'input'             => 'select',
                        'class'             => '',
                        'source'            => 'core/design_source_design',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                    'custom_design_apply' => array(
                        'type'              => 'int',
                        'label'             => 'Apply To',
                        'frontend'          => '',
                        'table'             => '',
                        'input'             => 'select',
                        'class'             => '',
                        'source'            => 'core/design_source_apply',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                    'custom_design_from' => array(
                        'type'              => 'datetime',
                        'label'             => 'Active From',
                        'frontend'          => '',
                        'table'             => '',
                        'input'             => 'date',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                        'backend'           => 'eav/entity_attribute_backend_datetime',
                    ),
                    'custom_design_to' => array(
                        'type'              => 'datetime',
                        'label'             => 'Active To',
                        'frontend'          => '',
                        'table'             => '',
                        'input'             => 'date',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                        'backend'           => 'eav/entity_attribute_backend_datetime',
                    ),
                    'page_layout' => array(
                        'type'              => 'varchar',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'Page Layout',
                        'input'             => 'select',
                        'class'             => '',
                        'source'            => 'catalog/category_attribute_source_layout',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                    'custom_layout_update' => array(
                        'type'              => 'text',
                        'label'             => 'Custom Layout Update',
                        'frontend'          => '',
                        'table'             => '',
                        'input'             => 'textarea',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                    'level' => array(
                        'type'              => 'static',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'Level',
                        'input'             => '',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
                        'visible'           => false,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                    'children_count' => array(
                        'type'              => 'static',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'Children Count',
                        'input'             => '',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
                        'visible'           => false,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    )
                ),
            ),
            'catalog_product' => array(
                'entity_model'      => 'catalog/product',
                'attribute_model'   => 'catalog/resource_eav_attribute',
                'table'             => 'catalog/product',
                'attributes'        => array(
                    'name' => array(
                        'type'              => 'varchar',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'Name',
                        'input'             => 'text',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => true,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => true,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'visible_in_advanced_search' => true,
                        'unique'            => false,
                    ),
                    'description' => array(
                        'type'              => 'text',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'Description',
                        'input'             => 'textarea',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => true,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => true,
                        'filterable'        => false,
                        'comparable'        => true,
                        'visible_on_front'  => false,
                        'visible_in_advanced_search' => true,
                        'unique'            => false,
                    ),
                    'short_description' => array(
                        'type'              => 'text',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'Short Description',
                        'input'             => 'textarea',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => true,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => true,
                        'filterable'        => false,
                        'comparable'        => true,
                        'visible_on_front'  => false,
                        'visible_in_advanced_search' => true,
                        'unique'            => false,
                    ),
                    'sku' => array(
                        'type'              => 'static',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'SKU',
                        'input'             => 'text',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
                        'visible'           => true,
                        'required'          => true,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => true,
                        'filterable'        => false,
                        'comparable'        => true,
                        'visible_on_front'  => false,
                        'visible_in_advanced_search' => true,
                        'unique'            => true,
                    ),
                    'price' => array(
                        'group'             => 'Prices',
                        'type'              => 'decimal',
                        'backend'           => 'catalog/product_attribute_backend_price',
                        'frontend'          => '',
                        'label'             => 'Price',
                        'input'             => 'price',
                        'class'             => 'validate-number',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
                        'visible'           => true,
                        'required'          => true,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => true,
                        'filterable'        => true,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'visible_in_advanced_search' => true,
                        'unique'            => false,
                        'apply_to'          => 'simple,configurable,virtual',
                    ),
                    'special_price' => array(
                        'group'             => 'Prices',
                        'type'              => 'decimal',
                        'backend'           => 'catalog/product_attribute_backend_price',
                        'frontend'          => '',
                        'label'             => 'Special Price',
                        'input'             => 'price',
                        'class'             => 'validate-number',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                        'apply_to'          => 'simple,configurable,virtual',
                    ),
                    'special_from_date' => array(
                        'group'             => 'Prices',
                        'type'              => 'datetime',
                        'backend'           => 'catalog/product_attribute_backend_startdate',
                        'frontend'          => '',
                        'label'             => 'Special Price From Date',
                        'input'             => 'date',
                        'class'             => 'validate-date',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                        'apply_to'          => 'simple,configurable,virtual',
                    ),
                    'special_to_date' => array(
                        'group'             => 'Prices',
                        'type'              => 'datetime',
                        'backend'           => 'eav/entity_attribute_backend_datetime',
                        'frontend'          => '',
                        'label'             => 'Special Price To Date',
                        'input'             => 'date',
                        'class'             => 'validate-date',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                        'apply_to'          => 'simple,configurable,virtual',
                    ),
                    'cost' => array(
                        'group'             => 'Prices',
                        'type'              => 'decimal',
                        'backend'           => 'catalog/product_attribute_backend_price',
                        'frontend'          => '',
                        'label'             => 'Cost',
                        'input'             => 'price',
                        'class'             => 'validate-number',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => true,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                        'apply_to'          => 'simple,configurable,virtual',
                    ),
                    'weight' => array(
                        'type'              => 'decimal',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'Weight',
                        'input'             => 'text',
                        'class'             => 'validate-number',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
                        'visible'           => true,
                        'required'          => true,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                        'apply_to'          => 'simple',
                    ),
                    'manufacturer' => array(
                        'type'              => 'int',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'Manufacturer',
                        'input'             => 'select',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => true,
                        'default'           => '',
                        'searchable'        => true,
                        'filterable'        => true,
                        'comparable'        => true,
                        'visible_on_front'  => false,
                        'visible_in_advanced_search' => true,
                        'unique'            => false,
                        'apply_to'          => 'simple',
                    ),
                    'meta_title' => array(
                        'group'             => 'Meta Information',
                        'type'              => 'varchar',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'Meta Title',
                        'input'             => 'text',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                    'meta_keyword' => array(
                        'group'             => 'Meta Information',
                        'type'              => 'text',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'Meta Keywords',
                        'input'             => 'textarea',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                    'meta_description' => array(
                        'group'             => 'Meta Information',
                        'type'              => 'varchar',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'Meta Description',
                        'input'             => 'textarea',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                        'note'              => 'Maximum 255 chars',
                    ),
                    'image' => array(
                        'group'             => 'Images',
                        'type'              => 'varchar',
                        //'backend'           => 'catalog/entity_product_attribute_backend_image',
                        'frontend'          => 'catalog/product_attribute_frontend_image',
                        'label'             => 'Base Image',
                        'input'             => 'media_image',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                    'small_image' => array(
                        'group'             => 'Images',
                        'type'              => 'varchar',
                        //'backend'           => 'catalog/entity_product_attribute_backend_image',
                        'frontend'          => 'catalog/product_attribute_frontend_image',
                        'label'             => 'Small Image',
                        'input'             => 'media_image',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                    'thumbnail' => array(
                        'group'             => 'Images',
                        'type'              => 'varchar',
                        //'backend'           => 'catalog/entity_product_attribute_backend_image',
                        'frontend'          => 'catalog/product_attribute_frontend_image',
                        'label'             => 'Thumbnail',
                        'input'             => 'media_image',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                    'media_gallery' =>  array(
                        'group'             => 'Images',
                        'label'             => 'Media Gallery',
                        'input'             => 'gallery',
                        'backend'           => 'catalog/product_attribute_backend_media',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
                        'visible'           => true,
                        'required'          => true,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                    'old_id' => array(
                        'type'              => 'int',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => '',
                        'input'             => '',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
                        'visible'           => false,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                    'tier_price' => array(
                        'group'             => 'Prices',
                        'type'              => 'decimal',
                        'backend'           => 'catalog/product_attribute_backend_tierprice',
                        'label'             => 'Tier Price',
                        'input'             => 'text',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                        'apply_to'          => 'simple,configurable,virtual',
                    ),
                    'color' => array(
                        'type'              => 'int',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'Color',
                        'input'             => 'select',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => true,
                        'default'           => '',
                        'searchable'        => true,
                        'filterable'        => true,
                        'comparable'        => true,
                        'visible_on_front'  => false,
                        'visible_in_advanced_search' => true,
                        'unique'            => false,
                        'apply_to'          => 'simple',
                    ),
                    'news_from_date' => array(
                        'type'              => 'datetime',
                        'group'             => 'General',
                        'backend'           => 'eav/entity_attribute_backend_datetime',
                        'frontend'          => '',
                        'label'             => 'Set Product as New from Date',
                        'input'             => 'date',
                        'class'             => 'validate-date',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                     'news_to_date' => array(
                        'type'              => 'datetime',
                        'group'             => 'General',
                        'backend'           => 'eav/entity_attribute_backend_datetime',
                        'frontend'          => '',
                        'label'             => 'Set Product as New to Date',
                        'input'             => 'date',
                        'class'             => 'validate-date',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                    'gallery' => array(
                        'group'             => 'Images',
                        'type'              => 'varchar',
                        //'backend'           => 'catalog/entity_product_attribute_backend_gallery',
                        //'table'             => 'catalog_product_entity_gallery',
                        'frontend'          => '',
                        'label'             => 'Image Gallery',
                        'input'             => 'gallery',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                    'status' => array(
                        'type'              => 'int',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'Status',
                        'input'             => 'select',
                        'class'             => '',
                        'source'            => 'catalog/product_status',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
                        'visible'           => true,
                        'required'          => true,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => true,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'visible_in_advanced_search' => false,
                        'unique'            => false,
                    ),
                    'tax_class_id' => array(
                        'group'             => 'Prices',
                        'type'              => 'int',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'Tax Class',
                        'input'             => 'select',
                        'class'             => '',
                        'source'            => 'tax/class_source_product',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
                        'visible'           => true,
                        'required'          => true,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => true,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'visible_in_advanced_search' => true,
                        'unique'            => false,
                        'apply_to'          => 'simple,configurable,virtual',
                    ),
//                    'price_includes_tax' => array(
//                        'group'             => 'Prices',
//                        'type'              => 'int',
//                        'backend'           => '',
//                        'frontend'          => '',
//                        'label'             => 'Price Includes Tax',
//                        'input'             => 'select',
//                        'class'             => '',
//                        'source'            => 'tax/price_source_includes',
//                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
//                        'visible'           => true,
//                        'required'          => false,
//                        'user_defined'      => false,
//                        'default'           => '',
//                        'searchable'        => true,
//                        'filterable'        => false,
//                        'comparable'        => false,
//                        'visible_on_front'  => false,
//                        'visible_in_advanced_search' => true,
//                        'unique'            => false,
//                    ),
                    'price' => array(
                        'group'             => 'Prices',
                        'type'              => 'decimal',
                        'backend'           => 'catalog/product_attribute_backend_price',
                        'frontend'          => '',
                        'label'             => 'Price',
                        'input'             => 'price',
                        'class'             => 'validate-number',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
                        'visible'           => true,
                        'required'          => true,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => true,
                        'filterable'        => true,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'visible_in_advanced_search' => true,
                        'unique'            => false,
                        'apply_to'          => 'simple,configurable',
                    ),
                    'url_key' => array(
                        'label'             => 'URL key',
                        'backend'           => 'catalog/product_attribute_backend_urlkey',
                        'required'          => false,
                    ),
                    'url_path' => array(
                        'type'              => 'varchar',
                        'frontend'          => '',
                        'table'             => '',
                        'label'             => '',
                        'input'             => '',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => false,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => true,
                    ),
                    'minimal_price' => array(
                        'group'             => 'Prices',
                        'type'              => 'decimal',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'Minimal Price',
                        'input'             => 'price',
                        'class'             => 'validate-number',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => false,
                        'required'          => true,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                        'apply_to'          => 'simple,configurable',
                    ),
                    'visibility' => array(
                        'group'             => 'General',
                        'type'              => 'int',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'Visibility',
                        'input'             => 'select',
                        'class'             => '',
                        'source'            => 'catalog/product_visibility',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => true,
                        'user_defined'      => false,
                        'default'           => '4',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'visible_in_advanced_search' => false,
                        'unique'            => false,
                    ),
                    'custom_design' => array(
                        'type'              => 'varchar',
                        'label'             => 'Custom Design',
                        'frontend'          => '',
                        'table'             => '',
                        'input'             => 'select',
                        'class'             => '',
                        'source'            => 'core/design_source_design',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                        'group'             => 'Design',
                    ),
                    'custom_design_from' => array(
                        'type'              => 'datetime',
                        'label'             => 'Active From',
                        'frontend'          => '',
                        'table'             => '',
                        'input'             => 'date',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                        'backend'           => 'eav/entity_attribute_backend_datetime',
                        'group'             => 'Design',
                    ),
                    'custom_design_to' => array(
                        'type'              => 'datetime',
                        'label'             => 'Active To',
                        'frontend'          => '',
                        'table'             => '',
                        'input'             => 'date',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                        'backend'           => 'eav/entity_attribute_backend_datetime',
                        'group'             => 'Design',
                    ),
                    'custom_layout_update' => array(
                        'type'              => 'text',
                        'label'             => 'Custom Layout Update',
                        'frontend'          => '',
                        'table'             => '',
                        'input'             => 'textarea',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                        'group'             => 'Design',
                    ),
                    'category_ids' => array(
                        'type'              => 'static',
                        'backend'           => '',
                        'label'             => '',
                        'frontend'          => '',
                        'table'             => '',
                        'input'             => '',
                        'class'             => '',
                        'source'            => '',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
                        'visible'           => false,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => '',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'unique'            => false,
                    ),
                    'options_container' => array(
                        'group'             => 'Design',
                        'type'              => 'varchar',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'Display product options in',
                        'input'             => 'select',
                        'class'             => '',
                        'source'            => 'catalog/entity_product_attribute_design_options_container',
                        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'default'           => 'container2',
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'visible_in_advanced_search' => false,
                        'unique'            => false,
                    )
                ),
            ),
        );
    }

    /**
     * Enter description here...
     *
     * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Setup
     */
    public function convertOldTreeToNew()
    {
        if (!Mage::getModel('catalog/category')->load(1)->getId()) {
            Mage::getModel('catalog/category')->setId(1)->setPath(1)->save();
        }

        $categories = array();

        $select = $this->getConnection()->select();
        $select->from($this->getTable('catalog/category_entity'));
        $categories = $this->getConnection()->fetchAll($select);

        if (is_array($categories)) {
            foreach ($categories as $category) {
                $path = $this->_getCategoryPath($category);
                $path = array_reverse($path);
                $path = implode('/', $path);
                if ($category['entity_id'] != 1 && substr($path, 0, 2) != '1/') {
                    $path = "1/{$path}";
                }

                $this
                    ->getConnection()
                    ->update(
                        $this->getTable('catalog/category_entity'),
                        array('path' => $path),
                        "entity_id = {$category['entity_id']}"
                    );
            }
        }
        return $this;
    }

    /**
     * Enter description here...
     *
     * @param int $id
     * @return array
     */
    protected function _getCategoryEntityRow($id)
    {
        $select = $this->getConnection()->select();

        $select->from($this->getTable('catalog/category_entity'));
        $select->where('entity_id = ?', $id);

        return $this->getConnection()->fetchRow($select);
    }

    /**
     * Enter description here...
     *
     * @param array $category
     * @param array $path
     * @return string
     */
    protected function _getCategoryPath($category, $path = array())
    {
        $path[] = $category['entity_id'];

        if ($category['parent_id'] != 0) {
            $parentCategory = $this->_getCategoryEntityRow($category['parent_id']);

            if ($parentCategory)
                $path = $this->_getCategoryPath($parentCategory, $path);
        }

        return $path;
    }

    /**
     * Creates level values for categories and saves them
     *
     * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Setup
     */
    public function rebuildCategoryLevels()
    {
        $select = $this->getConnection()->select()
            ->from($this->getTable('catalog/category_entity'));

        $categories = $this->getConnection()->fetchAll($select);

        foreach ($categories as $category) {
            $level = count(explode('/', $category['path']))-1;
            $this
                ->getConnection()
                ->update(
                    $this->getTable('catalog/category_entity'),
                    array('level' => $level),
                    "entity_id = {$category['entity_id']}"
                );
        }
        return $this;
    }

}
