protected function _addAttribute($attributeCode) { $data = array('entity_type_id' => 4, 'attribute_code' => $attributeCode, 'backend_type' => 'text', 'frontend_input' => 'textarea', 'frontend_label' => 'messed up description ', 'is_required' => 0, 'is_user_defined' => 1, 'is_global' => 0, 'note' => 'delete me'); $setup = new \Mage_Eav_Model_Entity_Setup('core_setup'); $setup->removeAttribute('4', $attributeCode); $eav = $this->_getEavAttributeResourceModel()->setData($data)->save(); }
/** * @param InputInterface $input * @param OutputInterface $output */ protected function execute(InputInterface $input, OutputInterface $output) { $this->detectMagento($output, true); if ($this->initMagento()) { $entityType = $input->getArgument('entityType'); try { $attributes = \Mage::getModel('eav/config')->getEntityAttributeCodes($entityType); } catch (\Mage_Core_Exception $e) { throw new \InvalidArgumentException($e->getMessage()); } $setup = new \Mage_Eav_Model_Entity_Setup('core_setup'); foreach ($input->getArgument('attributeCode') as $attributeCode) { if (!in_array($attributeCode, $attributes)) { $message = sprintf('Attribute: "%s" does not exist for entity type: "%s"', $attributeCode, $entityType); $output->writeln(sprintf('<comment>%s</comment>', $message)); } else { $setup->removeAttribute($entityType, $attributeCode); $output->writeln(sprintf('<info>Successfully removed attribute: "%s" from entity type: "%s"</info>', $attributeCode, $entityType)); } } } }
<?php $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $setup->removeAttribute('catalog_product', 'mw_storecredit'); $setup->addAttribute('catalog_product', 'mw_storecredit', array('label' => 'Store credit', 'type' => 'int', 'input' => 'text', 'visible' => true, 'required' => false, 'position' => 10)); $installer = $this; $resource = Mage::getSingleton('core/resource'); $installer->startSetup(); $installer->run("\r\n\r\n\tDROP TABLE IF EXISTS {$resource->getTableName('storecreditpro/history')};\r\n\tCREATE TABLE {$resource->getTableName('storecreditpro/history')} (\r\n\t `history_id` int(11) unsigned NOT NULL auto_increment,\r\n\t `customer_id` int(11) unsigned NOT NULL default '0',\r\n\t `transaction_type` int(2) unsigned NOT NULL,\r\n\t `amount` decimal(12,4) DEFAULT '0.0000',\r\n\t `balance` decimal(12,4) DEFAULT '0.0000',\r\n\t `transaction_params` text DEFAULT '',\r\n\t `transaction_detail` text DEFAULT '',\r\n\t `order_id` int(11) NOT NULL,\r\n\t `transaction_time` datetime,\r\n\t `expired_time` datetime,\r\n\t `remaining_credit` int(11) DEFAULT '0',\r\n\t `status` tinyint(2) DEFAULT '1',\r\n\t \r\n\t PRIMARY KEY (`history_id`)\r\n\t) ENGINE=InnoDB DEFAULT CHARSET=utf8;\r\n\t\r\n\tDROP TABLE IF EXISTS {$resource->getTableName('storecreditpro/customer')};\r\n\tCREATE TABLE {$resource->getTableName('storecreditpro/customer')} (\r\n\t `customer_id` int(11) unsigned NOT NULL,\r\n\t `credit_balance` decimal(12,4) NULL DEFAULT '0.0000',\r\n\t `credit_updated_notification` tinyint(2) DEFAULT '1',\r\n\t \r\n\t PRIMARY KEY (`customer_id`)\r\n\t) ENGINE=InnoDB DEFAULT CHARSET=utf8;\r\n\r\n\t\r\n\t\r\n"); $sql_quote = "\r\n\t\tALTER TABLE `{$resource->getTableName('sales/quote')}` \r\n\t\t\r\n\t\tADD `mw_storecredit` decimal(12,4) NULL DEFAULT '0.0000',\r\n\t\tADD `mw_storecredit_checkout_max` decimal(12,4) NULL DEFAULT '0.0000',\r\n\t\tADD `mw_storecredit_checkout_min` decimal(12,4) NULL DEFAULT '0.0000',\r\n\t\tADD `mw_storecredit_buy_credit` decimal(12,4) NULL DEFAULT '0.0000',\r\n\t\tADD `mw_storecredit_discount` decimal(12,4) NULL DEFAULT '0.0000',\r\n\t\tADD `mw_storecredit_discount_show` decimal(12,4) NULL DEFAULT '0.0000'\r\n\t\t\r\n\t\t"; $installer->run($sql_quote); $sql_quote_address = "\r\n\t\tALTER TABLE `{$resource->getTableName('sales/quote_address')}` \r\n\t\t\r\n\t\tADD `mw_storecredit` decimal(12,4) NULL DEFAULT '0.0000',\r\n\t\tADD `mw_storecredit_buy_credit` decimal(12,4) NULL DEFAULT '0.0000',\r\n\t\tADD `mw_storecredit_discount` decimal(12,4) NULL DEFAULT '0.0000',\r\n\t\tADD `mw_storecredit_discount_show` decimal(12,4) NULL DEFAULT '0.0000'\r\n\t\t\r\n\t\t"; $installer->run($sql_quote_address); $sql_order = "\r\n\t\tALTER TABLE `{$resource->getTableName('sales/order')}` \r\n\t\t\r\n\t\tADD `mw_storecredit` decimal(12,4) NULL DEFAULT '0.0000',\r\n\t\tADD `mw_storecredit_buy_credit` decimal(12,4) NULL DEFAULT '0.0000',\r\n\t\tADD `mw_storecredit_discount` decimal(12,4) NULL DEFAULT '0.0000',\r\n\t\tADD `mw_storecredit_discount_show` decimal(12,4) NULL DEFAULT '0.0000'\r\n\t\t\r\n\t\t"; $installer->run($sql_order); $sql_invoice = "\r\n\t\tALTER TABLE `{$resource->getTableName('sales/invoice')}` \r\n\t\t\r\n\t\tADD `mw_storecredit` decimal(12,4) NULL DEFAULT '0.0000',\r\n\t\tADD `mw_storecredit_buy_credit` decimal(12,4) NULL DEFAULT '0.0000',\r\n\t\tADD `mw_storecredit_discount` decimal(12,4) NULL DEFAULT '0.0000',\r\n\t\tADD `mw_storecredit_discount_show` decimal(12,4) NULL DEFAULT '0.0000'\r\n\t\t\r\n\t\t"; $installer->run($sql_invoice); $sql_creditmemo = "\r\n\t\tALTER TABLE `{$resource->getTableName('sales/creditmemo')}` \r\n\t\t\r\n\t\tADD `mw_storecredit` decimal(12,4) NULL DEFAULT '0.0000',\r\n\t\tADD `mw_storecredit_check_refund` tinyint(2) DEFAULT '0',\r\n\t\tADD `mw_storecredit_buy_credit` decimal(12,4) NULL DEFAULT '0.0000',\r\n\t\tADD `mw_storecredit_discount` decimal(12,4) NULL DEFAULT '0.0000',\r\n\t\tADD `mw_storecredit_discount_show` decimal(12,4) NULL DEFAULT '0.0000'\r\n\t\t\r\n\t\t"; $installer->run($sql_creditmemo); $installer->endSetup();
<?php $installer = $this; $installer->startSetup(); $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); try { $setup->removeAttribute('catalog_product', 'shipping_method'); $setup->removeAttribute('catalog_product', 'allow_shipping'); } catch (Exception $e) { } $setup->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'allow_shipping', array('group' => 'Rental Shipping Method', 'type' => 'int', 'backend' => '', 'frontend' => '', 'label' => 'Customer Choses Shipping Method on Product Page', 'input' => 'boolean', 'source' => 'eav/entity_attribute_source_table', '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)); $setup->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'shipping_method', array('group' => 'Rental Shipping Method', 'type' => 'varchar', 'backend' => '', 'frontend' => '', 'source' => 'rshipping/entity_attribute_source_method', 'label' => 'Allowed Shipping Methods', 'input' => 'multiselect', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'is_visible' => true, 'required' => false, 'user_defined' => true, 'default' => '', 'is_searchable' => true, 'is_filterable' => false, 'is_comparable' => false, 'is_visible_on_front' => false, 'is_visible_in_advanced_search' => false, 'is_used_in_product_listing' => false, 'unique' => false, 'is_html_allowed_on_front' => true)); $installer->endSetup();
<?php $_installer = $this; $_installer->startSetup(); // Product attributes $_setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $_setup->removeAttribute(Mage_Catalog_Model_Product::ENTITY, 'reservation_cost'); $_setup->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'reservation_cost', array('group' => 'Prices', 'label' => 'Acquisition Cost', 'type' => 'decimal', 'input' => 'price', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE, 'visible' => true, 'required' => false, 'user_defined' => false, 'default' => '0.0000', 'apply_to' => 'reservation', 'visible_on_front' => false, 'position' => 100)); $_fieldList = array('reservation_cost'); $_applyTo = array('reservation', 'configurable', 'bundle', 'grouped'); foreach ($_fieldList as $_field) { $_installer->updateAttribute(Mage_Catalog_Model_Product::ENTITY, $_field, 'apply_to', implode(',', $_applyTo)); $_installer->updateAttribute(Mage_Catalog_Model_Product::ENTITY, $_field, 'is_global', Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE); } $_installer->endSetup();
<?php $installer = $this; $installer->startSetup(); // Product attributes $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $setup->removeAttribute(Mage_Catalog_Model_Product::ENTITY, 'use_global_dates'); $setup->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'use_global_dates', array('group' => 'Payperrentals', 'label' => 'Use Global Event Dates', 'type' => 'int', 'input' => 'select', 'source' => 'eav/entity_attribute_source_boolean', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE, 'visible' => true, 'required' => true, 'user_defined' => false, 'default' => 1, 'apply_to' => 'reservation', 'visible_on_front' => false, 'position' => 100)); $fieldList = array('use_global_dates'); $applyTo = array('reservation', 'configurable', 'bundle', 'grouped'); foreach ($fieldList as $field) { $installer->updateAttribute('catalog_product', $field, 'apply_to', implode(',', $applyTo)); $installer->updateAttribute('catalog_product', $field, 'is_global', Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE); } $installer->endSetup();
<?php $installer = $this; $installer->startSetup(); $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); try { $setup->removeAttribute('catalog_product', 'payperrentals_quantity'); $setup->removeAttribute('catalog_product', 'payperrentals_min_number'); $setup->removeAttribute('catalog_product', 'payperrentals_min_type'); $setup->removeAttribute('catalog_product', 'global_min_period'); $setup->removeAttribute('catalog_product', 'payperrentals_max_number'); $setup->removeAttribute('catalog_product', 'payperrentals_max_type'); $setup->removeAttribute('catalog_product', 'global_max_period'); $setup->removeAttribute('catalog_product', 'payperrentals_avail_number'); $setup->removeAttribute('catalog_product', 'payperrentals_avail_type'); $setup->removeAttribute('catalog_product', 'global_turnover_after'); $setup->removeAttribute('catalog_product', 'payperrentals_avail_numberb'); $setup->removeAttribute('catalog_product', 'payperrentals_avail_typeb'); $setup->removeAttribute('catalog_product', 'global_turnover_before'); $setup->removeAttribute('catalog_product', 'payperrentals_deposit'); $setup->removeAttribute('catalog_product', 'payperrentals_has_shipping'); $setup->removeAttribute('catalog_product', 'payperrentals_has_multiply'); $setup->removeAttribute('catalog_product', 'payperrentals_pricingtype'); $setup->removeAttribute('catalog_product', 'payperrentals_use_send_return'); $setup->removeAttribute('catalog_product', 'payperrentals_use_times'); $setup->removeAttribute('catalog_product', 'payperrentals_padding_days'); $setup->removeAttribute('catalog_product', 'disabled_with_message'); $setup->removeAttribute('catalog_product', 'res_excluded_daysweek'); $setup->removeAttribute('catalog_product', 'global_excludedays'); $setup->removeAttribute('catalog_product', 'allow_overbooking'); $setup->removeAttribute('catalog_product', 'res_excluded_dates');
<?php $installer = $this; $installer->startSetup(); // remove attributes $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $setup->removeAttribute('catalog_product', 'r4q_enabled'); $setup->removeAttribute('catalog_product', 'r4q_order_disabled'); $setup->removeAttribute('catalog_product', 'r4q_hide_price'); // add attributes $installer->addAttribute('catalog_product', 'r4q_enabled', array('backend' => '', 'type' => 'int', 'input' => 'select', 'source' => 'eav/entity_attribute_source_boolean', 'group' => 'Request4Quote', 'label' => 'Allow Quotation Requests', 'class' => '', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE, 'default_value' => 0, 'visible' => true, 'used_in_product_listing' => true, 'is_visible_on_front' => false, 'required' => false, 'user_defined' => false, 'default' => '0', 'apply_to' => 'simple,grouped,configurable,virtual,bundle,downloadable,reservation,membershippackage', 'visible_on_front' => false, 'position' => 1)); $installer->addAttribute('catalog_product', 'r4q_order_disabled', array('backend' => '', 'type' => 'int', 'input' => 'select', 'source' => 'eav/entity_attribute_source_boolean', 'group' => 'Request4Quote', 'label' => 'Disable Add To Cart', 'class' => '', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE, 'default_value' => 0, 'visible' => true, 'used_in_product_listing' => true, 'is_visible_on_front' => false, 'required' => false, 'user_defined' => false, 'default' => '0', 'apply_to' => 'simple,grouped,configurable,virtual,bundle,downloadable,reservation,membershippackage', 'visible_on_front' => false, 'position' => 2)); $installer->addAttribute('catalog_product', 'r4q_hide_price', array('backend' => '', 'type' => 'int', 'input' => 'select', 'source' => 'eav/entity_attribute_source_boolean', 'group' => 'Request4Quote', 'label' => 'Hide Price', 'class' => '', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE, 'default_value' => 0, 'visible' => true, 'used_in_product_listing' => true, 'is_visible_on_front' => false, 'required' => false, 'user_defined' => false, 'default' => '0', 'note' => 'Warning: if the price is hidden and the product is orderable, prices will show in checkout', 'apply_to' => 'simple,grouped,configurable,virtual,bundle,downloadable,reservation,membershippackage', 'visible_on_front' => false, 'position' => 3)); $installer->endSetup();
$installer->getConnection()->addColumn($installer->getTable('sales/order'), 'customercredit_hidden_tax', 'decimal(12,4) NULL'); $installer->getConnection()->addColumn($installer->getTable('sales/order'), 'base_customercredit_shipping_hidden_tax', 'decimal(12,4) NULL'); $installer->getConnection()->addColumn($installer->getTable('sales/order'), 'customercredit_shipping_hidden_tax', 'decimal(12,4) NULL'); //update sales_invoice $installer->getConnection()->addColumn($installer->getTable('sales/invoice'), 'base_customercredit_hidden_tax', 'decimal(12,4) NULL'); $installer->getConnection()->addColumn($installer->getTable('sales/invoice'), 'customercredit_hidden_tax', 'decimal(12,4) NULL'); //update sales_creditmemo $installer->getConnection()->addColumn($installer->getTable('sales/creditmemo'), 'base_customercredit_hidden_tax', 'decimal(12,4) NULL'); $installer->getConnection()->addColumn($installer->getTable('sales/creditmemo'), 'customercredit_hidden_tax', 'decimal(12,4) NULL'); //update sales_order_item $installer->getConnection()->addColumn($installer->getTable('sales/order_item'), 'base_customercredit_hidden_tax', 'decimal(12,4) NULL'); $installer->getConnection()->addColumn($installer->getTable('sales/order_item'), 'customercredit_hidden_tax', 'decimal(12,4) NULL'); //remove attribute //$setup->removeAttribute('catalog_product', 'credit_amount'); //$setup->removeAttribute('catalog_product', 'credit_value'); $setup->removeAttribute('catalog_product', 'storecredit_value'); $setup->removeAttribute('catalog_product', 'storecredit_from'); $setup->removeAttribute('catalog_product', 'storecredit_to'); $setup->removeAttribute('catalog_product', 'storecredit_dropdown'); $setup->removeAttribute('catalog_product', 'storecredit_type'); /* add Store Credit product attributes */ /** * add storecredit_value attribute */ $att_storecredit_value = array('group' => 'Prices', 'type' => 'decimal', 'input' => 'price', 'class' => 'validate-number', 'label' => 'Store Credit value', 'backend' => '', 'frontend' => '', 'source' => '', 'visible' => 1, 'user_defined' => 1, 'used_for_price_rules' => 1, 'position' => 4, 'unique' => 0, 'default' => '', 'sort_order' => 101); $setup->addAttribute('catalog_product', 'storecredit_value', $att_storecredit_value); $storecreditValue = Mage::getModel('catalog/resource_eav_attribute')->load($setup->getAttributeId('catalog_product', 'storecredit_value')); $storecreditValue->addData(array('is_global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 'is_required' => 1, 'apply_to' => array('customercredit'), 'is_configurable' => 1, 'is_searchable' => 0, 'is_visible_in_advanced_search' => 0, 'is_comparable' => 0, 'is_filterable' => 0, 'is_filterable_in_search' => 1, 'is_used_for_promo_rules' => 1, 'is_html_allowed_on_front' => 0, 'is_visible_on_front' => 0, 'used_in_product_listing' => 1, 'used_for_sort_by' => 0))->save(); //show description of Store Credit $attr = array('group' => 'Prices', 'type' => 'int', 'input' => 'boolean', 'label' => 'Show description of Store Credit value', 'backend' => '', 'frontend' => '', 'source' => '', 'visible' => 1, 'user_defined' => 1, 'used_for_price_rules' => 1, 'position' => 10, 'unique' => 0, 'default' => '', 'sort_order' => 101, 'is_global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 'is_required' => 0, 'apply_to' => array('customercredit'), 'is_configurable' => 1, 'is_searchable' => 0, 'is_visible_in_advanced_search' => 0, 'is_comparable' => 0, 'is_filterable' => 0, 'is_filterable_in_search' => 1, 'is_used_for_promo_rules' => 1, 'is_html_allowed_on_front' => 0, 'is_visible_on_front' => 0, 'used_in_product_listing' => 1, 'used_for_sort_by' => 0); /**
<?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();
<?php /** * @var $installer Mage_Core_Model_Resource_Setup */ $installer = $this; $installer->startSetup(); $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $setup->removeAttribute('customer', 'membershippackage_day'); $setup->removeAttribute('customer', 'membershippackage_month'); $setup->removeAttribute('customer', 'membershippackage_year'); $setup->removeAttribute('customer', 'membershippackage_payment'); /** fix sort orders */ $setup->updateAttribute('customer', 'membershippackage_name', array('position' => 10)); $setup->updateAttribute('customer', 'membershippackage_enabled', array('position' => 20)); $setup->updateAttribute('customer', 'membershippackage_cc', array('position' => 30)); /** Add membershippackage_ccexpiremonth, membershippackage_ccexpireyear, membershippackage_otherpayment, membershippackage_start, membershippackage_lastbilled, membershippackage_notes */ $setup->addAttribute('customer', 'membershippackage_ccmonth', array('type' => 'text', 'input' => 'select', 'group' => 'Membership', 'label' => 'CC Expires Month', 'global' => 1, 'visible' => 1, 'required' => 0, 'position' => 31, 'user_defined' => 1, 'default' => '0', 'visible_on_front' => 0, 'source' => 'payperrentals/customer_membershippackage_ccmonth')); if (version_compare(Mage::getVersion(), '1.4.2', '>=')) { Mage::getSingleton('eav/config')->getAttribute('customer', 'membershippackage_ccmonth')->setData('used_in_forms', array('adminhtml_customer_membership'))->save(); } $setup->addAttribute('customer', 'membershippackage_ccyear', array('type' => 'text', 'input' => 'select', 'group' => 'Membership', 'label' => 'CC Expires Year', 'global' => 1, 'visible' => 1, 'required' => 0, 'position' => 32, 'user_defined' => 1, 'default' => '0', 'visible_on_front' => 0, 'source' => 'payperrentals/customer_membershippackage_ccyear')); if (version_compare(Mage::getVersion(), '1.4.2', '>=')) { Mage::getSingleton('eav/config')->getAttribute('customer', 'membershippackage_ccyear')->setData('used_in_forms', array('adminhtml_customer_membership'))->save(); } $setup->addAttribute('customer', 'membershippackage_otherpayment', array('type' => 'varchar', 'input' => 'textarea', 'group' => 'Membership', 'label' => 'Other Payment Method Details', 'global' => 1, 'visible' => 1, 'required' => 0, 'position' => 40, 'user_defined' => 1, 'default' => '0', 'visible_on_front' => 0)); if (version_compare(Mage::getVersion(), '1.4.2', '>=')) { Mage::getSingleton('eav/config')->getAttribute('customer', 'membershippackage_otherpayment')->setData('used_in_forms', array('adminhtml_customer_membership'))->save(); } $setup->addAttribute('customer', 'membershippackage_start', array('type' => 'datetime', 'input' => 'datetime', 'group' => 'Membership', 'label' => 'Membership Start Date', 'global' => 1, 'visible' => 1, 'required' => 0, 'position' => 50, 'user_defined' => 1, 'default' => '0', 'visible_on_front' => 0)); if (version_compare(Mage::getVersion(), '1.4.2', '>=')) {
<?php $installer = $this; $installer->startSetup(); // 1. Remove display on homepage category attribute - Functionality no longer needed $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $setup->removeAttribute('catalog_category', 'display_on_homepage'); $installer->endSetup();
<?php /** * @var $installer Mage_Core_Model_Resource_Setup */ $installer = $this; $installer->startSetup(); // Product attributes $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $setup->removeAttribute('catalog_product', 'inventory_serialized'); $setup->addAttribute('catalog_product', 'inventory_serialized', array('group' => 'Rental Bookings', 'label' => 'Inventory Serialized', 'input' => 'text', 'type' => 'text', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE, 'visible' => false, 'default' => 'not_updated', 'required' => false, 'user_defined' => false, 'apply_to' => 'reservation', 'visible_on_front' => false, 'position' => 27)); $fieldList = array('inventory_serialized'); $applyTo = array('reservation', 'configurable', 'bundle', 'grouped'); foreach ($fieldList as $field) { $installer->updateAttribute('catalog_product', $field, 'apply_to', implode(',', $applyTo)); $installer->updateAttribute('catalog_product', $field, 'is_global', Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE); $installer->updateAttribute('catalog_product', $field, 'is_visible', false); } $installer->endSetup();
<?php $installer = $this; $installer->startSetup(); $inst = new Mage_Eav_Model_Entity_Setup('core_setup'); $inst->removeAttribute('catalog_product', 'prolabel_product_display'); $inst->removeAttribute('catalog_product', 'prolabel_product_position'); $inst->removeAttribute('catalog_product', 'prolabel_product_image'); $inst->removeAttribute('catalog_product', 'prolabel_product_text'); $inst->removeAttribute('catalog_product', 'prolabel_product_positionstyle'); $inst->removeAttribute('catalog_product', 'prolabel_product_fontstyle'); $inst->removeAttribute('catalog_product', 'prolabel_category_display'); $inst->removeAttribute('catalog_product', 'prolabel_category_position'); $inst->removeAttribute('catalog_product', 'prolabel_category_image'); $inst->removeAttribute('catalog_product', 'prolabel_category_text'); $inst->removeAttribute('catalog_product', 'prolabel_category_positionstyle'); $inst->removeAttribute('catalog_product', 'prolabel_category_fontstyle'); $inst->removeAttribute('catalog_product', 'prolabel_p_display'); $inst->removeAttribute('catalog_product', 'prolabel_p_position'); $inst->removeAttribute('catalog_product', 'prolabel_p_image'); $inst->removeAttribute('catalog_product', 'prolabel_p_text'); $inst->removeAttribute('catalog_product', 'prolabel_p_positionstyle'); $inst->removeAttribute('catalog_product', 'prolabel_p_fontstyle'); $inst->removeAttribute('catalog_product', 'prolabel_c_display'); $inst->removeAttribute('catalog_product', 'prolabel_c_position'); $inst->removeAttribute('catalog_product', 'prolabel_c_image'); $inst->removeAttribute('catalog_product', 'prolabel_c_text'); $inst->removeAttribute('catalog_product', 'prolabel_c_positionstyle'); $inst->removeAttribute('catalog_product', 'prolabel_c_fontstyle'); $installer->run("\n\nCREATE TABLE {$this->getTable('prolabels/label')} (\n `rules_id` int(11) NOT NULL AUTO_INCREMENT,\n `name` varchar(40) NOT NULL,\n `conditions_serialized` text,\n `status` tinyint(1) unsigned NOT NULL DEFAULT '0',\n `system` tinyint(1) NOT NULL DEFAULT '0',\n `product_position` varchar(25) DEFAULT NULL,\n `product_image` varchar(50) DEFAULT NULL,\n `product_image_text` varchar(50) DEFAULT NULL,\n `product_position_style` varchar(80) DEFAULT NULL,\n `product_font_style` varchar(80) DEFAULT NULL,\n `product_round_method` varchar(15) DEFAULT NULL,\n `product_round` varchar(5) DEFAULT NULL,\n `category_position` varchar(25) DEFAULT NULL,\n `category_image` varchar(50) DEFAULT NULL,\n `category_image_text` varchar(50) DEFAULT NULL,\n `category_position_style` varchar(80) DEFAULT NULL,\n `category_font_style` varchar(80) DEFAULT NULL,\n `category_round_method` varchar(15) DEFAULT NULL,\n `category_round` varchar(5) DEFAULT NULL,\n `category_min_stock` varchar(5) DEFAULT NULL,\n `category_out_stock` tinyint(1) unsigned DEFAULT NULL,\n `category_out_stock_image` varchar(45) DEFAULT NULL,\n `product_min_stock` varchar(5) DEFAULT NULL,\n `product_out_stock` tinyint(1) unsigned DEFAULT NULL,\n `product_out_stock_image` varchar(45) DEFAULT NULL,\n PRIMARY KEY (`rules_id`)\n) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;\n\nINSERT INTO {$this->getTable('prolabels/label')} (`rules_id`,`name`,`conditions_serialized`,`status`,`system`,`product_position`,`product_image`,`product_image_text`,`product_position_style`,`product_font_style`,`product_round_method`,`product_round`,`category_position`,`category_image`,`category_image_text`,`category_position_style`,`category_font_style`,`category_round_method`,`category_round`,`category_min_stock`,`category_out_stock`,`category_out_stock_image`,`product_min_stock`,`product_out_stock`,`product_out_stock_image`) VALUES\n (1,'On Sale','a:6:{s:4:\"type\";s:32:\"prolabels/rule_condition_combine\";s:9:\"attribute\";N;s:8:\"operator\";N;s:5:\"value\";b:1;s:18:\"is_value_processed\";N;s:10:\"aggregator\";s:3:\"all\";}',0,1,'bottom-left',NULL,'#discount_amount#',NULL,NULL,'round','1','top-left',NULL,NULL,NULL,NULL,'round','1',NULL,NULL,NULL,NULL,NULL,NULL),\n (2,'In Stock','a:6:{s:4:\"type\";s:32:\"prolabels/rule_condition_combine\";s:9:\"attribute\";N;s:8:\"operator\";N;s:5:\"value\";b:1;s:18:\"is_value_processed\";N;s:10:\"aggregator\";s:3:\"all\";}',0,1,'top-right',NULL,NULL,NULL,NULL,'round','1','top-left',NULL,NULL,NULL,NULL,'round','1',NULL,0,NULL,'5',1,NULL),\n (3,'Is New','a:6:{s:4:\"type\";s:32:\"prolabels/rule_condition_combine\";s:9:\"attribute\";N;s:8:\"operator\";N;s:5:\"value\";b:1;s:18:\"is_value_processed\";N;s:10:\"aggregator\";s:3:\"all\";}',0,1,'top-left',NULL,NULL,NULL,NULL,'round','1','top-left',NULL,NULL,NULL,NULL,'round',NULL,NULL,NULL,NULL,NULL,NULL,NULL);\n\nCREATE TABLE {$this->getTable('prolabels/index')} (\n `id` bigint(20) NOT NULL AUTO_INCREMENT,\n `rules_id` int(11) NOT NULL,\n `product_id` int(10) unsigned NOT NULL,\n PRIMARY KEY (`id`),\n KEY `product` (`product_id`),\n KEY `tm_fk_constraint_rules` (`rules_id`),\n CONSTRAINT `tm_fk_constraint_rules` FOREIGN KEY (`rules_id`) REFERENCES {$this->getTable('prolabels/label')} (`rules_id`) ON DELETE CASCADE ON UPDATE CASCADE,\n CONSTRAINT `tm_fk_constraint_rules_product` FOREIGN KEY (`product_id`) REFERENCES {$this->getTable('catalog/product')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;\n\nCREATE TABLE {$this->getTable('prolabels/store')} (\n `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n `rule_id` int(11) NOT NULL,\n `store_id` int(11) NOT NULL,\n PRIMARY KEY (`id`),\n KEY `tm_fk_constraint_pro_store` (`rule_id`),\n CONSTRAINT `tm_fk_constraint_pro_store` FOREIGN KEY (`rule_id`) REFERENCES {$this->getTable('prolabels/label')} (`rules_id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;\n\n"); $installer->endSetup();
* It is also available through the world-wide-web at this URL: * http://ecommerce.aheadworks.com/AW-LICENSE.txt * * ================================================================= * MAGENTO EDITION USAGE NOTICE * ================================================================= * This software is designed to work with Magento community edition and * its use on an edition other than specified is prohibited. aheadWorks does not * provide extension support in case of incorrect edition use. * ================================================================= * * @category AW * @package AW_Mobile * @version 1.6.7 * @copyright Copyright (c) 2010-2012 aheadWorks Co. (http://www.aheadworks.com) * @license http://ecommerce.aheadworks.com/AW-LICENSE.txt */ function updateValue(Mage_Eav_Model_Entity_Setup $setup, $entityTypeId, $code, $key, $value) { $id = $setup->getAttribute($entityTypeId, $code, 'attribute_id'); $setup->updateAttribute($entityTypeId, $id, $key, $value); } $installer = $this; $installer->startSetup(); $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $setup->removeAttribute('catalog_product', 'mobile_description'); $setup->addAttribute('catalog_product', 'mobile_description', array('type' => 'text', 'backend' => '', 'frontend' => '', 'label' => 'Mobile Description', 'input' => 'textarea', 'class' => '', 'source' => '', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 'visible' => true, 'group' => 'Mobile Options', 'required' => false, 'user_defined' => false, 'default' => '', 'searchable' => true, 'filterable' => false, 'comparable' => false, 'is_wysiwyg_enabled' => true, 'is_html_allowed_on_front' => true, 'visible_on_front' => false, 'visible_in_advanced_search' => false, 'unique' => false)); updateValue($setup, 'catalog_product', 'mobile_description', 'is_global', 0); updateValue($setup, 'catalog_product', 'mobile_description', 'is_wysiwyg_enabled', true); updateValue($setup, 'catalog_product', 'mobile_description', 'is_html_allowed_on_front', true); $installer->endSetup();
<?php $installer = $this; /* @var $installer Mage_Core_Model_Resource_Setup */ $installer->startSetup(); $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $entityTypeId = $setup->getEntityTypeId('catalog_product'); $attributeSetId = $setup->getDefaultAttributeSetId($entityTypeId); if (!$setup->getAttributeGroup($entityTypeId, $attributeSetId, "CandyClub Subscription", "attribute_group_id")) { $setup->addAttributeGroup($entityTypeId, $attributeSetId, "CandyClub Subscription", 1); } $attributeGroupId = $setup->getAttributeGroup($entityTypeId, $attributeSetId, "CandyClub Subscription", "attribute_group_id"); $setup->removeAttribute('catalog_product', 'is_prepay'); $setup->addAttribute('catalog_product', 'is_prepay', array('label' => 'Is Prepay?', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'input' => 'boolean', 'type' => 'int', 'unique' => '0', 'required' => '0', 'used_in_product_listing' => '1', 'visible' => '1', 'user_defined' => '1', 'source' => 'eav/entity_attribute_source_boolean', 'note' => '')); $setup->addAttributeToSet($entityTypeId, $attributeSetId, $attributeGroupId, 'is_prepay'); $installer->endSetup();
/** * @var $installer Mage_Core_Model_Resource_Setup */ $installer = $this; $installer->startSetup(); $table = $installer->getConnection()->newTable($installer->getTable('payperrentals/fixedrentalnames'))->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('unsigned' => true, 'identity' => true, 'nullable' => false, 'primary' => true), 'id')->addColumn('name', Varien_Db_Ddl_Table::TYPE_TEXT, null, array('unsigned' => true, 'nullable' => true), 'name'); $installer->getConnection()->createTable($table); $table = $installer->getConnection()->newTable($installer->getTable('payperrentals/fixedrentaldates'))->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('unsigned' => true, 'identity' => true, 'nullable' => false, 'primary' => true), 'id')->addColumn('nameid', Varien_Db_Ddl_Table::TYPE_INTEGER, 100, array('nullable' => true, 'default' => null), 'Fixed name Id')->addColumn('repeat_type', Varien_Db_Ddl_Table::TYPE_TEXT, null, array('nullable' => true, 'default' => null), 'Repeat Type')->addColumn('start_date', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array('nullable' => true, 'default' => null), 'From')->addColumn('end_date', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array('nullable' => true, 'default' => null), 'To')->addColumn('repeat_days', Varien_Db_Ddl_Table::TYPE_TEXT, null, array('nullable' => true, 'default' => null, 'comment' => 'Days to repeat')); $installer->getConnection()->createTable($table); $installer->getConnection()->addIndex($installer->getTable('payperrentals/fixedrentaldates'), $installer->getIdxName('payperrentals/fixedrentaldates', array('nameid'), Varien_Db_Adapter_Interface::INDEX_TYPE_INDEX), array('nameid'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_INDEX)); $installer->getConnection()->addForeignKey($installer->getFkName('payperrentals/fixedrentaldates', 'nameid', 'payperrentals/fixedrentalnames', 'id'), $installer->getTable('payperrentals/fixedrentaldates'), 'nameid', $installer->getTable('payperrentals/fixedrentalnames'), 'id'); $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $setup->addAttribute('catalog_product', 'fixed_rental_name', array('backend' => '', 'source' => 'payperrentals/product_fixedrentalnames', 'group' => 'Rental Bookings', 'label' => 'Use fixed rental dates', 'input' => 'select', 'type' => 'int', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE, 'visible' => true, 'default' => 0, 'required' => false, 'user_defined' => false, 'apply_to' => 'reservation,grouped,bundle,configurable', 'visible_on_front' => false, 'position' => 25)); // Product attributes $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); try { $setup->removeAttribute(Mage_Catalog_Model_Product::ENTITY, 'payperrentals_damage_waiver'); $setup->removeAttribute(Mage_Catalog_Model_Product::ENTITY, 'use_global_damage_waiver'); $setup->removeAttribute(Mage_Catalog_Model_Product::ENTITY, 'use_global_deposit_per_product'); } catch (Exception $E) { } $setup->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'use_global_deposit_per_product', array('group' => 'Prices', 'label' => 'Use Global Deposit Per Product', 'type' => 'int', 'input' => 'select', 'source' => 'eav/entity_attribute_source_boolean', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE, 'visible' => true, 'required' => true, 'user_defined' => false, 'default' => 1, 'apply_to' => 'reservation', 'visible_on_front' => false, 'position' => 100)); $setup->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'use_global_damage_waiver', array('group' => 'Prices', 'label' => 'Use Global Damage Waiver', 'type' => 'int', 'input' => 'select', 'source' => 'eav/entity_attribute_source_boolean', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE, 'visible' => true, 'required' => true, 'user_defined' => false, 'default' => 1, 'apply_to' => 'reservation', 'visible_on_front' => false, 'position' => 100)); $setup->addAttribute('catalog_product', 'payperrentals_damage_waiver', array('backend' => '', 'source' => '', 'group' => 'Prices', 'label' => 'Damage Waiver Amount', 'input' => 'text', 'class' => 'validate-digit', 'type' => 'decimal', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE, 'default_value' => 1, 'visible' => true, 'required' => false, 'user_defined' => false, 'default' => '0', 'apply_to' => 'reservation', 'visible_on_front' => false, 'position' => 14)); $fieldList = array('payperrentals_damage_waiver', 'use_global_deposit_per_product', 'use_global_damage_waiver'); $applyTo = array('reservation', 'configurable', 'bundle', 'grouped'); foreach ($fieldList as $field) { $installer->updateAttribute('catalog_product', $field, 'apply_to', implode(',', $applyTo)); $installer->updateAttribute('catalog_product', $field, 'is_global', Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE); } $installer->endSetup();
$setup->getConnection()->dropColumn($setup->getTable("sales/order_item"), "box_id"); $setup->addAttribute("order_item", "box_id", array('type' => 'int')); $setup->getConnection()->dropColumn($setup->getTable("sales/quote_item"), "box_id"); $setup->addAttribute("quote_item", "box_id", array('type' => 'int')); $setup->getConnection()->dropColumn($setup->getTable("sales/order_item"), "box_sku"); $setup->addAttribute("order_item", "box_sku", array('type' => 'text')); $setup->getConnection()->dropColumn($setup->getTable("sales/quote_item"), "box_sku"); $setup->addAttribute("quote_item", "box_sku", array('type' => 'text')); // 4. Install Order Attributes $setup = new Mage_Sales_Model_Mysql4_Setup(); $setup->getConnection()->dropColumn($setup->getTable("sales/order"), "subscription_id"); $setup->addAttribute("order", "subscription_id", array('type' => 'int')); $setup->getConnection()->dropColumn($setup->getTable("sales/quote"), "subscription_id"); $setup->addAttribute("quote", "subscription_id", array('type' => 'int')); $setup->getConnection()->dropColumn($setup->getTable("sales/order"), "ids_code"); $setup->addAttribute("order", "ids_code", array('type' => 'text')); $setup->getConnection()->dropColumn($setup->getTable("sales/quote"), "ids_code"); $setup->addAttribute("quote", "ids_code", array('type' => 'text')); // 5. Install Customer Attributes $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $setup->removeAttribute('customer', 'payment_token'); $entityTypeId = $setup->getEntityTypeId('customer'); $attributeSetId = $setup->getDefaultAttributeSetId($entityTypeId); $attributeGroupId = $setup->getDefaultAttributeGroupId($entityTypeId, $attributeSetId); $setup->addAttribute('customer', 'payment_token', array('input' => 'text', "type" => 'varchar', 'label' => 'Payment Token', 'visible' => 1, 'required' => 0, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL)); $setup->addAttributeToSet($entityTypeId, $attributeSetId, $attributeGroupId, 'payment_token'); $attribute = Mage::getSingleton("eav/config")->getAttribute("customer", "payment_token"); $used_in_forms[] = "adminhtml_customer"; $attribute->setData("used_in_forms", $used_in_forms)->setData("is_used_for_customer_segment", true)->setData("is_system", 0)->setData("is_user_defined", 1)->setData("is_visible", 0)->setData("sort_order", 100); $attribute->save(); $installer->endSetup();
<?php $installer = $this; $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $installer->startSetup(); $setup->removeAttribute('catalog_product', 'unm_inventory_threshold'); $setup->addAttribute('catalog_product', 'unm_inventory_threshold', array('group' => 'General', 'input' => 'text', 'type' => 'int', 'label' => 'Inventory Out of Stock Threshold', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'visible' => true, 'required' => false, 'default_value' => '0', 'user_defined' => true)); $installer->endSetup();
* @category Magestore * @package Magestore_Customercredit * @copyright Copyright (c) 2012 Magestore (http://www.magestore.com/) * @license http://www.magestore.com/license-agreement.html */ /** @var $installer Mage_Core_Model_Resource_Setup */ $installer = $this; $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $installer->startSetup(); /* Add credit value attribute */ $data = array('type' => 'decimal', 'input' => 'text', 'label' => 'Credit Balance', 'backend' => '', 'frontend' => '', 'source' => '', 'is_visible' => 0, 'is_visible_on_front' => 0, 'required' => 0, 'user_defined' => 0, 'is_searchable' => 1, 'is_filterable' => 0, 'is_comparable' => 0, 'position' => 2, 'unique' => 0, 'default' => 0.0, 'is_global' => ''); $setup->addAttribute('customer', 'credit_value', $data); $attribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'credit_value'); $attribute->setDefaultValue('0.00'); $attribute->save(); $setup->removeAttribute('catalog_product', 'credit_amount'); $attr = array('group' => 'Prices', 'type' => 'text', 'input' => 'text', 'label' => 'Credit Amount', 'backend' => '', 'frontend' => '', 'source' => '', 'visible' => 1, 'user_defined' => 1, 'used_for_price_rules' => 1, 'position' => 2, 'unique' => 0, 'default' => '', 'sort_order' => 101, 'note' => 'For example: <br/>Fixed price: 100 <br/>Option Price: 10,20,30 <br/>Price range: 1-100 '); $setup->addAttribute('catalog_product', 'credit_amount', $attr); $creditAmount = Mage::getModel('catalog/resource_eav_attribute')->load($setup->getAttributeId('catalog_product', 'credit_amount')); $creditAmount->addData(array('is_global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 'is_required' => 0, 'apply_to' => array('customercredit'), 'is_configurable' => 1, 'is_searchable' => 1, 'is_visible_in_advanced_search' => 1, 'is_comparable' => 0, 'is_filterable' => 0, 'is_filterable_in_search' => 1, 'is_used_for_promo_rules' => 1, 'is_html_allowed_on_front' => 0, 'is_visible_on_front' => 0, 'used_in_product_listing' => 1, 'used_for_sort_by' => 0, 'backend_type' => 'text'))->save(); $tax = Mage::getModel('catalog/resource_eav_attribute')->load($setup->getAttributeId('catalog_product', 'tax_class_id')); $applyTo = explode(',', $tax->getData('apply_to')); $applyTo[] = 'customercredit'; $tax->addData(array('apply_to' => $applyTo))->save(); /** * create customercredit table */
<?php $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $setup->removeAttribute('catalog_product', 'reward_point_product'); $setup->removeAttribute('catalog_product', 'reward_point_will_get'); $setup->addAttribute('catalog_product', 'reward_point_product', array('label' => 'Reward Points Earned', 'type' => 'int', 'input' => 'text', 'visible' => true, 'required' => false, 'position' => 10)); $installer = $this; $collection = Mage::getModel('rewardpoints/customer')->getCollection(); $installer->startSetup(); $sql = "\r\nALTER TABLE {$collection->getTable('customer')} ADD `last_checkout` DATETIME NOT NULL AFTER `mw_friend_id`;\r\nUPDATE {$collection->getTable('customer')} set `last_checkout`='" . Mage::getSingleton('core/date')->gmtDate() . "';\r\n"; $installer->run($sql); $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();
/** * 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->removeAttribute('catalog_product', 'aw_acp_disabled'); $installer->endSetup();
* aheadWorks does not guarantee correct work of this extension * 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));
<?php $installer = $this; /* @var $installer Mage_Core_Model_Resource_Setup */ $installer->startSetup(); /** * Create table 'pixsubscription/subscription_type' */ $installer->getConnection()->dropTable($installer->getTable('pixsubscription/subscription_type')); $table = $installer->getConnection()->newTable($installer->getTable('pixsubscription/subscription_type'))->addColumn('subscription_type_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), 'Entity ID')->addColumn('name', Varien_Db_Ddl_Table::TYPE_TEXT, 500, array(), 'Name')->addColumn('is_prepay_available', Varien_Db_Ddl_Table::TYPE_INTEGER, 1, array('unsigned' => true), 'Is prepay available'); $installer->getConnection()->createTable($table); /** * Create table 'pixsubscription/subscription' */ $installer->getConnection()->dropTable($installer->getTable('pixsubscription/subscription')); $table = $installer->getConnection()->newTable($installer->getTable('pixsubscription/subscription'))->addColumn('subscription_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), 'Subscription ID')->addColumn('subscription_type_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('unsigned' => true, 'nullable' => false, 'default' => '0'), 'Subscription Type Id')->addColumn('customer_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('unsigned' => true, 'nullable' => false, 'default' => '0'), 'Customer Id')->addColumn('subscription_product_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('unsigned' => true, 'nullable' => false, 'default' => '0'), 'subscription_product_id')->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array('default' => null), 'Created At')->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array('default' => null), 'Updated At')->addColumn('status', Varien_Db_Ddl_Table::TYPE_TEXT, 64, array(), 'Status'); $installer->getConnection()->createTable($table); Mage::getModel("pixsubscription/subscription_type")->setName("Month to Month")->setIsPrepayAvailable(0)->save(); Mage::getModel("pixsubscription/subscription_type")->setName("6 Month Plan")->setIsPrepayAvailable(1)->save(); Mage::getModel("pixsubscription/subscription_type")->setName("12 Month Plan")->setIsPrepayAvailable(1)->save(); $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $entityTypeId = $setup->getEntityTypeId('catalog_product'); $attributeSetId = $setup->getDefaultAttributeSetId($entityTypeId); if (!$setup->getAttributeGroup($entityTypeId, $attributeSetId, "CandyClub Subscription", "attribute_group_id")) { $setup->addAttributeGroup($entityTypeId, $attributeSetId, "CandyClub Subscription", 1); } $attributeGroupId = $setup->getAttributeGroup($entityTypeId, $attributeSetId, "CandyClub Subscription", "attribute_group_id"); $setup->removeAttribute('catalog_product', 'subscription_type'); $setup->addAttribute('catalog_product', 'subscription_type', array('label' => 'Subscription Type', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'input' => 'select', 'type' => 'int', 'unique' => '0', 'required' => '0', 'used_in_product_listing' => '1', 'visible' => '1', 'user_defined' => '1', 'source' => 'pixsubscription/subscription_type_source_list', 'note' => '')); $setup->addAttributeToSet($entityTypeId, $attributeSetId, $attributeGroupId, 'subscription_type'); $installer->endSetup();