Example #1
0
 public function addAttribute($entityTypeId, $code, array $attr)
 {
     if (isset($this->_flatEntityTables[$entityTypeId]) && $this->_flatTableExist($this->_flatEntityTables[$entityTypeId])) {
         $this->_addFlatAttribute($this->_flatEntityTables[$entityTypeId], $code, $attr);
     } else {
         parent::addAttribute($entityTypeId, $code, $attr);
     }
     return $this;
 }
<?php

/** @var $this Mage_Core_Model_Resource_Setup */
$_installer = $this;
$_installer->startSetup();
$_setup = new Mage_Eav_Model_Entity_Setup('core_setup');
try {
    $_setup->removeAttribute('catalog_product', 'allow_shipping');
} catch (Exception $_e) {
    Mage::logException($_e);
}
$_setup->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'allow_shipping', array('group' => 'Rental Shipping Method', 'type' => 'int', 'backend' => '', 'frontend' => '', 'label' => 'Customer can chose Shipping Method on Product Page', 'input' => 'select', 'source' => 'eav/entity_attribute_source_boolean', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'is_visible' => true, 'required' => false, 'user_defined' => true, 'default' => '', 'is_searchable' => false, 'is_filterable' => false, 'is_comparable' => false, 'is_visible_on_front' => true, 'is_visible_in_advanced_search' => false, 'is_used_in_product_listing' => false, 'unique' => false));
$_installer->endSetup();
 * @package    RewardsPoint2
 * @copyright  Copyright (c) 2009 J2T DESIGN. (http://www.j2t-design.com)
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
$installer = $this;
$attributeInfoFb = Mage::getResourceModel('eav/entity_attribute_collection')->setCodeFilter('rewardsocial_facebook')->getFirstItem();
$attributeInfoGp = Mage::getResourceModel('eav/entity_attribute_collection')->setCodeFilter('rewardsocial_google')->getFirstItem();
$attributeInfoTt = Mage::getResourceModel('eav/entity_attribute_collection')->setCodeFilter('rewardsocial_twitter')->getFirstItem();
$entityTypeId = Mage::getModel('eav/entity')->setType('catalog_product')->getTypeId();
$attributeGroup = Mage::getResourceModel('eav/entity_attribute_set_collection')->addFieldToFilter('attribute_set_name', array('eq' => 'Default'))->addFieldToFilter('entity_type_id', array('eq' => $entityTypeId))->getFirstItem();
if (!$attributeGroup->getAttributeSetId()) {
    $installer->addAttributeSet(Mage_Catalog_Model_Product::ENTITY, 'Default');
    $attributeGroup = Mage::getResourceModel('eav/entity_attribute_set_collection')->addFieldToFilter('attribute_set_name', array('eq' => 'Default'))->addFieldToFilter('entity_type_id', array('eq' => $entityTypeId))->getFirstItem();
}
if (!$attributeInfoFb->getAttributeId() && !$attributeInfoGp->getAttributeId() && !$attributeInfoTt->getAttributeId() && $attributeGroup->getAttributeSetId()) {
    $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
    $installer->startSetup();
    /**
     * Adding Different Attributes
     */
    // adding attribute group
    $setup->addAttributeGroup('catalog_product', 'Default', 'J2T Reward Social', 1000);
    $entityTypeId = $installer->getEntityTypeId('catalog_product');
    $attributeSetId = $installer->getDefaultAttributeSetId($entityTypeId);
    $attributeGroupId = $installer->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);
    // the attribute added will be displayed under the group/tab Special Attributes in product edit page
    $setup->addAttribute('catalog_product', 'rewardsocial_facebook', array('group' => 'J2T Reward Social', 'input' => 'text', 'type' => 'text', 'label' => 'Facebook Like Points', 'frontend_class' => 'validate-digits', 'backend' => '', 'visible' => 1, 'required' => 0, 'user_defined' => 0, 'searchable' => 0, 'filterable' => 0, 'comparable' => 0, 'visible_on_front' => 0, 'visible_in_advanced_search' => 0, 'is_html_allowed_on_front' => 0, 'used_in_product_listing' => true, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL));
    $setup->addAttribute('catalog_product', 'rewardsocial_google', array('group' => 'J2T Reward Social', 'input' => 'text', 'type' => 'text', 'label' => 'Google + Points', 'frontend_class' => 'validate-digits', 'backend' => '', 'visible' => 1, 'required' => 0, 'user_defined' => 0, 'searchable' => 0, 'filterable' => 0, 'comparable' => 0, 'visible_on_front' => 0, 'visible_in_advanced_search' => 0, 'is_html_allowed_on_front' => 0, 'used_in_product_listing' => true, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL));
    $setup->addAttribute('catalog_product', 'rewardsocial_twitter', array('group' => 'J2T Reward Social', 'input' => 'text', 'type' => 'text', 'label' => 'Twitter Share Points', 'frontend_class' => 'validate-digits', 'backend' => '', 'visible' => 1, 'required' => 0, 'user_defined' => 0, 'searchable' => 0, 'filterable' => 0, 'comparable' => 0, 'visible_on_front' => 0, 'visible_in_advanced_search' => 0, 'is_html_allowed_on_front' => 0, 'used_in_product_listing' => true, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL));
    $installer->endSetup();
}
 * on any other Magento edition except Magento enterprise edition.
 * aheadWorks does not provide extension support in case of
 * incorrect edition usage.
 * =================================================================
 *
 * @category   AW
 * @package    AW_Onsale
 * @version    2.4.0
 * @copyright  Copyright (c) 2010-2012 aheadWorks Co. (http://www.aheadworks.com)
 * @license    http://ecommerce.aheadworks.com/AW-LICENSE.txt
 */
$installer = $this;
$installer->startSetup();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->removeAttribute('catalog_product', 'aw_os_product_display');
$setup->removeAttribute('catalog_product', 'aw_os_product_position');
$setup->removeAttribute('catalog_product', 'aw_os_product_image');
$setup->removeAttribute('catalog_product', 'aw_os_product_text');
$setup->removeAttribute('catalog_product', 'aw_os_category_display');
$setup->removeAttribute('catalog_product', 'aw_os_category_position');
$setup->removeAttribute('catalog_product', 'aw_os_category_image');
$setup->removeAttribute('catalog_product', 'aw_os_category_text');
$setup->addAttribute('catalog_product', 'aw_os_product_display', array('backend' => 'onsale/entity_attribute_backend_boolean_config', 'source' => 'onsale/entity_attribute_source_boolean_config', 'label' => 'Display', 'group' => 'Product Label', 'input' => 'select', 'class' => 'validate-digit', 'global' => true, 'visible' => true, 'required' => true, 'user_defined' => false, 'default' => '0', 'visible_on_front' => false));
$setup->addAttribute('catalog_product', 'aw_os_product_position', array('backend' => 'onsale/entity_attribute_backend_position', 'source' => 'onsale/entity_attribute_source_position', 'label' => 'Position', 'group' => 'Product Label', 'input' => 'select', 'class' => 'validate-digit', 'global' => true, 'visible' => true, 'required' => true, 'user_defined' => false, 'default' => 'BR', 'visible_on_front' => false));
$setup->addAttribute('catalog_product', 'aw_os_product_image', array('backend' => 'onsale/entity_attribute_backend_image', 'label' => 'Image', 'group' => 'Product Label', 'input' => 'image', 'class' => 'validate-digit', 'global' => true, 'visible' => true, 'required' => false, 'user_defined' => false, 'default' => '', 'visible_on_front' => false));
$setup->addAttribute('catalog_product', 'aw_os_product_text', array('source' => 'onsale/entity_attribute_source_text', 'group' => 'Product Label', 'label' => 'Text', 'note' => 'You can use predefined values in this field. Please refer to extension manual.', 'input' => 'text', 'class' => '', 'global' => true, 'visible' => true, 'required' => false, 'user_defined' => false, 'default' => 'CUSTOM', 'visible_on_front' => false));
$setup->addAttribute('catalog_product', 'aw_os_category_display', array('backend' => 'onsale/entity_attribute_backend_boolean_config', 'source' => 'onsale/entity_attribute_source_boolean_config', 'label' => 'Display', 'group' => 'Category Label', 'input' => 'select', 'class' => 'validate-digit', 'global' => true, 'visible' => true, 'required' => true, 'user_defined' => false, 'default' => '0', 'visible_on_front' => false));
$setup->addAttribute('catalog_product', 'aw_os_category_position', array('backend' => 'onsale/entity_attribute_backend_position', 'source' => 'onsale/entity_attribute_source_position', 'label' => 'Position', 'group' => 'Category Label', 'input' => 'select', 'class' => 'validate-digit', 'global' => true, 'visible' => true, 'required' => true, 'user_defined' => false, 'default' => 'BR', 'visible_on_front' => false));
$setup->addAttribute('catalog_product', 'aw_os_category_image', array('backend' => 'onsale/entity_attribute_backend_image', 'label' => 'Image', 'group' => 'Category Label', 'input' => 'image', 'class' => 'validate-digit', 'global' => true, 'visible' => true, 'required' => false, 'user_defined' => false, 'default' => '', 'visible_on_front' => false));
$setup->addAttribute('catalog_product', 'aw_os_category_text', array('source' => 'onsale/entity_attribute_source_text', 'group' => 'Category Label', 'label' => 'Text', 'note' => 'You can use predefined values in this field. Please refer to extension manual.', 'input' => 'text', 'class' => '', 'global' => true, 'visible' => true, 'required' => false, 'user_defined' => false, 'default' => 'CUSTOM', 'visible_on_front' => false));
$installer->endSetup();
<?php

/**
 * Pan_JewelryDesigner Extension
 *
 * @category  Pan
 * @package   Pan_JewelryDesigner
 * @copyright Copyright (c) 2014 August Ash, Inc. (http://www.augustash.com)
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
 * @author    August Ash Team <*****@*****.**>
 */
$installer = new Mage_Eav_Model_Entity_Setup();
// start transaction
$installer->startSetup();
/**
 * Is Dangle Charm (is_dangle_charm)
 *
 * Helps identify beads that are "danglers" b/c their
 * registration point should be closer to the top than
 * the center of the image
 */
$installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'is_dangle_charm', array('group' => 'Jewelry Designer', 'input' => 'boolean', 'label' => 'Is Dangle Charm?', 'visible' => true, 'required' => false, 'visible_on_front' => false, 'user_defined' => true, 'default_value' => false, 'used_in_product_listing' => true, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL));
/**
 * Bracelet has spots for clips? (bracelet_has_clip_spots)
 *
 * Helps identify bracelets that may not have spots for clips
 * and therefore do not have exclusion zones
 */
$installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'bracelet_has_clip_spots', array('group' => 'Jewelry Designer', 'input' => 'boolean', 'label' => 'Bracelet has spots for clips?', 'visible' => true, 'required' => false, 'visible_on_front' => false, 'user_defined' => true, 'default_value' => true, 'used_in_product_listing' => true, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL));
// end transaction
$installer->endSetup();
<?php

/**
 * Mirasvit
 *
 * This source file is subject to the Mirasvit Software License, which is available at http://mirasvit.com/license/.
 * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
 * If you wish to customize this module for your needs
 * Please refer to http://www.magentocommerce.com for more information.
 *
 * @category  Mirasvit
 * @package   Sphinx Search Ultimate
 * @version   2.3.1
 * @revision  602
 * @copyright Copyright (C) 2013 Mirasvit (http://mirasvit.com/)
 */
//2.2.9 - 2.2.9.1
$installer = $this;
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();
try {
    $setup->addAttribute('catalog_category', 'searchindex_weight', array('group' => 'General Information', 'input' => 'text', 'type' => 'text', 'label' => 'Search Weight', 'backend' => '', 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE));
    $setup->addAttribute('catalog_product', 'searchindex_weight', array('group' => 'General', 'input' => 'text', 'type' => 'text', 'label' => 'Search Weight', 'backend' => '', 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE));
} catch (Exception $e) {
    Mage::logException($e);
}
$installer->endSetup();
Example #7
0
 public function testAction()
 {
     $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
     $entity_type = Mage::getSingleton("eav/entity_type")->loadByCode("catalog_product");
     $entity_type_id = $entity_type->getId();
     $collection = Mage::getModel("eav/entity_attribute")->getCollection()->addFieldToFilter("entity_type_id", $entity_type_id)->addFieldToFilter("attribute_code", "giftwrap");
     if (count($collection)) {
         $collection->getFirstItem()->delete();
     }
     if (!count($collection)) {
         $data = array('group' => 'General', 'type' => 'int', 'input' => 'select', 'label' => 'Wrappable', 'backend' => '', 'frontend' => '', 'source' => 'giftwrap/attribute_wrappable', 'visible' => 1, 'required' => 1, 'user_defined' => 1, 'is_searchable' => 1, 'is_filterable' => 0, 'is_comparable' => 1, 'is_visible_on_front' => 0, 'is_visible_in_advanced_search' => 1, 'used_for_sort_by' => 0, 'used_in_product_listing' => 1, 'used_for_price_rules' => 1, 'is_used_for_promo_rules' => 1, 'position' => 2, 'unique' => 0, 'is_configurable' => 1, 'default' => 0, 'is_global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE);
         $setup->addAttribute('catalog_product', 'giftwrap', $data);
         $entity_type_id = $setup->getEntityTypeId('catalog_product');
         $data['entity_type_id'] = $entity_type_id;
         $attribute = Mage::getModel("eav/entity_attribute")->setData($data)->setId($setup->getAttributeId('catalog_product', 'giftwrap'));
         $attribute->save();
     }
 }
/**
* aheadWorks Co.
*
* NOTICE OF LICENSE
*
* This source file is subject to the EULA
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://ecommerce.aheadworks.com/AW-LICENSE.txt
*
* =================================================================
*                 MAGENTO EDITION USAGE NOTICE
* =================================================================
* This package designed for Magento COMMUNITY edition
* aheadWorks does not guarantee correct work of this extension
* on any other Magento edition except Magento COMMUNITY edition.
* aheadWorks does not provide extension support in case of
* incorrect edition usage.
* =================================================================
*
* @category   AW
* @package    AW_Ajaxcartpro
* @version    3.0.0
* @copyright  Copyright (c) 2010-2012 aheadWorks Co. (http://www.aheadworks.com)
* @license    http://ecommerce.aheadworks.com/AW-LICENSE.txt
*/
$installer = $this;
$installer->startSetup();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttribute('catalog_product', 'aw_acp_disabled', array('backend' => 'giftmessage/entity_attribute_backend_boolean_config', 'input' => 'select', 'label' => 'Disable Ajax Cart Pro for that product', 'source' => 'eav/entity_attribute_source_boolean', 'required' => false, 'entity_model' => 'catalog/product', 'group' => 'ACP Options', 'global' => true, 'visible' => true, 'user_defined' => false, 'default' => '0', 'visible_on_front' => false));
$installer->endSetup();
<?php

$installer = $this;
$installer->startSetup();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttribute('catalog_product', 'cjm_imageswitcher', array('group' => 'Images', 'input' => 'text', 'type' => 'text', 'label' => 'Image Switch Code', 'backend' => '', 'frontend' => '', 'visible' => false, 'required' => false, 'user_defined' => false, 'searchable' => false, 'filterable' => false, 'comparable' => false, 'visible_on_front' => false, 'visible_in_advanced_search' => false, 'is_html_allowed_on_front' => false, 'apply_to' => 'configurable', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 'note' => 'Do Not Edit!'));
$setup->addAttribute('catalog_product', 'cjm_moreviews', array('group' => 'Images', 'input' => 'text', 'type' => 'text', 'label' => 'More Views Code', 'backend' => '', 'frontend' => '', 'visible' => false, 'required' => false, 'user_defined' => false, 'searchable' => false, 'filterable' => false, 'comparable' => false, 'visible_on_front' => false, 'visible_in_advanced_search' => false, 'is_html_allowed_on_front' => false, 'apply_to' => 'configurable', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 'note' => 'Do Not Edit!'));
$tableName = Mage::getSingleton('core/resource')->getTableName('catalog_product_entity_media_gallery_value');
$installer->run("ALTER TABLE  `" . $tableName . "` ADD  `defaultimg` TINYINT( 4 ) UNSIGNED NOT NULL DEFAULT  '0'");
$installer->endSetup();
<?php

$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttribute('order', 'mw_customercomment', array('label' => 'Customer Comment', 'type' => 'text', 'input' => 'text', 'visible' => true, 'required' => false, 'position' => 1));
<?php

$this->startSetup();
$this->run('');
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttribute(Mage_Catalog_Model_Category::ENTITY, Vikont_Fitment_Helper_Data::ARI_ACTIVITY_ATTRIBUTE_CODE, array('group' => 'ARI', 'type' => 'int', 'label' => 'ARI activity', 'input' => 'select', 'source' => 'fitment/source_ari_activity', 'backend' => '', 'visible' => true, 'required' => false, 'visible_on_front' => false, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'note' => ''));
$this->endSetup();
<?php

$installer = $this;
$installer->startSetup();
$newFields = array('delivery_datetime' => array('type' => 'datetime', 'required' => 0, 'input' => 'text', 'default' => ''));
$order = Mage::getModel('sales/order');
$entityType = $order->getResource()->getEntityType();
$entityTypeId = $entityType->getId();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
foreach ($newFields as $attributeName => $attributeDefs) {
    $setup->addAttribute($entityTypeId, $attributeName, array('position' => 1, 'type' => $attributeDefs['type'], 'required' => $attributeDefs['required'], 'input' => $attributeDefs['input'], 'default' => $attributeDefs['default']));
}
$installer->endSetup();
<?php

$installer = $this;
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();
$setup->removeAttribute('catalog_product', 'use_manufacturer_part_no');
$setup->addAttribute('catalog_product', 'use_manufacturer_part_no', array('group' => 'General', 'input' => 'select', 'type' => 'int', 'label' => 'Use Manufacturer Part No.', 'source' => 'eav/entity_attribute_source_boolean', 'backend' => 'eav/entity_attribute_backend_array', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'visible' => true, 'required' => false, 'default_value' => '0'));
$installer->endSetup();
<?php

$installer = $this;
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();
$setup->addAttribute('catalog_product', 'unm_disable_add_to_cart', array('group' => 'General', 'input' => 'select', 'type' => 'int', 'label' => 'Disable Add To Cart', 'source' => 'eav/entity_attribute_source_boolean', 'backend' => 'eav/entity_attribute_backend_array', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'visible' => true, 'required' => false, 'default_value' => '0'));
$installer->endSetup();
<?php

$installer = $this;
$installer->startSetup();
// ========================================
// criacao dos atributos dos produtos
// ========================================
if (Mage::getVersion() >= 1.5) {
    $setup = Mage::getModel('catalog/resource_setup', 'core_setup');
} else {
    $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
}
$setup->addAttribute('catalog_product', 'novaPontoCom_importError', array('type' => 'text', 'backend' => '', 'frontend' => '', 'label' => 'Import Error - NovaPontoCom', 'input' => 'text', '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, 'apply_to' => 'simple,bundle,grouped,configurable', 'is_configurable' => false));
$installer->endSetup();
Example #16
0
<?php

$installer = $this;
$installer->startSetup();
if (version_compare(Mage::getVersion(), '1.5.0', '>=')) {
    $setup = new Mage_Sales_Model_Resource_Setup('core_setup');
} else {
    $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
}
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote'), 'pickup_datetime', 'DATETIME');
$setup->addAttribute('quote', 'pickup_datetime', array('type' => 'static', 'visible' => false));
$installer->run("ALTER TABLE {$this->getTable('sales_flat_order')} \n  MODIFY  `shipping_description` varchar(1500);\n");
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order'), 'pickup_datetime', 'DATETIME');
$setup->addAttribute('order', 'pickup_datetime', array('type' => 'static', 'visible' => false));
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_grid'), 'pickup_datetime', 'DATETIME');
$setup->addAttribute('order', 'pickup_datetime', array('type' => 'static', 'visible' => false));
$installer->endSetup();
<?php

$installer = $this;
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();
$setup->addAttribute('catalog_category', 'erp_id', array('group' => 'Display Settings', 'input' => 'text', 'type' => 'varchar', 'label' => 'ERP Id', 'visible' => true, 'required' => false, 'user_defined' => true, 'visible_on_front' => false, 'unique' => true, 'sort_order' => 500));
$installer->endSetup();
Example #18
0
<?php

$installer = $this;
$installer->startSetup();
$installer->run("\r\nCREATE TABLE IF NOT EXISTS `{$this->getTable('rewardsref_referral')}` (\r\n  `rewardsref_referral_id` int(11) unsigned NOT NULL auto_increment,\r\n  `referral_parent_id` int(11) unsigned NOT NULL,\r\n  `referral_child_id` int(11) unsigned default NULL,\r\n  `referral_email` varchar(255) NOT NULL default '',\r\n  `referral_name` varchar(255) default NULL,\r\n  `referral_status` tinyint(1) default '0',\r\n  `created_ts` timestamp NOT NULL default CURRENT_TIMESTAMP,\r\n  PRIMARY KEY  (`rewardsref_referral_id`),\r\n  UNIQUE KEY `email` (`referral_email`),\r\n  UNIQUE KEY `son_id` (`referral_child_id`),\r\n  KEY `FK_customer_entity` (`referral_parent_id`),\r\n  CONSTRAINT `rewardsref_referral_child_fk1` \r\n    FOREIGN KEY (`referral_child_id`) REFERENCES `{$this->getTable('customer_entity')}` (`entity_id`),\r\n  CONSTRAINT `rewardsref_referral_parent_fk` \r\n    FOREIGN KEY (`referral_parent_id`) REFERENCES `{$this->getTable('customer_entity')}` (`entity_id`)\r\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\r\n\r\n");
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttribute('customer', 'rewardsref_notify_on_referral', array('label' => Mage::helper('rewardsref')->__('Notify on Referral'), 'type' => 'int', 'input' => 'select', 'visible' => true, 'required' => false, 'position' => 1, 'default' => 1, 'default_value' => 1, 'source' => "rewardsref/attribute_notify"));
$installer->endSetup();
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
$installer = $this;
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();
/**
 * Adding a lookup table for Divido
 */
$conn = $installer->getConnection();
$lookup_table = $conn->newTable($installer->getTable('callback/lookup'));
$lookup_table->addColumn('lookup_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), 'Id')->addColumn('salt', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => false), 'Salt')->addColumn('quote_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('nullable' => false, 'unsigned' => true), 'Quote ID');
$lookup_table->addIndex($installer->getIdxName('callback/lookup', array('quote_id'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), array('quote_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE));
$conn->createTable($lookup_table);
/**
 * Adding Divido attributes to products
 */
$groupName = 'Divido';
$entityTypeId = $setup->getEntityTypeId('catalog_product');
$defaultAttrSetId = $setup->getDefaultAttributeSetId($entityTypeId);
// adding attribute group
$setup->addAttributeGroup($entityTypeId, $defaultAttrSetId, $groupName, 1000);
$groupId = $setup->getAttributeGroupId($entityTypeId, $defaultAttrSetId, $groupName);
// Add attributes
$planOptionAttrCode = 'divido_plan_option';
$setup->addAttribute($entityTypeId, $planOptionAttrCode, array('label' => 'Available on finance', 'type' => 'varchar', 'input' => 'select', 'backend' => 'eav/entity_attribute_backend_array', 'frontend' => '', 'source' => 'pay/source_option', 'default' => 'default_plans', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'visible' => true, 'required' => true, 'user_defined' => true, 'searchable' => true, 'filterable' => false, 'comparable' => false, 'visible_on_front' => true, 'unique' => false));
$planOptionAttrId = $setup->getAttributeId($entityTypeId, $planOptionAttrCode);
$setup->addAttributeToGroup($entityTypeId, $defaultAttrSetId, $groupId, $planOptionAttrId, null);
$planSelectionAttrCode = 'divido_plan_selection';
$setup->addAttribute($entityTypeId, $planSelectionAttrCode, array('label' => 'Selected plans', 'type' => 'varchar', 'input' => 'multiselect', 'backend' => 'eav/entity_attribute_backend_array', 'frontend' => '', 'source' => 'pay/source_defaultprodplans', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'visible' => true, 'required' => false, 'user_defined' => true, 'searchable' => true, 'filterable' => false, 'comparable' => false, 'visible_on_front' => true, 'unique' => false));
$planSelectionAttrId = $setup->getAttributeId($entityTypeId, $planSelectionAttrCode);
$setup->addAttributeToGroup($entityTypeId, $defaultAttrSetId, $groupId, $planSelectionAttrId, null);
$installer->endSetup();
<?php

$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttribute('catalog_product', 'featured', array('label' => 'Featured', 'type' => 'int', 'input' => 'select', 'source' => 'eav/entity_attribute_source_boolean', 'visible' => true, 'required' => false, 'position' => 10));
 * 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.
 *
 * @category   Phoenix
 * @package    Phoenix_CashOnDelivery
 * @copyright  Copyright (c) 2010 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
$this->startSetup();
$this->_conn->addColumn($this->getTable('sales_flat_quote'), 'cod_fee', 'decimal(12,4)');
$this->_conn->addColumn($this->getTable('sales_flat_quote'), 'base_cod_fee', 'decimal(12,4)');
$this->_conn->addColumn($this->getTable('sales_flat_quote_address'), 'cod_fee', 'decimal(12,4)');
$this->_conn->addColumn($this->getTable('sales_flat_quote_address'), 'base_cod_fee', 'decimal(12,4)');
$eav = new Mage_Eav_Model_Entity_Setup('sales_setup');
$eav->addAttribute('order', 'cod_fee', array('type' => 'decimal'));
$eav->addAttribute('order', 'base_cod_fee', array('type' => 'decimal'));
$eav->addAttribute('order', 'cod_fee_invoiced', array('type' => 'decimal'));
$eav->addAttribute('order', 'base_cod_fee_invoiced', array('type' => 'decimal'));
//$eav->addAttribute('order', 'cod_fee_refunded', array('type' => 'decimal',));
//$eav->addAttribute('order', 'base_cod_fee_refunded', array('type' => 'decimal'));
//$eav->addAttribute('order', 'cod_fee_canceled', array('type' => 'decimal',));
//$eav->addAttribute('order', 'base_cod_fee_canceled', array('type' => 'decimal'));
$eav->addAttribute('invoice', 'cod_fee', array('type' => 'decimal'));
$eav->addAttribute('invoice', 'base_cod_fee', array('type' => 'decimal'));
//$eav->addAttribute('creditmemo', 'cod_fee', array('type' => 'decimal',));
//$eav->addAttribute('creditmemo', 'base_cod_fee', array('type' => 'decimal'));
$this->endSetup();
<?php

$installer = $this;
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();
/**
 * Adding Different Attributes
 */
// adding attribute group
//$setup->addAttributeGroup('catalog_product', 'Default', 'General', 1000);
// the attribute added will be displayed under the group/tab Special Attributes in product edit page
$setup->addAttribute('catalog_product', 'creareseo_discontinued', array('group' => 'General', 'type' => 'varchar', 'input' => 'select', 'backend' => 'eav/entity_attribute_backend_array', 'label' => 'Discontinued', 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'searchable' => 0, 'filterable' => 0, 'comparable' => 0, 'visible_on_front' => 1, 'visible_in_advanced_search' => 0, 'is_html_allowed_on_front' => 0, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 'option' => array('value' => array('none' => array('No Redirect (404)'), 'category' => array('301 Redirect to Category'), 'homepage' => array('301 Redirect to Homepage'), 'product' => array('301 Redirect to Product SKU')))));
$setup->addAttribute('catalog_product', 'creareseo_discontinued_product', array('group' => 'General', 'type' => 'varchar', 'input' => 'text', 'backend' => '', 'label' => 'Redirect to Product SKU', 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'searchable' => 0, 'filterable' => 0, 'comparable' => 0, 'visible_on_front' => 1, 'visible_in_advanced_search' => 0, 'is_html_allowed_on_front' => 0, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE));
$installer->endSetup();
 *
 * ==============================================================
 *                 MAGENTO EDITION USAGE NOTICE
 * ==============================================================
 * This package designed for Magento COMMUNITY edition
 * Apptha does not guarantee correct work of this extension
 * on any other Magento edition except Magento COMMUNITY edition.
 * Apptha does not provide extension support in case of
 * incorrect edition usage.
 * ==============================================================
 *
 * @category    Apptha
 * @package     Apptha_Marketplace
 * @version     1.2.3
 * @author      Apptha Team <*****@*****.**>
 * @copyright   Copyright (c) 2014 Apptha. (http://www.apptha.com)
 * @license     http://www.apptha.com/LICENSE.txt
 *
 */
$installer = $this;
$installer->startSetup();
$installer = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->addAttribute('customer', 'login_provider', array('label' => 'Provider', 'type' => 'varchar', 'input' => 'text', 'visible' => true, 'required' => false));
$eavConfig = Mage::getSingleton('eav/config');
$attribute = $eavConfig->getAttribute('customer', 'login_provider');
/**
 * enable all action
 * */
$attribute->setData('used_in_forms', array('adminhtml_customer', 'customer_account_create', 'customer_account_edit'));
$attribute->save();
$installer->endSetup();
<?php

/**
 * This source file is subject to the MIT License.
 * It is also available through http://opensource.org/licenses/MIT
 *
 * @category  PedroTeixeira
 * @package   PedroTeixeira_Correios
 * @author    Pedro Teixeira <*****@*****.**>
 * @copyright 2015 Pedro Teixeira (http://pedroteixeira.io)
 * @license   http://opensource.org/licenses/MIT MIT
 * @link      https://github.com/pedro-teixeira/correios
 */
/** @var $installer Mage_Core_Model_Resource_Setup */
$installer = $this;
$installer->startSetup();
/* @var $installer Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$codigo = 'posting_days';
$config = array('position' => 1, 'required' => 0, 'label' => 'Prazo de Postagem', 'type' => 'int', 'input' => 'text', 'apply_to' => 'simple,bundle,grouped,configurable', 'note' => 'O prazo total é o Prazo dos Correios acrescido do maior Prazo de Postagem dos produtos no carrinho.');
$setup->addAttribute('catalog_product', $codigo, $config);
$installer->endSetup();
Example #25
0
<?php

$installer = $this;
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();
$setup->addAttributeGroup('catalog_product', 'Default', 'Special Attributes', 1000);
$setup->addAttribute('catalog_product', 'test_attribute', array('group' => 'Special Attributes', 'label' => 'Slide', 'type' => 'int', 'input' => 'select', 'backend' => '', 'frontend' => '', 'source' => 'ainstainer_homepage/source_slide', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'visible' => true, 'required' => false, 'user_defined' => true, 'searchable' => false, 'filterable' => false, 'comparable' => false, 'visible_on_front' => true, 'visible_in_advanced_search' => true, 'unique' => false));
$installer->endSetup();
<?php

$installer = $this;
$installer->startSetup();
$installer->run("\n\n\nDROP TABLE IF EXISTS {$this->getTable('magik_socialbar')};\nCREATE TABLE IF NOT EXISTS {$this->getTable('magik_socialbar')} (id int not null auto_increment, name varchar(200),show_socialsites varchar(255), social_block_code text, show_pagelocation varchar(150), \n\t\t\t      show_category varchar(255),store_id varchar(100), primary key(id));\n\n\nDROP TABLE IF EXISTS {$this->getTable('magik_socialsites')};\nCREATE TABLE IF NOT EXISTS {$this->getTable('magik_socialsites')} (id int not null auto_increment, name varchar(255) NOT NULL, favicon varchar(255) NOT NULL,\n  url text NOT NULL,\n  primary key(id));\n\nINSERT INTO {$this->getTable('magik_socialsites')} VALUES (1,'Delicious','delicious.png','http://delicious.com/post?url=PERMALINK&amp;title=TITLE&amp;notes=EXCERPT'),\n(2,'Digg','digg.png','http://digg.com/submit?phase=2&amp;url=PERMALINK&amp;title=TITLE&amp;bodytext=EXCERPT'),\n(3,'Facebook','facebook.png','http://www.facebook.com/share.php?u=PERMALINK&amp;t=TITLE'),\n(4,'LinkedIn','linkedin.png','http://www.linkedin.com/shareArticle?mini=true&amp;url=PERMALINK&amp;title=TITLE&amp;source=BLOGNAME&amp;summary=EXCERPT'),\n(5,'Reddit','reddit.png','http://reddit.com/submit?url=PERMALINK&amp;title=TITLE'),(16,'RSS','rss.png','FEEDLINK'),\n(6,'StumbleUpon','stumbleupon.png','http://www.stumbleupon.com/submit?url=PERMALINK&amp;title=TITLE'),\n(7,'Tumblr','tumblr.png','http://www.tumblr.com/share?v=3&amp;u=PERMALINK&amp;t=TITLE&amp;s=EXCERPT'),\n(8,'Twitter','twitter.png','http://twitter.com/home?status=TITLE%20-%20PERMALINK'),\n('9','Pinterest','PinExt.png','http://pinterest.com/pin/create/link/?url=PERMALINK&amp;media=Productmedia&amp;description=DESCRIPTION'),\n('10','Google Plus','googleplus.png','https://plus.google.com/share?url=PERMALINK');\n");
$installer->endSetup();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttribute('catalog_product', 'product_socialbar', array('group' => 'Magik Socialbar', 'type' => 'int', 'backend' => '', 'frontend' => '', 'label' => 'Disable Social Bar for this product', 'input' => 'boolean', 'class' => '', 'source' => '', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'visible' => true, 'required' => false, 'user_defined' => false, 'default' => '0', 'searchable' => false, 'filterable' => false, 'comparable' => false, 'visible_on_front' => false, 'unique' => false, 'is_configurable' => false));
Example #27
0
<?php

/**
 * Created by PhpStorm.
 * User: Евгений
 * Date: 27.01.2016
 * Time: 21:18
 */
$installer = $this;
$installer->startSetup();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttribute('order', 'ref', array('position' => 1, 'input' => 'text', 'type' => 'varchar', 'label' => 'ref number', 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'global' => 1, 'visible_on_front' => 0));
$installer->endSetup();
 * Apptha does not guarantee correct work of this extension
 * on any other Magento edition except Magento COMMUNITY edition.
 * Apptha does not provide extension support in case of
 * incorrect edition usage.
 * ==============================================================
 *
 * @category    Apptha
 * @package     Apptha_Marketplace
 * @version     1.7
 * @author      Apptha Team <*****@*****.**>
 * @copyright   Copyright (c) 2015 Apptha. (http://www.apptha.com)
 * @license     http://www.apptha.com/LICENSE.txt
 * 
 */
/**
 * This file is used to create table for "Seller Vacation Mode"
 */
$installer = $this;
/**
 *  @var $installer Mage_Core_Model_Resource_Setup 
*/
$installer->startSetup();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$applyTo = array('simple', 'configurable');
$setup->updateAttribute('catalog_product', 'seller_shipping_option', 'apply_to', join(',', $applyTo));
$setup->updateAttribute('catalog_product', 'national_shipping_price', 'apply_to', join(',', $applyTo));
$setup->updateAttribute('catalog_product', 'international_shipping_price', 'apply_to', join(',', $applyTo));
$setup->updateAttribute('catalog_product', 'default_country', 'apply_to', join(',', $applyTo));
$setup->addAttribute('catalog_product', 'is_assign_product', array('group' => 'Special Attributes', 'input' => 'text', 'type' => 'text', 'label' => 'Is assign product', 'backend' => '', 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'searchable' => 1, 'filterable' => 0, 'comparable' => 1, 'visible_on_front' => 1, 'visible_in_advanced_search' => 0, 'is_html_allowed_on_front' => 0, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL));
$setup->addAttribute('catalog_product', 'assign_product_id', array('group' => 'Special Attributes', 'input' => 'text', 'type' => 'text', 'label' => 'Assign product id', 'backend' => '', 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'searchable' => 1, 'filterable' => 0, 'comparable' => 1, 'visible_on_front' => 1, 'visible_in_advanced_search' => 0, 'is_html_allowed_on_front' => 0, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL));
$installer->endSetup();
 * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 * @version   1.0.2
 * @link      http://www.magentocommerce.com/magento-connect/debitpayment.html
 */
// load id for customer entity
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
$eid = $read->fetchRow("select entity_type_id from {$this->getTable('eav_entity_type')} where entity_type_code = 'customer'");
$customerTypeId = $eid['entity_type_id'];
$attrDate = array('type' => 'datetime', 'input' => 'label', 'label' => 'Account update date', 'global' => 1, 'required' => 0, 'default' => '', 'position' => '100');
$attrName = array('type' => 'varchar', 'input' => 'text', 'label' => 'Account Name', 'global' => 1, 'required' => 0, 'default' => '', 'position' => '100');
$attrNumber = array('type' => 'varchar', 'input' => 'text', 'label' => 'Account number', 'backend' => 'debit/entity_customer_attribute_backend_encrypted', 'global' => 1, 'required' => 0, 'default' => '', 'position' => '100');
$attrBlz = array('type' => 'varchar', 'input' => 'text', 'label' => 'Bank code', 'backend' => 'debit/entity_customer_attribute_backend_encrypted', 'global' => 1, 'required' => 0, 'default' => '', 'position' => '100');
$installer = $this;
$installer->startSetup();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttribute($customerTypeId, 'debit_payment_acount_update', $attrDate);
$setup->addAttribute($customerTypeId, 'debit_payment_acount_name', $attrName);
$setup->addAttribute($customerTypeId, 'debit_payment_acount_number', $attrNumber);
$setup->addAttribute($customerTypeId, 'debit_payment_acount_blz', $attrBlz);
// Since 1.4.2.0 this is necessary!
$eavConfig = Mage::getSingleton('eav/config');
$attribute = $eavConfig->getAttribute($customerTypeId, 'debit_payment_acount_update');
$attribute->setData('used_in_forms', array('customer_account_edit', 'customer_account_create', 'adminhtml_customer'));
$attribute->save();
$attribute = $eavConfig->getAttribute($customerTypeId, 'debit_payment_acount_name');
$attribute->setData('used_in_forms', array('customer_account_edit', 'customer_account_create', 'adminhtml_customer'));
$attribute->save();
$attribute = $eavConfig->getAttribute($customerTypeId, 'debit_payment_acount_number');
$attribute->setData('used_in_forms', array('customer_account_edit', 'customer_account_create', 'adminhtml_customer'));
$attribute->save();
$attribute = $eavConfig->getAttribute($customerTypeId, 'debit_payment_acount_blz');
<?php

$installer = $this;
$installer->startSetup();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttribute('catalog_category', 'fabia_custom_cat_desc5', array('group' => 'Fabia Menu Settings', 'label' => 'Custom Category Description For Version 5', 'note' => 'All fields will be showed for only top-level categories and mega menu type. This settings will be available only for version 5.', 'type' => 'text', 'input' => 'textarea', 'visible' => true, 'required' => false, 'backend' => '', 'frontend' => '', 'searchable' => false, 'filterable' => false, 'comparable' => false, 'user_defined' => true, 'visible_on_front' => true, 'wysiwyg_enabled' => true, 'is_html_allowed_on_front' => true, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE));
$installer->endSetup();