예제 #1
0
 /**
  * Import attributes and put them in attribute sets and attribute group
  *
  * @param array  $data
  * @param string $behavior
  *
  * @return true
  */
 public function importAttributes(array $data, $behavior = null)
 {
     if (null === $behavior) {
         $behavior = Mage_ImportExport_Model_Import::BEHAVIOR_APPEND;
     }
     $this->_init();
     if (Danslo_ApiImport_Model_Import::BEHAVIOR_DELETE_IF_NOT_EXIST === $behavior) {
         $this->_pruneAttributes($data);
     } else {
         foreach ($data as $attribute) {
             if (isset($attribute['attribute_id'])) {
                 $attributeCode = $attribute['attribute_id'];
                 unset($attribute['attribute_id']);
                 if (Mage_ImportExport_Model_Import::BEHAVIOR_REPLACE === $behavior || Mage_ImportExport_Model_Import::BEHAVIOR_APPEND === $behavior) {
                     $this->_setup->addAttribute($this->_catalogProductEntityTypeId, $attributeCode, $attribute);
                 } elseif (Mage_ImportExport_Model_Import::BEHAVIOR_DELETE === $behavior) {
                     $this->_setup->removeAttribute($this->_catalogProductEntityTypeId, $attributeCode);
                 }
             }
         }
     }
     return true;
 }
$installer->getConnection()->commit();
/**
 * Insert NF-e tables 
 */
$installer->run("\r\n CREATE TABLE {$installer->getTable('nfe_certificado')} (\r\n  `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,\r\n  `certificado` TEXT,\r\n  `created_at` TIMESTAMP NULL DEFAULT NULL,\r\n  PRIMARY KEY (`id`)\r\n) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='NFE Certificado';\r\n        \r\nCREATE TABLE {$installer->getTable('nfe_sales_order')} (\r\n  `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,\r\n  `order_id` INT(8) UNSIGNED NOT NULL,\r\n  PRIMARY KEY (`id`),\r\n  KEY `order_id` (`order_id`),\r\n  CONSTRAINT `nfe_sales_order_ibfk_1` FOREIGN KEY (`order_id`) REFERENCES `sales_flat_order` (`entity_id`)\r\n) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='NFE Sales Order';\r\n\r\n\r\nCREATE TABLE {$installer->getTable('nfe_sales_order_nf')} (\r\n  `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,\r\n  `nf_order_id` INT(10) UNSIGNED NOT NULL,\r\n  `shipment_id` INT(10) UNSIGNED DEFAULT NULL,\r\n  `status` VARCHAR(16) DEFAULT NULL,\r\n  `created_at` TIMESTAMP NULL DEFAULT NULL,\r\n  `executed_at` TIMESTAMP NULL DEFAULT NULL,\r\n  `finished_at` TIMESTAMP NULL DEFAULT NULL,\r\n  PRIMARY KEY (`id`),\r\n  KEY `nf_order_id` (`nf_order_id`),\r\n  KEY `nfe_sales_order_nf_ibfk_2` (`shipment_id`),\r\n  CONSTRAINT `nfe_sales_order_nf_ibfk_1` FOREIGN KEY (`nf_order_id`) REFERENCES `nfe_sales_order` (`id`),\r\n  CONSTRAINT `nfe_sales_order_nf_ibfk_2` FOREIGN KEY (`shipment_id`) REFERENCES `sales_flat_shipment` (`entity_id`)\r\n) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='NFE Sales Order NF';\r\n\r\nCREATE TABLE {$installer->getTable('nfe_sales_order_nf_request')} (\r\n  `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,\r\n  `nfe_nf_id` INT(10) UNSIGNED NOT NULL,\r\n  `request` TEXT,\r\n  `messages` TEXT,\r\n  `status` VARCHAR(16) DEFAULT NULL,\r\n  `created_at` TIMESTAMP NULL DEFAULT NULL,\r\n  `executed_at` TIMESTAMP NULL DEFAULT NULL,\r\n  `finished_at` TIMESTAMP NULL DEFAULT NULL,\r\n  PRIMARY KEY (`id`),\r\n  KEY `nfe_nf_id` (`nfe_nf_id`),\r\n  CONSTRAINT `nfe_sales_order_request_ibfk_1` FOREIGN KEY (`nfe_nf_id`) REFERENCES `nfe_sales_order_nf` (`id`)\r\n) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='NFE Order Requests';\r\n\r\nINSERT sales_order_status (`status`, `label` ) VALUES ('complete_nf', 'Completo NFe emitida');\r\nINSERT sales_order_status (`status`, `label` ) VALUES ('error_nf', 'Processando NFe');\r\nINSERT sales_order_status (`status`, `label` ) VALUES ('pending_nf', 'Entrega Parcial');\r\n\r\nINSERT sales_order_status_label (`status`, `store_id`, `label` ) VALUES ('complete_nf', '1','Completo NFe emitida');\r\nINSERT sales_order_status_label (`status`, `store_id`, `label` ) VALUES ('pending_nf', '1', 'Entrega Parcial');\r\nINSERT sales_order_status_label (`status`, `store_id`, `label` ) VALUES ('error_nf', '1','Processando NFe');\r\n\r\nINSERT sales_order_status_state (`status`, `state`, `is_default` ) VALUES ('pending_nf', 'complete','0');\r\nINSERT sales_order_status_state (`status`, `state`, `is_default` ) VALUES ('complete_nf', 'complete','0');\r\nINSERT sales_order_status_state (`status`, `state`, `is_default` ) VALUES ('error_nf', 'complete','0');\r\n");
$installer->getConnection()->commit();
/**
 * Install NF-e attributes
 */
