$installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'pagarme_subscription_plan', array('type' => 'int', 'input' => 'select', 'backend' => '', 'frontend' => '', 'label' => 'Plano da Pagarme', 'class' => '', 'source' => 'pagarme/product_attribute_plan', '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, 'apply_to' => '', 'is_configurable' => false, 'used_in_product_listing' => true, 'option' => array('values' => array()))); $attributeId = $installer->getAttributeId(Mage_Catalog_Model_Product::ENTITY, 'pagarme_subscription_plan'); $defaultSetId = $installer->getAttributeSetId(Mage_Catalog_Model_Product::ENTITY, 'default'); $installer->addAttributeGroup(Mage_Catalog_Model_Product::ENTITY, $defaultSetId, 'Pagarme'); //find out the id of the new group $groupId = $installer->getAttributeGroup(Mage_Catalog_Model_Product::ENTITY, $defaultSetId, 'Pagarme', 'attribute_group_id'); //assign the attribute to the group and set if ($attributeId > 0) { $installer->addAttributeToSet(Mage_Catalog_Model_Product::ENTITY, $defaultSetId, $groupId, $attributeId); } $attributes = array('price', 'special_price', 'special_from_date', 'special_to_date', 'minimal_price', 'cost', 'tier_price', 'weight', 'tax_class_id'); foreach ($attributes as $attributeCode) { $applyTo = explode(',', $installer->getAttribute(Mage_Catalog_Model_Product::ENTITY, $attributeCode, 'apply_to')); if (!in_array('subscription', $applyTo)) { $applyTo[] = 'subscription'; $installer->updateAttribute(Mage_Catalog_Model_Product::ENTITY, $attributeCode, 'apply_to', join(',', $applyTo)); } } } function addSubscriptionPlans($installer) { $table = $installer->getTable('pagarme_subscription_plans'); $sqlBlock = <<<SQLBLOCK CREATE TABLE IF NOT EXISTS {$table} ( id int(11) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 COMMENT='Pagarme Subscription Plans'; SQLBLOCK; $installer->run($sqlBlock); $installer->getConnection()->addColumn($table, 'remote_id', array('type' => Varien_Db_Ddl_Table::TYPE_INTEGER, 'length' => 255, 'nullable' => false, 'comment' => 'Remote ID'));
<?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 Magento * @package Mage_Catalog * @subpackage Test * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $installer = new Mage_Catalog_Model_Resource_Setup('catalog_setup'); $installer->updateAttribute('catalog_product', 'weight', 'is_filterable', 1);
<?php /** * mysql4-upgrade-1.3.1-1.3.2 * * PHP Version 5.5.9 * * @category Webinse * @package Webinse_DailyDeals * @author Webinse Team <*****@*****.**> * @copyright 2015 Webinse Ltd. (https://www.webinse.com) * @license The Open Software License 3.0 * @link http://opensource.org/licenses/OSL-3.0 */ $installer = new Mage_Catalog_Model_Resource_Setup('core_setup'); $installer->startSetup(); $entityTypeId = Mage::getModel('eav/entity')->setType('catalog_product')->getTypeId(); $attributesCode = array('deal_price', 'deal_start_time', 'deal_end_time', 'deal_qty', 'deal_bought', 'deal_status', 'deal_statuses', 'old_special_price', 'old_special_date_from', 'old_special_date_to'); foreach ($attributesCode as $attribute) { $installer->updateAttribute($entityTypeId, $attribute, 'apply_to', 'downloadable,simple,virtual'); } $installer->endSetup();