/** * Add color attribute to default attribute set and create option */ protected function setUp() { parent::setUp(); $setup = new Mage_Catalog_Model_Resource_Setup('catalog_setup'); $colorAttributeId = $setup->getAttributeId(Mage_Catalog_Model_Product::ENTITY, 'color'); $setup->addAttributeToSet(Mage_Catalog_Model_Product::ENTITY, self::DEFAULT_ATTRIBUTE_SET, self::GENERAL_ATTRIBUTE_GROUP, $colorAttributeId); $setup->addAttributeOption(array('attribute_id' => $colorAttributeId, 'values' => ['Octarin'])); $this->optionId = $setup->getConnection()->lastInsertId($setup->getTable('eav/attribute_option')); }
/** * mysql4-install-0.1.0 * * 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(); $installer->addAttribute($entityTypeId, 'deal_price', array('type' => 'varchar', 'backend' => '', 'frontend' => '', 'label' => 'Deal Price', 'note' => ' ', '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, 'is_configurable' => false)); $installer->addAttribute($entityTypeId, 'deal_start_time', array('type' => 'datetime', 'backend' => '', 'frontend' => '', 'label' => 'Deal Start Time', 'input' => 'date', '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, 'is_configurable' => false)); $installer->addAttribute($entityTypeId, 'deal_end_time', array('type' => 'datetime', 'backend' => '', 'frontend' => '', 'label' => 'Deal End Time', 'input' => 'date', '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, 'is_configurable' => false)); $installer->addAttribute($entityTypeId, 'deal_qty', array('label' => 'Deal Qty', 'type' => 'int', 'input' => 'text', 'source' => '', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'visible' => false, 'required' => false, 'user_defined' => true, 'searchable' => true, 'filterable' => true, 'filterable_in_search' => true, 'comparable' => true, 'visible_on_front' => false, 'visible_in_advanced_search' => false, 'unique' => false)); $installer->addAttribute($entityTypeId, 'deal_bought', array('label' => 'Deal Bought', 'type' => 'int', 'input' => 'text', 'source' => '', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'visible' => false, 'required' => false, 'user_defined' => true, 'searchable' => true, 'default' => '0', 'filterable' => true, 'filterable_in_search' => true, 'comparable' => true, 'visible_on_front' => false, 'visible_in_advanced_search' => false, 'unique' => false)); $installer->addAttribute($entityTypeId, 'deal_status', array('label' => 'Deal Status', 'type' => 'int', 'input' => 'boolean', 'source' => '', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'visible' => false, 'required' => false, 'user_defined' => true, 'searchable' => true, 'filterable' => true, 'filterable_in_search' => true, 'comparable' => true, 'visible_on_front' => false, 'visible_in_advanced_search' => false, 'unique' => false)); $attributesCode = array('deal_price', 'deal_start_time', 'deal_end_time', 'deal_qty', 'deal_bought', 'deal_status'); $attributeSetCollection = Mage::getResourceModel('eav/entity_attribute_set_collection')->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId()); foreach ($attributeSetCollection as $attribute) { $name = $attribute->getAttributeSetName(); $installer->addAttributeGroup($entityTypeId, $name, 'Daily Deals', 100); foreach ($attributesCode as $code) { $installer->addAttributeToSet($entityTypeId, $name, 'Daily Deals', $code); } } $installer->endSetup();
<?php $setup = new Mage_Catalog_Model_Resource_Setup('core_setup'); $attr = array('attribute_model' => NULL, 'backend' => NULL, 'type' => 'int', 'table' => NULL, 'frontend' => NULL, 'input' => 'select', 'label' => 'Google Shopping Condition', 'frontend_class' => NULL, 'source' => 'aligent_feeds/source_condition', 'required' => '0', 'user_defined' => '1', 'default' => '', 'unique' => '0', 'note' => NULL, 'input_renderer' => NULL, 'global' => '1', 'visible' => '1', 'searchable' => '0', 'filterable' => '0', 'comparable' => '0', 'visible_on_front' => '0', 'is_html_allowed_on_front' => '1', 'is_used_for_price_rules' => '0', 'filterable_in_search' => '0', 'used_in_product_listing' => '1', 'used_for_sort_by' => '0', 'is_configurable' => '0', 'apply_to' => NULL, 'visible_in_advanced_search' => '0', 'position' => '0', 'wysiwyg_enabled' => '0', 'used_for_promo_rules' => '0', 'search_weight' => '1'); $setup->addAttribute('catalog_product', 'gshopping_condition', $attr); $aAttributeSetIds = $setup->getAllAttributeSetIds('catalog_product'); $iAttributeId = $setup->getAttributeId('catalog_product', 'gshopping_condition'); foreach ($aAttributeSetIds as $iAttributeSetId) { $iAttributeGroupId = $setup->getAttributeGroupId('catalog_product', $iAttributeSetId, 'Meta Information'); $setup->addAttributeToSet('catalog_product', $iAttributeSetId, $iAttributeGroupId, $iAttributeId, 6); }
<?php /** * mysql4-upgrade-2.0.1-2.0.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(); $installer->addAttribute($entityTypeId, 'deal_category_id', array('type' => 'varchar', 'backend' => '', 'frontend' => '', 'label' => 'Deal Category Id', 'note' => ' ', '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, 'is_configurable' => false)); $attributeSetCollection = Mage::getResourceModel('eav/entity_attribute_set_collection')->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId()); foreach ($attributeSetCollection as $attribute) { $installer->addAttributeToSet($entityTypeId, $attribute->getAttributeSetName(), 'Daily Deals', 'deal_category_id'); } $installer->endSetup();
<?php /** * mysql4-upgrade-0.1.1-0.1.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(); $installer->addAttribute($entityTypeId, 'deal_statuses', array('type' => 'varchar', 'backend' => '', 'frontend' => '', 'label' => 'Deal Statuses', 'note' => ' ', '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, 'is_configurable' => false)); $attributeSetCollection = Mage::getResourceModel('eav/entity_attribute_set_collection')->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId()); foreach ($attributeSetCollection as $attribute) { $installer->addAttributeToSet($entityTypeId, $attribute->getAttributeSetName(), 'Daily Deals', 'deal_statuses'); } $installer->endSetup();
<?php /** * mysql4-upgrade-2.1.1-2.1.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(); $installer->addAttribute('catalog_product', 'deals_choice_category', array('type' => 'int', 'label' => 'Deals choice from category', 'input' => 'select', 'source' => 'eav/entity_attribute_source_boolean', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'visible' => false, 'required' => false, 'user_defined' => false, 'default' => '0', 'visible_on_front' => false, 'apply_to' => 'downloadable,simple,virtual')); $entityTypeId = Mage::getModel('eav/entity')->setType('catalog_product')->getTypeId(); $attributeSetCollection = Mage::getResourceModel('eav/entity_attribute_set_collection')->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId()); foreach ($attributeSetCollection as $set) { $installer->addAttributeToSet($entityTypeId, $set->getAttributeSetName(), '', 'deals_choice_category'); } $installer->endSetup();
/* * @copyright Copyright (C) 2015 Gamuza Technologies (http://www.gamuza.com.br/) * @author Eneias Ramos de Melo <*****@*****.**> */ $installer = new Mage_Catalog_Model_Resource_Setup('pagarme_setup'); $installer->startSetup(); if (!$installer->getAttribute(Mage_Catalog_Model_Product::ENTITY, 'pagarme_subscription_plan', 'attribute_id')) { $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}
<?php /** * mysql4-upgrade-2.1.0-2.1.1 * * 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(); $installer->addAttribute('catalog_product', 'choice_type_dealstime', array('type' => 'int', 'label' => 'Choice type dealstime', 'input' => 'select', 'source' => 'eav/entity_attribute_source_boolean', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'visible' => false, 'required' => false, 'user_defined' => false, 'default' => '1', 'visible_on_front' => false, 'apply_to' => 'downloadable,simple,virtual')); $installer->addAttribute('catalog_product', 'deal_update_days_product', array('type' => 'varchar', 'label' => 'Deal Products will be run and update each', 'input' => 'multiselect', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'visible' => false, 'required' => false, 'user_defined' => true, 'default' => "", 'backend_model' => 'eav/entity_attribute_backend_array', 'source' => 'Webinse_DailyDeals_Model_Entity_Attribute_Source_Days', 'apply_to' => 'downloadable,simple,virtual')); $entityTypeId = Mage::getModel('eav/entity')->setType('catalog_product')->getTypeId(); $attributeSetCollection = Mage::getResourceModel('eav/entity_attribute_set_collection')->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId()); foreach ($attributeSetCollection as $set) { $installer->addAttributeToSet($entityTypeId, $set->getAttributeSetName(), '', 'choice_type_dealstime'); $installer->addAttributeToSet($entityTypeId, $set->getAttributeSetName(), '', 'deal_update_days_product'); } $installer->endSetup();
<?php /** * mysql4-upgrade-0.1.3-0.1.4 * * 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(); $installer->addAttribute($entityTypeId, 'old_special_price', array('type' => 'varchar', 'backend' => '', 'frontend' => '', 'label' => 'Old special price', 'note' => ' ', '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, 'is_configurable' => false)); $installer->addAttribute($entityTypeId, 'old_special_date_from', array('type' => 'datetime', 'backend' => '', 'frontend' => '', 'label' => 'Old special date from', 'note' => ' ', 'input' => 'date', '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, 'is_configurable' => false)); $installer->addAttribute($entityTypeId, 'old_special_date_to', array('type' => 'datetime', 'backend' => '', 'frontend' => '', 'label' => 'Old special date to', 'note' => ' ', 'input' => 'date', '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, 'is_configurable' => false)); $attNames = array('old_special_price', 'old_special_date_from', 'old_special_date_to'); $attributeSetCollection = Mage::getResourceModel('eav/entity_attribute_set_collection')->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId()); foreach ($attributeSetCollection as $attribute) { foreach ($attNames as $attName) { $installer->addAttributeToSet($entityTypeId, $attribute->getAttributeSetName(), 'Daily Deals', $attName); } } $installer->endSetup();