$installer = new Mage_Eav_Model_Entity_Setup('eav_setup');
$installer->addAttributeGroup('eav/attribute_group', 4, 'NF-e', 3);
$attributeGroupId = $installer->getAttributeGroup('eav/attribute_group', 4, 'NF-e', 'attribute_group_id');
$installer = new Mage_Catalog_Model_Resource_Eav_Mysql4_Setup('catalog_setup');
$entityTypeId = $installer->getEntityTypeId('catalog_product');
$attributeSetId = $installer->getDefaultAttributeSetId($entityTypeId);
$installer->addAttribute('catalog_product', 'nfe_ncm', array('type' => 'text', 'label' => 'NCM', 'input' => 'text', 'source' => '', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'required' => true, 'default' => ''));
$installer->addAttribute('catalog_product', 'nfe_orig', array('type' => 'int', 'label' => 'Origem da Mercadoria', 'input' => 'select', 'source' => 'easynfe_nfe/source_config_origem', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'required' => true, 'default' => ''));
$installer->addAttribute('catalog_product', 'nfe_ucom', array('type' => 'text', 'label' => 'Unidade Comercial', 'input' => 'text', 'source' => '', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'required' => true, 'default' => ''));
$installer->addAttributeToGroup($entityTypeId, $attributeSetId, $attributeGroupId, 'nfe_ncm', '1');
$installer->addAttributeToGroup($entityTypeId, $attributeSetId, $attributeGroupId, 'nfe_orig', '2');
$installer->addAttributeToGroup($entityTypeId, $attributeSetId, $attributeGroupId, 'nfe_ucom', '3');
$installer = new Mage_Sales_Model_Mysql4_Setup('sales_setup');
$installer->addAttribute('order_item', 'nfe_ncm', array('type' => 'text'));
$installer->addAttribute('quote_item', 'nfe_ncm', array('type' => 'text'));
$installer->addAttribute('shipment_item', 'nfe_ncm', array('type' => 'text'));
$installer->addAttribute('order_item', 'nfe_ucom', array('type' => 'text'));
$installer->addAttribute('quote_item', 'nfe_ucom', array('type' => 'text'));
$installer->addAttribute('shipment_item', 'nfe_ucom', array('type' => 'text'));
$installer->addAttribute('order_item', 'nfe_orig', array('type' => 'int'));
$installer->addAttribute('quote_item', 'nfe_orig', array('type' => 'int'));
$installer->addAttribute('shipment_item', 'nfe_orig', array('type' => 'int'));
<?php

/**
 * Unirgy LLC
 *
 * 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://www.unirgy.com/LICENSE-M1.txt
 *
 * @category   Unirgy
 * @package    Unirgy_Dropship
 * @copyright  Copyright (c) 2008-2009 Unirgy LLC (http://www.unirgy.com)
 * @license    http:///www.unirgy.com/LICENSE-M1.txt
 */
$this->startSetup();
$conn = $this->_conn;
$cEav = new Mage_Catalog_Model_Resource_Eav_Mysql4_Setup('catalog_setup');
$cEav->addAttribute('catalog_product', 'udropship_calculate_rates', array('type' => 'int', 'source' => 'udropship/productAttributeSource_calculateRates', 'input' => 'select', 'label' => 'Dropship Rates Calculation Type', 'user_defined' => 1, 'required' => 0, 'group' => 'General'));
$this->endSetup();
<?php

/* @var $installer Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */
//$installer = $this;
$installer = new Mage_Catalog_Model_Resource_Eav_Mysql4_Setup('core_setup');
$installer->startSetup();
// is product used for recurring payments
$installer->addAttribute('catalog_product', 'is_wrapable', array('group' => 'General', 'type' => 'int', 'backend' => '', 'frontend' => '', 'label' => 'Enable Wrapable Product', 'note' => 'Add Gift Wrap feature to this product or not.', 'input' => 'select', 'class' => '', 'source' => 'eav/entity_attribute_source_boolean', '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' => 'simple,virtual,bundle,configurable,grouped', 'is_configurable' => false));
$installer->endSetup();
<?php

/**
 * NOTICE OF LICENSE
 *
 * You may not sell, sub-license, rent or lease
 * any portion of the Software or Documentation to anyone.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade to newer
 * versions in the future.
 *
 * @category   ET
 * @package    ET_AdvancedCompare
 * @copyright  Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
 * @contacts   support@etwebsolutions.com
 * @license    http://shop.etwebsolutions.com/etws-license-free-v1/   ETWS Free License (EFL1)
 */
