<?php /** * Start */ $installer = new Mage_Eav_Model_Entity_Setup('core_setup'); $installer->startSetup(); /** * Reservation orders and reservation quotes separation */ $installer->run("\n UPDATE {$this->getTable('payperrentals/sendreturn')} AS `sendreturn`\n INNER JOIN {$this->getTable('sales/order')} AS `order` ON (`sendreturn`.`order_id` = `order`.`increment_id`)\n SET `sendreturn`.`order_id` = `order`.`entity_id`;\n\n ALTER TABLE {$this->getTable('payperrentals/sendreturn')}\n MODIFY `order_id` int(10) unsigned NOT NULL;\n\n"); /** * End */ $installer->endSetup();
<?php /** * Start */ $installer = new Mage_Eav_Model_Entity_Setup('core_setup'); $installer->startSetup(); /** * Exclude dates */ $installer->run("\n ALTER TABLE {$this->getTable('payperrentals/excludeddates')}\n CHANGE `entity_id` `product_id` int(10) unsigned NOT NULL DEFAULT '0',\n MODIFY `store_id` smallint(5) unsigned NOT NULL DEFAULT '0';\n\n ALTER TABLE {$this->getTable('payperrentals/excludeddates')}\n ADD CONSTRAINT `FK_PPR_EXCLUDEDATES_STORE_ID_CORE_STORE_STORE_ID` FOREIGN KEY (`store_id`) REFERENCES {$installer->getTable('core_store')} (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE,\n ADD CONSTRAINT `FK_PPR_EXCLUDEDATES_PRODUCT_ID_CATALOG_PRODUCT_ID` FOREIGN KEY (`product_id`) REFERENCES {$installer->getTable('catalog_product_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n\n"); /** * End */ $installer->endSetup();
<?php /** * Start */ $installer = new Mage_Eav_Model_Entity_Setup('core_setup'); $installer->startSetup(); /** * Reservation orders and reservation quotes separation */ $installer->run("\n ALTER TABLE {$this->getTable('payperrentals/sendreturn')} ADD INDEX ( `product_id` );\n ALTER TABLE {$this->getTable('payperrentals/reservationorders')} ADD INDEX ( `product_id` );\n ALTER TABLE {$this->getTable('payperrentals/reservationquotes')} ADD INDEX ( `product_id` );\n ALTER TABLE {$this->getTable('payperrentals/reservationprices')}\n ADD COLUMN `damage_waiver` int(11) NOT NULL DEFAULT '0' AFTER `price`;\n"); /** * End */ $installer->endSetup();
<?php $installer = new Mage_Eav_Model_Entity_Setup('core_setup'); $installer->startSetup(); $setup = $this; $installer->run("\n ALTER TABLE {$this->getTable('catalog_product_entity_text')} CHANGE `value` `value` LONGTEXT;\n\t"); $installer->endSetup();
<?php $installer = new Mage_Eav_Model_Entity_Setup('core_setup'); $installer->startSetup(); $setup = $this; $installer->run("\n ALTER TABLE {$this->getTable('payperrentals/reservationorders')} CHANGE `order_id` `order_id` VARCHAR( 50 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;\n\t"); $installer->endSetup();
<?php $installer = new Mage_Eav_Model_Entity_Setup('core_setup'); $installer->startSetup(); $setup = $this; try { $installer->run("\n\n\tALTER TABLE `" . $this->getTable('sales/order') . "` ADD `damage_waiver_amount` DECIMAL( 10, 2 ) NOT NULL;\n\tALTER TABLE `" . $this->getTable('sales/order') . "` ADD `base_damage_waiver_amount` DECIMAL( 10, 2 ) NOT NULL;\n\n "); $installer->run("\n\n\t\tALTER TABLE `" . $this->getTable('sales/quote_address') . "` ADD `damage_waiver_amount` DECIMAL( 10, 2 ) NOT NULL;\n\t\tALTER TABLE `" . $this->getTable('sales/quote_address') . "` ADD `base_damage_waiver_amount` DECIMAL( 10, 2 ) NOT NULL;\n\n\t\t"); $installer->run("\n\n\t\tALTER TABLE `" . $this->getTable('sales/order') . "` ADD `damage_waiver_amount_invoiced` DECIMAL( 10, 2 ) NOT NULL;\n\t\tALTER TABLE `" . $this->getTable('sales/order') . "` ADD `base_damage_waiver_amount_invoiced` DECIMAL( 10, 2 ) NOT NULL;\n\n\t\t"); $installer->run("\n\n\t\tALTER TABLE `" . $this->getTable('sales/invoice') . "` ADD `damage_waiver_amount` DECIMAL( 10, 2 ) NOT NULL;\n\t\tALTER TABLE `" . $this->getTable('sales/invoice') . "` ADD `base_damage_waiver_amount` DECIMAL( 10, 2 ) NOT NULL;\n\t\t"); $installer->run("\n\n\t\tALTER TABLE `" . $this->getTable('sales/order') . "` ADD `damage_waiver_amount_refunded` DECIMAL( 10, 2 ) NOT NULL;\n\t\tALTER TABLE `" . $this->getTable('sales/order') . "` ADD `base_damage_waiver_amount_refunded` DECIMAL( 10, 2 ) NOT NULL;\n\n\t\tALTER TABLE `" . $this->getTable('sales/creditmemo') . "` ADD `damage_waiver_amount` DECIMAL( 10, 2 ) NOT NULL;\n\t\tALTER TABLE `" . $this->getTable('sales/creditmemo') . "` ADD `base_damage_waiver_amount` DECIMAL( 10, 2 ) NOT NULL;\n\n\t\t"); } catch (Exception $e) { } $installer->endSetup();
<?php /** * Start */ $installer = new Mage_Eav_Model_Entity_Setup('core_setup'); $installer->startSetup(); /** * Reservation orders and reservation quotes separation */ $installer->run("\n UPDATE {$this->getTable('payperrentals/reservationorders')} AS `reservation`\n INNER JOIN {$this->getTable('sales/order')} AS `order` ON (`reservation`.`order_id` = `order`.`increment_id`)\n SET `reservation`.`order_id` = `order`.`entity_id`\n WHERE `otype`='order';\n\n CREATE TABLE {$this->getTable('payperrentals/reservationquotes')} LIKE {$this->getTable('payperrentals/reservationorders')};\n\n INSERT INTO {$this->getTable('payperrentals/reservationquotes')} (SELECT * FROM {$this->getTable('payperrentals/reservationorders')} WHERE `otype`='quote');\n\n DELETE FROM {$this->getTable('payperrentals/reservationorders')} WHERE `otype`='quote';\n\n ALTER TABLE {$this->getTable('payperrentals/reservationorders')}\n DROP COLUMN `otype`,\n DROP COLUMN `quote_id`,\n MODIFY `order_id` int(10) unsigned NOT NULL,\n MODIFY `order_item_id` int(10) unsigned NOT NULL;\n\n ALTER TABLE {$this->getTable('payperrentals/reservationquotes')}\n DROP COLUMN `otype`,\n DROP COLUMN `order_item_id`,\n CHANGE `order_id` `quote_item_id` int(10) unsigned NOT NULL,\n MODIFY `quote_id` int(10) unsigned NOT NULL;\n\n ALTER TABLE {$this->getTable('payperrentals/reservationquotes')}\n ADD CONSTRAINT `FK_PPR_QUOTES_QUOTE_ID_SALES_QUOTE_ENTITY_ID` FOREIGN KEY (`quote_id`) REFERENCES {$installer->getTable('sales/quote')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,\n ADD CONSTRAINT `FK_PPR_QUOTES_ORDER_ID_SALES_QUOTE_ITEM_ID` FOREIGN KEY (`quote_item_id`) REFERENCES {$installer->getTable('sales/quote_item')} (`item_id`) ON DELETE CASCADE ON UPDATE CASCADE;\n"); /** * End */ $installer->endSetup();
<?php $installer = new Mage_Eav_Model_Entity_Setup('core_setup'); $installer->startSetup(); $setup = $this; $fieldList = array('is_reservation'); foreach ($fieldList as $field) { $installer->updateAttribute('catalog_product', $field, 'required', '1'); $installer->updateAttribute('catalog_product', $field, 'default_value', null); $installer->updateAttribute('catalog_product', $field, 'class', 'required-entry select'); } $configValuesMap = array('payperrentals/notificationemails/send_queue_email' => 'payperrentals_notification_send_queue'); foreach ($configValuesMap as $configPath => $configValue) { $installer->setConfigData($configPath, $configValue); } $installer->run("\n\tDROP TABLE IF EXISTS {$this->getTable('payperrentals/mailinglog')};\n\n\tCREATE TABLE {$this->getTable('payperrentals/mailinglog')} (\n\t\t`id` INT( 11 ) NOT NULL auto_increment,\n\t\t`is_cron` int(11) NOT NULL DEFAULT '0',\n\t\t`from_name` varchar(250) NOT NULL,\n\t\t`from_email` varchar(250) NOT NULL,\n\t\t`to_name` varchar(250) NOT NULL,\n\t\t`to_email` varchar(250) NOT NULL,\n\t\t`subject` TEXT,\n\t\t`message` TEXT,\n\t\t`message_error` TEXT,\n\t\t`created_at` DATETIME NOT NULL ,\n\t\tPRIMARY KEY ( `id` )\n\n\t) DEFAULT CHARSET utf8 ENGINE = InnoDB;\n\n\t"); $installer->endSetup(); $installer2 = new Mage_Sales_Model_Mysql4_Setup('sales_setup'); $installer2->startSetup(); $installer2->addAttribute('order', 'start_datetime', array('type' => 'datetime', 'grid' => true, 'unsigned' => true)); $installer2->addAttribute('order', 'end_datetime', array('type' => 'datetime', 'grid' => true, 'unsigned' => true)); $installer2->addAttribute('order', 'send_datetime', array('type' => 'datetime', 'grid' => true, 'unsigned' => true)); $installer2->addAttribute('order', 'return_datetime', array('type' => 'datetime', 'grid' => true, 'unsigned' => true)); $installer2->addAttribute('order', 'estimate_send', array('type' => 'datetime', 'grid' => true, 'unsigned' => true)); $installer2->addAttribute('order', 'estimate_return', array('type' => 'datetime', 'grid' => true, 'unsigned' => true)); $installer2->addAttribute('quote', 'start_datetime', array('type' => 'datetime', 'grid' => true, 'unsigned' => true)); $installer2->addAttribute('quote', 'end_datetime', array('type' => 'datetime', 'grid' => true, 'unsigned' => true)); $installer2->getConnection()->addColumn($installer2->getTable('sales/quote'), 'start_datetime', 'DATETIME'); $installer2->getConnection()->addColumn($installer2->getTable('sales/order'), 'end_datetime', 'DATETIME'); $installer2->getConnection()->addColumn($installer2->getTable('sales/quote'), 'end_datetime', 'DATETIME'); $installer2->getConnection()->addColumn($installer2->getTable('sales/order'), 'start_datetime', 'DATETIME');
<?php $installer = new Mage_Eav_Model_Entity_Setup('core_setup'); $installer->startSetup(); $setup = $this; $installer->run("\n ALTER TABLE {$this->getTable('payperrentals/sendreturn')} CHANGE `order_id` `order_id` VARCHAR( 50 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;\n\t"); try { $installer->run("\n\n\tALTER TABLE `" . $this->getTable('sales/order') . "` ADD `depositppr_amount` DECIMAL( 10, 2 ) NOT NULL;\n\tALTER TABLE `" . $this->getTable('sales/order') . "` ADD `base_depositppr_amount` DECIMAL( 10, 2 ) NOT NULL;\n\n "); $installer->run("\n\n\t\tALTER TABLE `" . $this->getTable('sales/quote_address') . "` ADD `depositppr_amount` DECIMAL( 10, 2 ) NOT NULL;\n\t\tALTER TABLE `" . $this->getTable('sales/quote_address') . "` ADD `base_depositppr_amount` DECIMAL( 10, 2 ) NOT NULL;\n\n\t\t"); $installer->run("\n\n\t\tALTER TABLE `" . $this->getTable('sales/order') . "` ADD `depositppr_amount_invoiced` DECIMAL( 10, 2 ) NOT NULL;\n\t\tALTER TABLE `" . $this->getTable('sales/order') . "` ADD `base_depositppr_amount_invoiced` DECIMAL( 10, 2 ) NOT NULL;\n\n\t\t"); $installer->run("\n\n\t\tALTER TABLE `" . $this->getTable('sales/invoice') . "` ADD `depositppr_amount` DECIMAL( 10, 2 ) NOT NULL;\n\t\tALTER TABLE `" . $this->getTable('sales/invoice') . "` ADD `base_depositppr_amount` DECIMAL( 10, 2 ) NOT NULL;\n\t\t"); $installer->run("\n\n\t\tALTER TABLE `" . $this->getTable('sales/order') . "` ADD `depositppr_amount_refunded` DECIMAL( 10, 2 ) NOT NULL;\n\t\tALTER TABLE `" . $this->getTable('sales/order') . "` ADD `base_depositppr_amount_refunded` DECIMAL( 10, 2 ) NOT NULL;\n\n\t\tALTER TABLE `" . $this->getTable('sales/creditmemo') . "` ADD `depositppr_amount` DECIMAL( 10, 2 ) NOT NULL;\n\t\tALTER TABLE `" . $this->getTable('sales/creditmemo') . "` ADD `base_depositppr_amount` DECIMAL( 10, 2 ) NOT NULL;\n\n\t\t"); } catch (Exception $e) { } $installer->endSetup();
<?php /** * @category Graphic Sourcecode * @package Rofra_Salesorderitemgrid * @license http://www.apache.org/licenses/LICENSE-2.0 * @author Rodolphe Franceschi <*****@*****.**> */ $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $setup->startSetup(); // Change the flags to filter / sort (for flat index) $setup->run("\nUPDATE sales_flat_order_item SET column1 = '';\nUPDATE sales_flat_order_item SET column2 = '';\nUPDATE sales_flat_order_item SET column3 = '';\n"); $setup->endSetup();
if (version_compare(Mage::getVersion(), '1.4.2', '>=')) { Mage::getSingleton('eav/config')->getAttribute('customer', 'membershippackage_year')->setData('used_in_forms', array('adminhtml_customer_membership'))->save(); } /*$setup->addAttribute('customer', 'membershippackage_orderid', array( 'type' => 'text', 'input' => 'text', 'label' => 'Membership', 'global' => 1, 'visible' => 0, 'required' => 0, 'user_defined' => 1, 'default' => '0', 'visible_on_front' => 1, 'source'=> '', 'backend' => 'payperrentals/customer_backend_membershiporderid', )); if (version_compare(Mage::getVersion(), '1.6.0', '<=')) { $customer = Mage::getModel('customer/customer'); $attrSetId = $customer->getResource()->getEntityType()->getDefaultAttributeSetId(); $setup->addAttributeToSet('customer', $attrSetId, 'Membership', 'membershippackage_orderid'); } if (version_compare(Mage::getVersion(), '1.4.2', '>=')) { Mage::getSingleton('eav/config') ->getAttribute('customer', 'membershippackage_orderid') ->save(); } */ $installer->run("\n\tDROP TABLE IF EXISTS {$this->getTable('payperrentals/rentalqueue')};\n\n\tCREATE TABLE {$this->getTable('payperrentals/rentalqueue')} (\n\t\t`id` INT( 11 ) NOT NULL auto_increment,\n\t\t`product_id` INT( 11 ) NOT NULL ,\n\t\t`customer_id` INT( 11 ) NOT NULL ,\n\t\t`store_id` INT( 11 ) NOT NULL ,\n\t\t`sort_order` INT( 11 ) NOT NULL DEFAULT '0',\n\t\t`date_added` DATETIME NOT NULL ,\n\t\t`custom_options` TEXT NOT NULL DEFAULT '',\n\t\t`attributes` TEXT NOT NULL DEFAULT '',\n\t\t`sendreturn_id` INT( 11 ) NOT NULL DEFAULT '0',\n\t\tPRIMARY KEY ( `id` ) ,\n\t\tKEY `store_id` (`store_id`),\n\t\tINDEX ( `product_id` , `customer_id` , `sendreturn_id` )\n\n\t) DEFAULT CHARSET utf8 ENGINE = InnoDB;\n\n\t"); $installer->endSetup();
<?php $installer = $this; $installer->startSetup(); $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); /** $setup->addAttribute('order', Vikont_EVOConnector_Helper_Data::ORDER_EVO_STATUS_FIELD, array( 'position' => 1, 'input' => 'text', 'type' => 'tinyint', 'label' => 'EVO Order State', 'visible' => 0, 'required' => 0, 'user_defined' => 0, 'global' => 1, 'default' => 0, 'visible_on_front' => 0, ));/**/ $setup->addAttribute(Mage_Sales_Model_Order::ENTITY, Vikont_EVOConnector_Helper_Data::ORDER_EVO_STATUS_FIELD, array('type' => 'static', 'required' => 0, 'label' => 'EVO Order State', 'default' => 0, 'visible' => false, 'input' => 'text', 'global' => 1)); $setup->getConnection()->addColumn($setup->getTable('sales_flat_order'), Vikont_EVOConnector_Helper_Data::ORDER_EVO_STATUS_FIELD, 'TINYINT(1) UNSIGNED NOT NULL DEFAULT 0'); $setup->run("UPDATE `{$setup->getTable('sales_flat_order')}` SET " . Vikont_EVOConnector_Helper_Data::ORDER_EVO_STATUS_FIELD . "=1 WHERE status<>'pending'"); $installer->run(''); $installer->endSetup();
<?php require_once 'app/Mage.php'; Mage::app(); $installer = new Mage_Eav_Model_Entity_Setup('core_setup'); $installer->startSetup(); $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $entityTypeId = $setup->getEntityTypeId('catalog_category'); $attributeSetId = $setup->getDefaultAttributeSetId($entityTypeId); $attributeGroupId = $setup->getDefaultAttributeGroupId($entityTypeId, $attributeSetId); $attribute = array('input' => 'select', 'type' => 'int', 'source' => 'eav/entity_attribute_source_boolean', 'label' => 'Integrar com AnyMarket', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'visible' => true, 'position' => 0, 'required' => true, 'user_defined' => true, 'default' => "", 'group' => "General Information"); $setup->addAttribute('catalog_category', 'categ_integra_anymarket', $attribute); $attributeId = $setup->getAttributeId($entityTypeId, 'categ_integra_anymarket'); $setup->run("\nINSERT IGNORE INTO `{$installer->getTable('catalog_category_entity_int')}`\n(`entity_type_id`, `attribute_id`, `entity_id`, `value`)\n SELECT '{$entityTypeId}', '{$attributeId}', `entity_id`, '1'\n FROM `{$installer->getTable('catalog_category_entity')}`;\n"); $installer->endSetup();