$installer = $this;
/* $installer Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */
$installer->startSetup();
$setup = new Mage_Catalog_Model_Resource_Eav_Mysql4_Setup('core_setup');
$setup->addAttribute('catalog_product', 'remove_compare_link', array('group' => 'General', 'type' => 'int', 'backend' => '', 'frontend' => '', 'label' => 'Remove Compare Link', 'note' => '', 'input' => 'boolean', 'class' => '', 'source' => 'eav/entity_attribute_source_boolean', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'visible' => true, 'required' => true, 'user_defined' => true, 'default' => '0', 'searchable' => false, 'filterable' => false, 'comparable' => false, 'visible_on_front' => false, 'is_configurable' => false, 'used_in_product_listing' => true, 'unique' => false));
$installer->endSetup();
<?php

Mage::register('isSecureArea', 1);
Mage::app()->setUpdateMode(false);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
$installer = $this;
$installer->startSetup();
$setup = new Mage_Catalog_Model_Resource_Eav_Mysql4_Setup('core_setup');
$setup->startSetup();
$setup->addAttribute('catalog_category', 'top_menu', array('group' => 'General Information', 'input' => 'select', 'source' => 'eav/entity_attribute_source_boolean', 'type' => 'int', 'label' => 'Top menu', 'backend' => '', 'visible' => true, 'required' => false, 'wysiwyg_enabled' => false, 'visible_on_front' => false, 'is_html_allowed_on_front' => false, 'default' => 1, 'sort_order' => '999', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL));
$topCategories = array(86, 87, 93, 95, 110);
foreach ($topCategories as $categoryId) {
    $category = Mage::getModel('catalog/category')->load($categoryId);
    $category->setTopMenu(Mage_Eav_Model_Entity_Attribute_Source_Boolean::VALUE_YES)->setStoreId(Mage_Core_Model_App::ADMIN_STORE_ID)->save();
}
$setup->endSetup();
$installer->endSetup();
<?php

$installer = $this;
$installer->startSetup();
$installer->run("\n\tALTER TABLE {$this->getTable('mgs_theme_home_blocks')} ADD `block_position` INT(11) NULL default '0' AFTER `store_id`;\n");
if (version_compare('1.9.0.1', Mage::getVersion()) == -1) {
    $setup = new Mage_Catalog_Model_Resource_Eav_Mysql4_Setup();
    $attributes = array('thumbnail' => array('type' => 'varchar', 'label' => 'Thumbnail Image', 'input' => 'image', 'backend' => 'catalog/category_attribute_backend_image', 'required' => false, 'sort_order' => 5, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 'group' => 'General Information'));
    foreach ($attributes as $code => $data) {
        $setup->addAttribute(Mage_Catalog_Model_Category::ENTITY, $code, $data);
    }
}
$installer->endSetup();
<?php

$installer = $this;
$setup = new Mage_Catalog_Model_Resource_Eav_Mysql4_Setup('core_setup');
$installer->startSetup();
$setup->run("SET NAMES utf8;\nSET FOREIGN_KEY_CHECKS = 0;\n\nDROP TABLE IF EXISTS `{$this->getTable('customdiscount_discounts')}`;\nCREATE TABLE `{$this->getTable('customdiscount_discounts')}` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `email` varchar(255) NOT NULL,\n  `sku` varchar(255) NOT NULL,\n  `custom_price` varchar(255) NOT NULL,\n  `hash` varchar(255) NOT NULL,\n  `used` int(11) NOT NULL,\n  PRIMARY KEY (`id`)\n) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;");
$setup->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'customdiscount', array('group' => 'General', 'input' => 'select', 'type' => 'int', 'label' => Mage::helper('customdiscount')->__('Discount request enabled'), 'required' => 0, 'user_defined' => 1, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'source' => 'eav/entity_attribute_source_boolean', 'visible' => 1, 'searchable' => 0, 'filterable' => 0, 'comparable' => 0, 'visible_on_front' => 1, 'visible_in_advanced_search' => 0, 'is_html_allowed_on_front' => 0, 'used_in_product_listing' => 0, 'position' => 10));
$installer->endSetup();
<?php

/* @var $installer Mage_Sales_Model_Entity_Setup */
$installer = $this;
$conn = $this->_conn;
$installer->startSetup();
$eav = new Mage_Catalog_Model_Resource_Eav_Mysql4_Setup('catalog_setup');
$eav->addAttribute('catalog_product', 'udprod_attributes_changed', array('type' => 'text', 'backend' => 'eav/entity_attribute_backend_serialized', 'visible' => 0, 'required' => 0, 'label' => 'uMarketplace Changed Data'));
$eav->addAttribute('catalog_product', 'udprod_cfg_simples_added', array('type' => 'text', 'backend' => 'eav/entity_attribute_backend_serialized', 'visible' => 0, 'required' => 0, 'label' => 'uMarketplace Simples Added'));
$eav->addAttribute('catalog_product', 'udprod_cfg_simples_removed', array('type' => 'text', 'backend' => 'eav/entity_attribute_backend_serialized', 'visible' => 0, 'required' => 0, 'label' => 'uMarketplace Simples Removed'));
$eav->addAttribute('catalog_product', 'udprod_pending_notified', array('type' => 'int', 'visible' => 0, 'required' => 0, 'label' => 'uMarketplace Pending Notified'));
$eav->addAttribute('catalog_product', 'udprod_approved_notified', array('type' => 'int', 'visible' => 0, 'required' => 0, 'label' => 'uMarketplace Approved Notified'));
$eav->addAttribute('catalog_product', 'udprod_fix_notified', array('type' => 'int', 'visible' => 0, 'required' => 0, 'label' => 'uMarketplace Fix Notified'));
$eav->addAttribute('catalog_product', 'udprod_pending_admin_notified', array('type' => 'int', 'visible' => 0, 'required' => 0, 'label' => 'uMarketplace Pending Notified'));
$eav->addAttribute('catalog_product', 'udprod_approved_admin_notified', array('type' => 'int', 'visible' => 0, 'required' => 0, 'label' => 'uMarketplace Approved Notified'));
$eav->addAttribute('catalog_product', 'udprod_fix_admin_notified', array('type' => 'int', 'visible' => 0, 'required' => 0, 'label' => 'uMarketplace Fix Notified'));
$eav->addAttribute('catalog_product', 'udprod_pending_notify', array('type' => 'int', 'visible' => 0, 'required' => 0, 'label' => 'uMarketplace Pending Notify'));
$eav->addAttribute('catalog_product', 'udprod_approved_notify', array('type' => 'int', 'visible' => 0, 'required' => 0, 'label' => 'uMarketplace Approved Notify'));
$eav->addAttribute('catalog_product', 'udprod_fix_notify', array('type' => 'int', 'visible' => 0, 'required' => 0, 'label' => 'uMarketplace Fix Notify'));
$eav->addAttribute('catalog_product', 'udprod_fix_description', array('type' => 'text', 'input' => 'textarea', 'label' => 'Fix Description', 'user_defined' => 1, 'required' => 0, 'group' => 'Fixes Required From Vendor'));
$installer->endSetup();
<?php

/**
 * Unirgy_NotifyVendor extension
 *
 * 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
 *
 * @category   Unirgy
 * @package    Unirgy_NotifyVendor
 * @copyright  Copyright (c) 2008 Unirgy LLC
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
/**
 * @category   Unirgy
 * @package    Unirgy_NotifyVendor
 * @author     Boris (Moshe) Gurevich <*****@*****.**>
 */
$this->startSetup();
$cEav = new Mage_Catalog_Model_Resource_Eav_Mysql4_Setup('catalog_setup');
$cEav->addAttribute('catalog_product', 'unotify_vendor', array('type' => 'int', 'input' => 'select', 'label' => 'Notify Vendor', 'global' => 0, 'user_defined' => 1, 'required' => 0, 'visible' => 1));
$this->endSetup();
예제 #11
0
 *
 * 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://www.unirgy.com/LICENSE-M1.txt
 *
 * @category   Unirgy
 * @package    Unirgy_Dropship
 * @copyright  Copyright (c) 2008-2009 Unirgy LLC (http://www.unirgy.com)
 * @license    http:///www.unirgy.com/LICENSE-M1.txt
 */
$this->startSetup();
$this->run("\n\nCREATE TABLE IF NOT EXISTS `{$this->getTable('udropship_shipping')}` (\n`shipping_id` int(10) unsigned NOT NULL auto_increment,\n`shipping_code` varchar(30) NOT NULL,\n`shipping_title` varchar(100) NOT NULL,\n`days_in_transit` varchar(20) NOT NULL,\nPRIMARY KEY  (`shipping_id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\nCREATE TABLE IF NOT EXISTS `{$this->getTable('udropship_shipping_method')}` (\n`shipping_id` int(10) unsigned NOT NULL,\n`carrier_code` varchar(30) NOT NULL,\n`method_code` varchar(30) NOT NULL,\nKEY `FK_udropship_shipping_method` (`shipping_id`),\nCONSTRAINT `FK_udropship_shipping_method` FOREIGN KEY (`shipping_id`) REFERENCES `{$this->getTable('udropship_shipping')}` (`shipping_id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE IF NOT EXISTS `{$this->getTable('udropship_shipping_website')}` (\n`shipping_id` int(10) unsigned NOT NULL,\n`website_id` smallint(5) unsigned NOT NULL,\nUNIQUE KEY `website_id` (`website_id`,`shipping_id`),\nKEY `FK_udropship_shipping_website` (`shipping_id`),\nCONSTRAINT `FK_udropship_shipping_website` FOREIGN KEY (`shipping_id`) REFERENCES `{$this->getTable('udropship_shipping')}` (`shipping_id`) ON DELETE CASCADE ON UPDATE CASCADE,\nCONSTRAINT `FK_udropship_shipping_website_pk` FOREIGN KEY (`website_id`) REFERENCES `{$this->getTable('core_website')}` (`website_id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\nCREATE TABLE IF NOT EXISTS `{$this->getTable('udropship_vendor')}` (\n`vendor_id` int(11) unsigned NOT NULL auto_increment,\n`vendor_name` varchar(255) NOT NULL,\n`vendor_attn` varchar(255) NOT NULL,\n`email` varchar(127) NOT NULL,\n`street` varchar(255) NOT NULL,\n`city` varchar(50) NOT NULL,\n`zip` varchar(20) default NULL,\n`country_id` char(2) NOT NULL,\n`region_id` mediumint(8) unsigned default NULL,\n`region` varchar(50) default NULL,\n`telephone` varchar(50) default NULL,\n`status` char(1) NOT NULL,\n`password` varchar(50) default NULL,\n`password_hash` varchar(100) default NULL,\n`password_enc` varchar(100) default NULL,\n`carrier_code` varchar(50) default NULL,\n`notify_new_order` tinyint not null default 1,\n`label_type` varchar(10) not null default 'PDF',\n`test_mode` tinyint(1) not null default 0,\n`handling_fee` decimal(12,5) not null,\n`ups_shipper_number` varchar(6),\n`custom_data_combined` text,\n`custom_vars_combined` text,\n`email_template` int(7) unsigned,\n`url_key` varchar(64),\n`random_hash` varchar(64),\n`created_at` timestamp,\nPRIMARY KEY  (`vendor_id`),\nKEY `IDX_STATUS` (`status`),\nKEY `IDX_HASH` (`random_hash`),\nKEY `IDX_CREATED` (`created_at`),\nUNIQUE `IDX_URL_KEY` (`url_key`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\nCREATE TABLE IF NOT EXISTS `{$this->getTable('udropship_vendor_product')}` (\n`vendor_product_id` int(11) unsigned NOT NULL auto_increment,\n`vendor_id` int(10) unsigned NOT NULL,\n`product_id` int(10) unsigned NOT NULL,\n`priority` smallint(5) unsigned NOT NULL,\n`carrier_code` varchar(50) default NULL,\n`vendor_sku` varchar(64) default NULL,\n`vendor_cost` decimal(12,4),\n`stock_qty` decimal(12,4),\nPRIMARY KEY  (`vendor_product_id`),\nUNIQUE `IDX_vendor_product_unique` (`vendor_id`, `product_id`),\nKEY `FK_udropship_vendor_product` (`vendor_id`),\nKEY `FK_udropship_vendor_product_entity` (`product_id`),\nCONSTRAINT `FK_udropship_vendor_product` FOREIGN KEY (`vendor_id`) REFERENCES `{$this->getTable('udropship_vendor')}` (`vendor_id`) ON DELETE CASCADE ON UPDATE CASCADE,\nCONSTRAINT `FK_udropship_vendor_product_entity` FOREIGN KEY (`product_id`) REFERENCES `{$this->getTable('catalog_product_entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\nCREATE TABLE IF NOT EXISTS `{$this->getTable('udropship_vendor_shipping')}` (\n`vendor_shipping_id` int(11) unsigned NOT NULL auto_increment,\n`vendor_id` int(11) unsigned NOT NULL,\n`shipping_id` int(10) unsigned NOT NULL,\n`account_id` varchar(50) default NULL,\n`price_type` tinyint(4) default NULL,\n`price` decimal(12,4) default NULL,\n`priority` smallint(5) unsigned NOT NULL,\n`handling_fee` decimal(12,4) NOT NULL,\n`carrier_code` varchar(50) NULL,\n`est_carrier_code` varchar(50) NULL,\nPRIMARY KEY  (`vendor_shipping_id`),\nUNIQUE `IDX_VENDOR_SHIPPING` (`vendor_id`, `shipping_id`),\nKEY `FK_udropship_vendor_shipping_vendor` (`vendor_id`),\nKEY `FK_udropship_vendor_shipping` (`shipping_id`),\nCONSTRAINT `FK_udropship_vendor_shipping` FOREIGN KEY (`shipping_id`) REFERENCES `{$this->getTable('udropship_shipping')}` (`shipping_id`) ON DELETE CASCADE ON UPDATE CASCADE,\nCONSTRAINT `FK_udropship_vendor_shipping_vendor` FOREIGN KEY (`vendor_id`) REFERENCES `{$this->getTable('udropship_vendor')}` (`vendor_id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\nCREATE TABLE IF NOT EXISTS `{$this->getTable('udropship_label_batch')}` (\nbatch_id int unsigned not null auto_increment primary key,\ntitle varchar(255) not null,\nlabel_type varchar(10) not null default 'PDF',\ncreated_at datetime not null,\nvendor_id int unsigned not null,\nusername varchar(50) not null,\nshipment_cnt mediumint unsigned not null,\nkey(vendor_id),\nkey(created_at)\n) engine=innodb default charset=utf8;\n\nCREATE TABLE IF NOT EXISTS `{$this->getTable('udropship_label_shipment')}` (\nbatch_id int unsigned not null,\norder_id int unsigned not null,\nshipment_id int unsigned not null,\nunique(batch_id, order_id, shipment_id),\nkey(order_id),\nkey(shipment_id)\n) engine=innodb default charset=utf8;\n\nCREATE TABLE IF NOT EXISTS `{$this->getTable('udropship_vendor_statement')}` (\n`vendor_statement_id` int(11) unsigned NOT NULL auto_increment,\n`vendor_id` int(10) unsigned NOT NULL,\n`statement_id` varchar(30) NOT NULL,\n`statement_filename` varchar(128) not null,\n`statement_period` varchar(20) not null,\n`order_date_from` datetime not null,\n`order_date_to` datetime not null,\n`total_orders` mediumint not null,\n`total_payout` decimal(12,4) not null,\n`created_at` datetime not null,\n`orders_data` longtext not null,\n`email_sent` tinyint not null,\nPRIMARY KEY  (`vendor_statement_id`),\nKEY `FK_udropship_vendor_statement` (`vendor_id`),\nKEY `IDX_statement_period` (`statement_period`),\nKEY `IDX_vendor_id` (`vendor_id`),\nKEY `IDX_email_sent` (`email_sent`),\nUNIQUE `IDX_statement_id` (`statement_id`),\nCONSTRAINT `FK_udropship_vendor_statement` FOREIGN KEY (`vendor_id`) REFERENCES `{$this->getTable('udropship_vendor')}` (`vendor_id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n");
$cEav = new Mage_Catalog_Model_Resource_Eav_Mysql4_Setup('catalog_setup');
$eav = new Mage_Sales_Model_Mysql4_Setup('sales_setup');
$cEav->addAttribute('catalog_product', 'udropship_vendor', array('type' => 'int', 'input' => 'select', 'label' => 'Dropship Vendor', 'group' => 'General', 'global' => 2, 'user_defined' => 1, 'required' => 0, 'visible' => 1, 'backend' => 'Unirgy_Dropship_Model_Mysql4_Vendor_Backend', 'source' => 'Unirgy_Dropship_Model_Vendor_Source'));
if (version_compare(Mage::getVersion(), '1.3.0', '>=')) {
    $cEav->updateAttribute('catalog_product', 'udropship_vendor', 'used_in_product_listing', 1);
}
if (version_compare(Mage::getVersion(), '1.4.0', '>=')) {
    $cEav->updateAttribute('catalog_product', 'udropship_vendor', 'is_used_for_price_rules', 1);
}
$w = $this->_conn;
$w->addColumn($this->getTable('sales_flat_quote_address'), 'udropship_shipping_details', 'text');
$w->addColumn($this->getTable('sales_flat_quote_item'), 'udropship_vendor', 'int unsigned');
$w->addColumn($this->getTable('sales_flat_quote_address_item'), 'udropship_vendor', 'int unsigned');
$w->addColumn($this->getTable('sales_flat_order_item'), 'udropship_vendor', 'int unsigned');
if (Mage::helper('udropship')->isSalesFlat()) {
    $w->addColumn($this->getTable('sales_flat_order'), 'udropship_status', 'tinyint not null');
    try {
        $w->addKey($this->getTable('sales_flat_order'), 'udropship_status', 'udropship_status', 'index');
 * @category   Uecommerce
 * @package    Uecommerce_Mundipagg
 * @copyright  Copyright (c) 2012 Uecommerce (http://www.uecommerce.com.br/)
 * @license    http://www.uecommerce.com.br/
 */
/**
 * Mundipagg Payment module
 *
 * @category   Uecommerce
 * @package    Uecommerce_Mundipagg
 * @author     Uecommerce Dev Team
 */
$installer = new Mage_Catalog_Model_Resource_Eav_Mysql4_Setup('core_setup');
$installer->startSetup();
$reader = Mage::getSingleton('core/resource')->getConnection('core_read');
$result = $reader->query('select attribute_code from ' . $prefix . 'eav_attribute WHERE attribute_code = "mundipagg_recurrent"')->fetchAll();
if (empty($result)) {
    $recurrent = array('attribute_set' => 'Default', 'group' => 'Recorrência', 'label' => 'Produto de assinatura?', 'visible' => true, 'type' => 'int', 'input' => 'select', 'source' => 'eav/entity_attribute_source_boolean', 'system' => false, 'required' => true, 'used_in_product_listing' => true, 'is_visible_on_front' => true, 'visible_on_front' => true);
    $installer->addAttribute('catalog_product', 'mundipagg_recurrent', $recurrent);
}
$result = $reader->query('select attribute_code from ' . $prefix . 'eav_attribute WHERE attribute_code = "mundipagg_frequency_enum"')->fetchAll();
if (empty($result)) {
    $frequency_enum = array('attribute_set' => 'Default', 'group' => 'Recorrência', 'label' => 'Frequência', 'note' => 'O valor colocado na aba "Prices / Preços" sera o valor pago por: semana / mensal / trimestral / semestral / anual', 'visible' => true, 'type' => 'varchar', 'input' => 'select', 'system' => false, 'required' => true, 'used_in_product_listing' => true, 'is_visible_on_front' => true, 'visible_on_front' => true, 'frontend_input' => 'select', 'source' => 'mundipagg/source_frequency');
    $installer->addAttribute('catalog_product', 'mundipagg_frequency_enum', $frequency_enum);
}
$result = $reader->query('select attribute_code from ' . $prefix . 'eav_attribute WHERE attribute_code = "mundipagg_recurrences"')->fetchAll();
if (empty($result)) {
    $recurrences = array('attribute_set' => 'Default', 'group' => 'Recorrência', 'label' => 'Número de Ciclos', 'note' => 'Número de ciclos que serão cobrados antes de uma renovação da parte do cliente.', 'visible' => true, 'type' => 'int', 'input' => 'text', 'system' => false, 'required' => true, 'used_in_product_listing' => true, 'is_visible_on_front' => true, 'visible_on_front' => true, 'frontend_input' => 'text', 'default' => '1');
    $installer->addAttribute('catalog_product', 'mundipagg_recurrences', $recurrences);
}
$installer->endSetup();
<?php

/* @var $installer Mage_Sales_Model_Entity_Setup */
$installer = $this;
$conn = $this->_conn;
$installer->startSetup();
$this->run("\n\nCREATE TABLE IF NOT EXISTS `{$this->getTable('udtiership_delivery_type')}` (\n  `delivery_type_id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `delivery_code` varchar(64) DEFAULT NULL,\n  `delivery_title` varchar(128) DEFAULT NULL,\n  `sort_order` int(10) unsigned DEFAULT NULL,\n  PRIMARY KEY (`delivery_type_id`),\n  UNIQUE KEY `UNQ_DELIVERY_CODE` (`delivery_code`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\nCREATE TABLE IF NOT EXISTS `{$this->getTable('udtiership_simple_rates')}` (\n  `rate_id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `delivery_type_id` int(10) unsigned NOT NULL,\n  `customer_shipclass_id` text,\n  `cost` decimal(12,4) NOT NULL DEFAULT '0.0000',\n  `additional` decimal(12,4) NOT NULL DEFAULT '0.0000',\n  `sort_order` int(10) unsigned DEFAULT NULL,\n  PRIMARY KEY (`rate_id`),\n  KEY `FK_TS_SIMPLE_DELIVERY_TYPE_ID` (`delivery_type_id`),\n  CONSTRAINT `FK_TS_SIMPLE_DELIVERY_TYPE_ID` FOREIGN KEY (`delivery_type_id`) REFERENCES `{$this->getTable('udtiership_delivery_type')}` (`delivery_type_id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\nCREATE TABLE IF NOT EXISTS `{$this->getTable('udtiership_vendor_simple_rates')}` (\n  `rate_id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `vendor_id` int(10) unsigned DEFAULT NULL,\n  `delivery_type_id` int(10) unsigned NOT NULL,\n  `customer_shipclass_id` text,\n  `cost` decimal(12,4) NOT NULL DEFAULT '0.0000',\n  `additional` decimal(12,4) NOT NULL DEFAULT '0.0000',\n  `sort_order` int(10) unsigned DEFAULT NULL,\n  PRIMARY KEY (`rate_id`),\n  KEY `FK_TS_VSIMPLE_DELIVERY_TYPE_ID` (`delivery_type_id`),\n  KEY `FK_TS_SIMPLE_VENDOR` (`vendor_id`),\n  CONSTRAINT `FK_TS_SIMPLE_VENDOR` FOREIGN KEY (`vendor_id`) REFERENCES `{$this->getTable('udropship_vendor')}` (`vendor_id`) ON DELETE CASCADE ON UPDATE CASCADE,\n  CONSTRAINT `FK_TS_VSIMPLE_DELIVERY_TYPE_ID` FOREIGN KEY (`delivery_type_id`) REFERENCES `{$this->getTable('udtiership_delivery_type')}` (`delivery_type_id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\nCREATE TABLE IF NOT EXISTS `{$this->getTable('udtiership_simple_cond_rates')}` (\n  `rate_id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `delivery_type_id` int(10) unsigned NOT NULL,\n  `customer_shipclass_id` text,\n  `condition_name` varchar(128),\n  `condition` text,\n  `sort_order` int(10) unsigned DEFAULT NULL,\n  PRIMARY KEY (`rate_id`),\n  KEY `FK_TS_SIMPLE_COND_DELIVERY_TYPE_ID` (`delivery_type_id`),\n  CONSTRAINT `FK_TS_SIMPLE_COND_DELIVERY_TYPE_ID` FOREIGN KEY (`delivery_type_id`) REFERENCES `{$this->getTable('udtiership_delivery_type')}` (`delivery_type_id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\nCREATE TABLE IF NOT EXISTS `{$this->getTable('udtiership_vendor_simple_cond_rates')}` (\n  `rate_id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `vendor_id` int(10) unsigned DEFAULT NULL,\n  `delivery_type_id` int(10) unsigned NOT NULL,\n  `customer_shipclass_id` text,\n  `condition_name` varchar(128),\n  `condition` text,\n  `sort_order` int(10) unsigned DEFAULT NULL,\n  PRIMARY KEY (`rate_id`),\n  KEY `FK_TS_VSIMPLE_COND_DELIVERY_TYPE_ID` (`delivery_type_id`),\n  KEY `FK_TS_SIMPLE_COND_VENDOR` (`vendor_id`),\n  CONSTRAINT `FK_TS_SIMPLE_COND_VENDOR` FOREIGN KEY (`vendor_id`) REFERENCES `{$this->getTable('udropship_vendor')}` (`vendor_id`) ON DELETE CASCADE ON UPDATE CASCADE,\n  CONSTRAINT `FK_TS_VSIMPLE_COND_DELIVERY_TYPE_ID` FOREIGN KEY (`delivery_type_id`) REFERENCES `{$this->getTable('udtiership_delivery_type')}` (`delivery_type_id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\nCREATE TABLE IF NOT EXISTS `{$this->getTable('udtiership_rates')}` (\n  `rate_id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `delivery_type_id` int(10) unsigned NOT NULL,\n  `category_ids` text,\n  `vendor_shipclass_id` text,\n  `customer_shipclass_id` text,\n  `cost` decimal(12,4) NOT NULL DEFAULT '0.0000',\n  `cost_extra` text,\n  `max_cost` decimal(12,4) NOT NULL DEFAULT '0.0000',\n  `additional` decimal(12,4) NOT NULL DEFAULT '0.0000',\n  `additional_extra` text,\n  `max_additional` decimal(12,4) NOT NULL DEFAULT '0.0000',\n  `handling` decimal(12,4) NOT NULL DEFAULT '0.0000',\n  `handling_extra` text,\n  `max_handling` decimal(12,4) NOT NULL DEFAULT '0.0000',\n  `sort_order` int(10) unsigned DEFAULT NULL,\n  PRIMARY KEY (`rate_id`),\n  KEY `FK_TS_DELIVERY_TYPE_ID` (`delivery_type_id`),\n  CONSTRAINT `FK_TS_DELIVERY_TYPE_ID` FOREIGN KEY (`delivery_type_id`) REFERENCES `{$this->getTable('udtiership_delivery_type')}` (`delivery_type_id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\nCREATE TABLE IF NOT EXISTS `{$this->getTable('udtiership_vendor_rates')}` (\n  `rate_id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `vendor_id` int(10) unsigned DEFAULT NULL,\n  `delivery_type_id` int(10) unsigned NOT NULL,\n  `category_ids` text,\n  `customer_shipclass_id` text,\n  `cost` decimal(12,4) NOT NULL DEFAULT '0.0000',\n  `cost_extra` text,\n  `additional` decimal(12,4) NOT NULL DEFAULT '0.0000',\n  `additional_extra` text,\n  `handling` decimal(12,4) NOT NULL DEFAULT '0.0000',\n  `handling_extra` text,\n  `sort_order` int(10) unsigned DEFAULT NULL,\n  PRIMARY KEY (`rate_id`),\n  KEY `FK_TS_VDELIVERY_TYPE_ID` (`delivery_type_id`),\n  KEY `FK_TS_VENDOR` (`vendor_id`),\n  CONSTRAINT `FK_TS_VENDOR` FOREIGN KEY (`vendor_id`) REFERENCES `{$this->getTable('udropship_vendor')}` (`vendor_id`) ON DELETE CASCADE ON UPDATE CASCADE,\n  CONSTRAINT `FK_TS_VDELIVERY_TYPE_ID` FOREIGN KEY (`delivery_type_id`) REFERENCES `{$this->getTable('udtiership_delivery_type')}` (`delivery_type_id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\n");
$conn->addColumn($this->getTable('udropship/vendor'), 'tiership_use_v2_rates', 'tinyint default 0');
$eav = new Mage_Catalog_Model_Resource_Eav_Mysql4_Setup('catalog_setup');
$eav->addAttribute('catalog_product', 'udtiership_use_custom', array('type' => 'int', 'source' => 'eav/entity_attribute_source_boolean', 'input' => 'select', 'label' => 'Use Product Specific Tier Shipping Rates', 'input_renderer' => 'udtiership/productAttribute_form_useCustom', 'user_defined' => 1, 'required' => 0, 'group' => 'Dropship Tier Shipping'));
$eav->addAttribute('catalog_product', 'udtiership_rates', array('type' => 'text', 'backend' => 'udtiership/productAttributeBackend_rates', 'label' => 'Tier Shipping Rates', 'input_renderer' => 'udtiership/productAttribute_form_rates', 'user_defined' => 1, 'required' => 0, 'group' => 'Dropship Tier Shipping'));
$installer->endSetup();