예제 #1
0
 /**
  * check the database for expected tables, columns and attributes
  *
  * @param Fooman_Common_Model_Selftester $selftester
  *
  * @return bool
  */
 public function dbCheck(Fooman_Common_Model_Selftester $selftester)
 {
     $localError = false;
     $selftester->messages[] = "Checking database";
     $installer = new Mage_Sales_Model_Mysql4_Setup('sales_setup');
     $installer->startSetup();
     foreach ($selftester->_getDbFields() as $field) {
         switch ($field[0]) {
             case 'eav':
                 $localError = $this->_dbCheckEav($selftester, $field, $installer, $localError);
                 break;
             case 'sql-column':
                 $localError = $this->_dbCheckSqlColumn($selftester, $field, $installer, $localError);
                 break;
             case 'table':
                 $localError = $this->_dbCheckSqlTable($selftester, $field, $installer, $localError);
                 break;
             case 'constraint':
                 $localError = $this->_dbCheckForeignKeyConstraint($selftester, $field, $installer, $localError);
                 break;
             case 'row-data':
                 $localError = $this->_dbCheckDbRow($selftester, $field, $installer, $localError);
                 break;
         }
     }
     $installer->endSetup();
     if (empty($localError)) {
         return true;
     } else {
         if ($this->_dbOkay == false) {
             $selftester->messages[] = "<p>The selftest has found some problems with your database install.\n                    You can attempt to fix this by clicking this <a href=\"" . htmlentities(Mage::app()->getRequest()->getServer('PHP_SELF', '')) . "?fix=true\">link</a>.</p><p style=\"color:red;\"><em>A DATABASE BACKUP IS strongly\n                    RECOMMENDED BEFORE ATTEMPTING THIS!</em></p>";
         }
         return false;
     }
 }
예제 #2
0
 /**
  * Prepare attribute values to save
  *
  * @param array $attr
  * @return array
  */
 protected function _prepareValues($attr)
 {
     $data = parent::_prepareValues($attr);
     if ($this->_currentEntityTypeId == 'customer') {
         $data = array_merge($data, array('is_visible' => $this->_getValue($attr, 'visible', 1), 'is_visible_on_front' => $this->_getValue($attr, 'visible_on_front', 0), 'input_filter' => $this->_getValue($attr, 'input_filter', ''), 'lines_to_divide_multiline' => $this->_getValue($attr, 'lines_to_divide', 0), 'min_text_length' => $this->_getValue($attr, 'min_text_length', 0), 'max_text_length' => $this->_getValue($attr, 'max_text_length', 0)));
     }
     return $data;
 }
예제 #3
0
 /**
  * Remove entity attribute. Overwritten for flat entities support
  *
  * @param mixed $entityTypeId
  * @param mixed $code
  *
  * @return $this|Mage_Eav_Model_Entity_Setup
  */
 public function removeAttribute($entityTypeId, $code)
 {
     if (isset($this->_flatEntityTables[$entityTypeId]) && $this->_flatTableExist($this->_flatEntityTables[$entityTypeId])) {
         $this->_removeFlatAttribute($this->_flatEntityTables[$entityTypeId], $code);
         $this->_removeGridAttribute($this->_flatEntityTables[$entityTypeId], $code, $entityTypeId);
     } else {
         parent::removeAttribute($entityTypeId, $code);
     }
     return $this;
 }
$this->_conn->addColumn($this->getTable('sales_flat_quote_address'), 'cod_tax_amount', 'decimal(12,4)');
$this->_conn->addColumn($this->getTable('sales_flat_quote_address'), 'base_cod_tax_amount', 'decimal(12,4)');
$eav = new Mage_Eav_Model_Entity_Setup('sales_setup');
$eav->addAttribute('order', 'cod_fee', array('type' => 'decimal'));
$eav->addAttribute('order', 'base_cod_fee', array('type' => 'decimal'));
$eav->addAttribute('order', 'cod_tax_amount', array('type' => 'decimal'));
$eav->addAttribute('order', 'base_cod_tax_amount', array('type' => 'decimal'));
$eav->addAttribute('order', 'cod_fee_invoiced', array('type' => 'decimal'));
$eav->addAttribute('order', 'base_cod_fee_invoiced', array('type' => 'decimal'));
$eav->addAttribute('order', 'cod_tax_amount_invoiced', array('type' => 'decimal'));
$eav->addAttribute('order', 'base_cod_tax_amount_invoiced', array('type' => 'decimal'));
$eav->addAttribute('invoice', 'cod_fee', array('type' => 'decimal'));
$eav->addAttribute('invoice', 'base_cod_fee', array('type' => 'decimal'));
$eav->addAttribute('invoice', 'cod_tax_amount', array('type' => 'decimal'));
$eav->addAttribute('invoice', 'base_cod_tax_amount', array('type' => 'decimal'));
$sales = new Mage_Sales_Model_Mysql4_Setup('sales_setup');
$sales->addAttribute('order', 'cod_fee', array('type' => 'decimal'));
$sales->addAttribute('order', 'base_cod_fee', array('type' => 'decimal'));
$sales->addAttribute('order', 'cod_fee_invoiced', array('type' => 'decimal'));
$sales->addAttribute('order', 'base_cod_fee_invoiced', array('type' => 'decimal'));
$sales->addAttribute('order', 'cod_tax_amount', array('type' => 'decimal'));
$sales->addAttribute('order', 'base_cod_tax_amount', array('type' => 'decimal'));
$sales->addAttribute('order', 'cod_tax_amount_invoiced', array('type' => 'decimal'));
$sales->addAttribute('order', 'base_cod_tax_amount_invoiced', array('type' => 'decimal'));
$sales->addAttribute('invoice', 'cod_fee', array('type' => 'decimal'));
$sales->addAttribute('invoice', 'base_cod_fee', array('type' => 'decimal'));
$sales->addAttribute('invoice', 'cod_tax_amount', array('type' => 'decimal'));
$sales->addAttribute('invoice', 'base_cod_tax_amount', array('type' => 'decimal'));
$sales->addAttribute('quote', 'cod_fee', array('type' => 'decimal'));
$sales->addAttribute('quote', 'base_cod_fee', array('type' => 'decimal'));
$sales->addAttribute('quote', 'cod_tax_amount', array('type' => 'decimal'));
$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'));
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to info@idealiagroup.com so we can send you a copy immediately.
 *
 * @category   MSP
 * @package    MSP_CashOnDelivery
 * @copyright  Copyright (c) 2013 IDEALIAGroup srl (http://www.idealiagroup.com)
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
$installer = $this;
$installer->startSetup();
$setup = new Mage_Sales_Model_Mysql4_Setup('core_setup');
$setup->startSetup();
$setup->addAttribute('invoice', 'msp_base_cashondelivery_incl_tax', array('type' => 'decimal', 'visible' => false, 'required' => true));
$setup->addAttribute('invoice', 'msp_cashondelivery_incl_tax', array('type' => 'decimal', 'visible' => false, 'required' => true));
$setup->addAttribute('order', 'msp_base_cashondelivery_incl_tax', array('type' => 'decimal', 'visible' => false, 'required' => true));
$setup->addAttribute('order', 'msp_cashondelivery_incl_tax', array('type' => 'decimal', 'visible' => false, 'required' => true));
$setup->addAttribute('quote', 'msp_base_cashondelivery_incl_tax', array('type' => 'decimal', 'visible' => false, 'required' => true));
$setup->addAttribute('quote', 'msp_cashondelivery_incl_tax', array('type' => 'decimal', 'visible' => false, 'required' => true));
$setup->addAttribute('order_address', 'msp_base_cashondelivery_incl_tax', array('type' => 'decimal', 'visible' => false, 'required' => true));
$setup->addAttribute('order_address', 'msp_cashondelivery_incl_tax', array('type' => 'decimal', 'visible' => false, 'required' => true));
$setup->addAttribute('quote_address', 'msp_base_cashondelivery_incl_tax', array('type' => 'decimal', 'visible' => false, 'required' => true));
$setup->addAttribute('quote_address', 'msp_cashondelivery_incl_tax', array('type' => 'decimal', 'visible' => false, 'required' => true));
$setup->endSetup();
$installer->endSetup();
예제 #7
0
<?php

/**
 * @package		Eternal_Megamenu
 * @author		Eternal Friend
 * @copyright	Copyright 2014
 */
require_once 'app/Mage.php';
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
$installer = new Mage_Sales_Model_Mysql4_Setup();
//Mage_Eav_Model_Entity_Setup,Mage_Catalog_Model_Resource_Setup,
$installer->startSetup();
$installer->updateAttribute('catalog_category', 'sw_cat_block_type', 'is_required', 0, '10');
$installer->updateAttribute('catalog_category', 'sw_cat_static_width', 'note', 'The width of the static width megamenu popup. eg: 600px', '11');
$installer->updateAttribute('catalog_category', 'sw_cat_block_columns', 'is_required', 0, '12');
$installer->updateAttribute('catalog_category', 'sw_cat_block_top', 'is_required', 0, '31');
$installer->updateAttribute('catalog_category', 'sw_cat_left_block_width', 'is_required', 0, '40');
$installer->updateAttribute('catalog_category', 'sw_cat_block_left', 'is_required', 0, '41');
$installer->updateAttribute('catalog_category', 'sw_cat_right_block_width', 'is_required', 0, '50');
$installer->updateAttribute('catalog_category', 'sw_cat_block_right', 'is_required', 0, '51');
$installer->updateAttribute('catalog_category', 'sw_cat_block_bottom', 'is_required', 0, '60');
$installer->updateAttribute('catalog_category', 'sw_cat_label', 'is_required', 0, '14');
$installer->updateAttribute('catalog_category', 'sw_cat_float_type', 'is_required', 0, '13');
$installer->addAttribute('catalog_category', 'sw_icon_image', array('type' => 'varchar', 'label' => 'Icon Image', 'input' => 'image', 'backend' => 'catalog/category_attribute_backend_image', 'required' => false, 'sort_order' => 15, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 'group' => 'Menu'));
$installer->addAttribute('catalog_category', 'sw_font_icon', array('group' => 'Menu', 'label' => 'Font Icon Class', 'note' => 'If this category has no "Icon Image", font icon will be shown. example to input: icon-dollar', 'type' => 'text', 'input' => 'text', 'visible' => true, 'required' => false, 'backend' => '', 'frontend' => '', 'searchable' => false, 'filterable' => false, 'comparable' => false, 'user_defined' => true, 'visible_on_front' => true, 'wysiwyg_enabled' => true, 'is_html_allowed_on_front' => true, 'sort_order' => 16, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE));
$installer->endSetup();
예제 #8
0
<?php

$this->startSetup();
$setup = new Mage_Sales_Model_Mysql4_Setup('sales_setup');
$setup->addAttribute('order', 'byjuno_credit_rating', array('type' => Varien_Db_Ddl_Table::TYPE_TEXT));
$setup->addAttribute('order', 'byjuno_credit_level', array('type' => Varien_Db_Ddl_Table::TYPE_TEXT));
$this->endSetup();
/**
 * Magestore
 * 
 * NOTICE OF LICENSE
 * 
 * This source file is subject to the Magestore.com license that is
 * available through the world-wide-web at this URL:
 * http://www.magestore.com/license-agreement.html
 * 
 * DISCLAIMER
 * 
 * Do not edit or add to this file if you wish to upgrade this extension to newer
 * version in the future.
 * 
 * @category    Magestore
 * @package     Magestore_RewardPointsRule
 * @copyright   Copyright (c) 2012 Magestore (http://www.magestore.com/)
 * @license     http://www.magestore.com/license-agreement.html
 */
/** @var $installer Magestore_RewardPointsRule_Model_Mysql4_Setup */
$installer = $this;
$installer->startSetup();
if (version_compare(Mage::getVersion(), '1.4.1.0', '>=')) {
    $installer->getConnection()->addColumn($this->getTable('sales/invoice'), 'rewardpoints_earn', 'int(11) NOT NULL default 0');
    $installer->getConnection()->addColumn($this->getTable('sales/creditmemo'), 'rewardpoints_earn', 'int(11) NOT NULL default 0');
} else {
    $setup = new Mage_Sales_Model_Mysql4_Setup('sales_setup');
    $setup->addAttribute('invoice', 'rewardpoints_earn', array('type' => 'ịnt'));
    $setup->addAttribute('creditmemo', 'rewardpoints_earn', array('type' => 'int'));
}
$installer->endSetup();
예제 #10
0
<?php

//安装2,生成属性
require_once 'app/Mage.php';
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
$installer = new Mage_Sales_Model_Mysql4_Setup();
//Mage_Eav_Model_Entity_Setup,Mage_Catalog_Model_Resource_Setup,
/*
测试增加自定义的商品属性,样例
$installer = new Mage_Catalog_Model_Resource_Setup();
$installer->startSetup();
$installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, $tradeCode, array(
        'group' => $profileGroupName,
        'sort_order' => 1,
        'type' => 'varchar',
        'input' => 'text',
        'label' => $tradeLabel,
        'note' => $tradeNote,
        'required' => 1,
        'unique' => 0,
        'user_defined' => 1,
        'default' => '',
        # Additional attribute data - forntend
        'frontend_input_renderer' => '',
        'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
        'visible' => 1,
        'searchable' => 1,
        'filterable' => 1,
        'comparable' => 1,
        'visible_on_front' => 1,
        'wysiwyg_enabled' => 0,
예제 #11
0
<?php

//安装true,生成属性
require_once 'app/Mage.php';
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
$installer = new Mage_Sales_Model_Mysql4_Setup();
//Mage_Eav_Model_Entity_Setup,Mage_Catalog_Model_Resource_Setup,
$itemno = array('type' => 'varchar', 'backend' => '', 'frontend' => '', 'label' => 'Item No.', 'input' => 'text', 'class' => '', 'source' => '', 'default' => '', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 'visible' => true, 'required' => false, 'user_defined' => true, 'searchable' => true, 'visible_in_advanced_search' => true, 'filterable' => false, 'comparable' => false, 'visible_on_front' => true, 'used_in_product_listing' => true, 'unique' => false, 'apply_to' => '', 'is_configurable' => false);
$manufacturer = array('type' => 'varchar', 'backend' => '', 'frontend' => '', 'label' => 'Manufacturer', 'input' => 'text', 'class' => '', 'source' => '', 'default' => '', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 'visible' => true, 'required' => false, 'user_defined' => true, 'searchable' => false, 'visible_in_advanced_search' => false, 'filterable' => false, 'comparable' => false, 'visible_on_front' => true, 'used_in_product_listing' => true, 'unique' => false, 'apply_to' => '', 'is_configurable' => false);
$package = array('type' => 'varchar', 'backend' => '', 'frontend' => '', 'label' => 'Package', 'input' => 'text', 'class' => '', 'source' => '', 'default' => '', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 'visible' => true, 'required' => false, 'user_defined' => true, 'searchable' => false, 'visible_in_advanced_search' => false, 'filterable' => false, 'comparable' => false, 'visible_on_front' => true, 'used_in_product_listing' => true, 'unique' => false, 'apply_to' => '', 'is_configurable' => false);
//先清理可能存在的属性
//$installer->removeAttribute('catalog_product', 'itemno');
//$installer->removeAttribute('catalog_product', 'manufacturer');
//$installer->removeAttribute('catalog_product', 'package');
//增加属性
$installer->addAttribute('catalog_product', 'itemno', $itemno);
$installer->addAttribute('catalog_product', 'manufacturer', $manufacturer);
$installer->addAttribute('catalog_product', 'package', $package);
//加到相关组
$installer->addAttributeToSet('catalog_product', 'Default', 'General', 'itemno');
$installer->addAttributeToSet('catalog_product', 'Default', 'General', 'manufacturer');
$installer->addAttributeToSet('catalog_product', 'Default', 'General', 'package');
$installer->endSetup();
echo 'end setup1';
예제 #12
0
<?php

require_once 'app/Mage.php';
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
$installer = new Mage_Sales_Model_Mysql4_Setup();
//Mage_Eav_Model_Entity_Setup,Mage_Catalog_Model_Resource_Setup,
$installer->startSetup();
$installer->addAttribute('catalog_product', 'featured', array('type' => 'int', 'backend_type' => 'int', 'backend' => '', 'frontend' => '', 'label' => 'Is Featured', 'input' => 'boolean', 'frontend_class' => '', 'source' => 'eav/entity_attribute_source_boolean', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 'visible' => false, 'required' => false, 'user_defined' => true, 'default' => '', 'searchable' => false, 'filterable' => false, 'comparable' => false, 'visible_on_front' => false, 'unique' => false, 'apply_to' => '', 'is_configurable' => false));
$installer->addAttributeToSet('catalog_product', 'Default', 'General', 'featured');
$installer->endSetup();
 * @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\n-- DROP TABLE IF EXISTS `{$this->getTable('udropship_vendor_statement_row')}`;\nCREATE TABLE IF NOT EXISTS `{$this->getTable('udropship_vendor_statement_row')}` (\n  `row_id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `statement_id` int(10) unsigned NOT NULL,\n  `order_id` int(10) unsigned DEFAULT NULL,\n  `po_id` int(10) unsigned DEFAULT NULL,\n  `po_type` varchar(32) DEFAULT 'shipment',\n  `order_increment_id` varchar(50) DEFAULT NULL,\n  `po_increment_id` varchar(50) DEFAULT NULL,\n  `order_created_at` datetime DEFAULT NULL,\n  `po_created_at` datetime DEFAULT NULL,\n  `has_error` tinyint(4) DEFAULT NULL,\n  `subtotal` decimal(12,4) not null,\n  `shipping` decimal(12,4) not null,\n  `tax` decimal(12,4) not null,\n  `handling` decimal(12,4) not null,\n  `trans_fee` decimal(12,4) not null,\n  `com_amount` decimal(12,4) not null,\n  `adj_amount` decimal(12,4) not null,\n  `total_payout` decimal(12,4) not null,\n  `paid` tinyint,\n  `error_info` text,\n  `row_json` text,\n  PRIMARY KEY (`row_id`),\n  UNIQUE KEY `UNQ_PO_STATEMENT` (`po_id`,`po_type`,`statement_id`),\n  KEY `FK_udropship_statement_row` (`statement_id`),\n  CONSTRAINT `FK_udropship_vendor_statement_row` FOREIGN KEY (`statement_id`) REFERENCES `{$this->getTable('udropship_vendor_statement')}` (`vendor_statement_id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\n");
$this->_conn->addColumn($this->getTable('udropship_vendor_statement'), 'subtotal', 'decimal(12,4)');
$this->_conn->addColumn($this->getTable('udropship_vendor_statement'), 'shipping', 'decimal(12,4)');
$this->_conn->addColumn($this->getTable('udropship_vendor_statement'), 'tax', 'decimal(12,4)');
$this->_conn->addColumn($this->getTable('udropship_vendor_statement'), 'handling', 'decimal(12,4)');
$this->_conn->addColumn($this->getTable('udropship_vendor_statement'), 'trans_fee', 'decimal(12,4)');
$this->_conn->addColumn($this->getTable('udropship_vendor_statement'), 'com_amount', 'decimal(12,4)');
$tableName = $this->getTable('udropship_vendor_statement_adjustment');
if ($this->_conn->tableColumnExists($tableName, 'shipment_id') && !$this->_conn->tableColumnExists($tableName, 'po_id')) {
    $this->_conn->changeColumn($tableName, 'shipment_id', 'po_id', "varchar(50) NOT NULL DEFAULT ''");
}
$this->_conn->addColumn($this->getTable('udropship_vendor_statement_adjustment'), 'po_type', "varchar(32) DEFAULT 'shipment'");
$this->_conn->dropKey($this->getTable('udropship_vendor_statement_adjustment'), 'IDX_SHIPMENT_ID');
$this->_conn->addKey($this->getTable('udropship_vendor_statement_adjustment'), 'IDX_PO_ID', array('po_id', 'po_type'));
$this->_conn->dropColumn($this->getTable('udropship_vendor_statement'), 'my_adjustment');
$this->_conn->dropColumn($this->getTable('udropship_vendor_statement'), 'adjustment');
$this->_conn->addColumn($this->getTable('udropship_vendor_statement'), 'po_type', 'varchar(32)');
if (Mage::helper('udropship')->isSalesFlat()) {
    $this->_conn->addColumn($this->getTable('sales_flat_shipment'), 'statement_id', 'varchar(30)');
    $this->_conn->addColumn($this->getTable('sales_flat_shipment_grid'), 'statement_id', 'varchar(30)');
    $this->_conn->addKey($this->getTable('sales_flat_shipment_grid'), 'IDX_UDROPSHIP_STATEMENT_ID', 'statement_id');
} else {
    $eav = new Mage_Sales_Model_Mysql4_Setup('sales_setup');
    $eav->addAttribute('shipment', 'statement_id', array('type' => 'varchar'));
}
$this->endSetup();
$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');
$installer2->getConnection()->addColumn($installer2->getTable('sales/order'), 'send_datetime', 'DATETIME');
$installer2->getConnection()->addColumn($installer2->getTable('sales/order'), 'return_datetime', 'DATETIME');
예제 #15
0
<?php

require_once 'app/Mage.php';
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
$installer = new Mage_Sales_Model_Mysql4_Setup();
//Mage_Eav_Model_Entity_Setup,Mage_Catalog_Model_Resource_Setup,
$installer->startSetup();
if (!$installer->getAttribute('catalog_category', 'sw_product_staticblock_tab_6', 'attribute_id')) {
    $installer->addAttribute('catalog_category', 'sw_product_staticblock_tab_6', array('group' => 'Product Custom Tabs', 'label' => 'CMS Block Tab #6', 'note' => "", 'type' => 'varchar', 'input' => 'select', 'source' => 'porto/category_attribute_source_tab_mode', 'visible' => true, 'required' => false, 'backend' => '', 'frontend' => '', 'searchable' => false, 'filterable' => false, 'comparable' => false, 'user_defined' => true, 'visible_on_front' => true, 'wysiwyg_enabled' => false, 'is_html_allowed_on_front' => false, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE));
}
if (!$installer->getAttribute('catalog_category', 'sw_product_staticblock_tab_7', 'attribute_id')) {
    $installer->addAttribute('catalog_category', 'sw_product_staticblock_tab_7', array('group' => 'Product Custom Tabs', 'label' => 'CMS Block Tab #7', 'note' => "", 'type' => 'varchar', 'input' => 'select', 'source' => 'porto/category_attribute_source_tab_mode', 'visible' => true, 'required' => false, 'backend' => '', 'frontend' => '', 'searchable' => false, 'filterable' => false, 'comparable' => false, 'user_defined' => true, 'visible_on_front' => true, 'wysiwyg_enabled' => false, 'is_html_allowed_on_front' => false, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE));
}
if (!$installer->getAttribute('catalog_category', 'sw_product_staticblock_tab_8', 'attribute_id')) {
    $installer->addAttribute('catalog_category', 'sw_product_staticblock_tab_8', array('group' => 'Product Custom Tabs', 'label' => 'CMS Block Tab #8', 'note' => "", 'type' => 'varchar', 'input' => 'select', 'source' => 'porto/category_attribute_source_tab_mode', 'visible' => true, 'required' => false, 'backend' => '', 'frontend' => '', 'searchable' => false, 'filterable' => false, 'comparable' => false, 'user_defined' => true, 'visible_on_front' => true, 'wysiwyg_enabled' => false, 'is_html_allowed_on_front' => false, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE));
}
if (!$installer->getAttribute('catalog_category', 'sw_product_staticblock_tab_9', 'attribute_id')) {
    $installer->addAttribute('catalog_category', 'sw_product_staticblock_tab_9', array('group' => 'Product Custom Tabs', 'label' => 'CMS Block Tab #9', 'note' => "", 'type' => 'varchar', 'input' => 'select', 'source' => 'porto/category_attribute_source_tab_mode', 'visible' => true, 'required' => false, 'backend' => '', 'frontend' => '', 'searchable' => false, 'filterable' => false, 'comparable' => false, 'user_defined' => true, 'visible_on_front' => true, 'wysiwyg_enabled' => false, 'is_html_allowed_on_front' => false, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE));
}
$installer->endSetup();
예제 #16
0
$installer->addAttributeToSet($entityTypeId, $attributeSetId, $attributeGroupId, 'is_subscription');
$installer->removeAttribute('catalog_product', 'qty_multiplier');
$installer->addAttribute('catalog_product', 'qty_multiplier', array('label' => 'Qty Multiplyer', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'input' => 'text', 'type' => 'int', 'unique' => '0', 'required' => '0', 'used_in_product_listing' => '1', 'visible' => '1', 'user_defined' => '1', 'note' => ''));
$installer->addAttributeToSet($entityTypeId, $attributeSetId, $attributeGroupId, 'qty_multiplier');
// 3. Install Order Item Attributes
$setup = new Mage_Sales_Model_Mysql4_Setup();
$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));
<?php

$this->startSetup();
$sales = new Mage_Sales_Model_Mysql4_Setup('sales_setup');
$sales->addAttribute('quote', 'udropship_shipping_details', array('type' => 'text'));
$this->endSetup();
<?php

$installer = $this;
$installer->startSetup();
// 1. Install Order Attributes
$setup = new Mage_Sales_Model_Mysql4_Setup();
$setup->getConnection()->dropColumn($setup->getTable("sales/order"), "is_prepay");
$setup->addAttribute("order", "is_prepay", array('type' => 'int'));
$setup->getConnection()->dropColumn($setup->getTable("sales/quote"), "is_prepay");
$setup->addAttribute("quote", "is_prepay", array('type' => 'int'));
$installer->endSetup();
예제 #19
0
 public function after_order_placed($observer)
 {
     $incrementId = $observer->getOrder()->getIncrementId();
     // DK.
     $country = Mage::getSingleton('checkout/type_onepage')->getQuote()->getShippingAddress()->getCountryId();
     $postcode = Mage::getSingleton('checkout/type_onepage')->getQuote()->getShippingAddress()->getPostcode();
     $send24_consumer_key = $this->getConfigData('send24_consumer_key');
     $send24_consumer_secret = $this->getConfigData('send24_consumer_secret');
     $auth = base64_encode($send24_consumer_key . ':' . $send24_consumer_secret);
     $select_country = 'Ekspres';
     // get/check Express.
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, "https://send24.com/wc-api/v3/get_products");
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
     curl_setopt($ch, CURLOPT_HEADER, FALSE);
     curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: Basic " . $auth));
     $send24_countries = json_decode(curl_exec($ch));
     curl_close($ch);
     $n = count($send24_countries);
     for ($i = 0; $i < $n; $i++) {
         if ($send24_countries[$i]->title == $select_country) {
             $coast = $send24_countries[$i]->price;
             $send24_product_id = $send24_countries[$i]->product_id;
             $i = $n;
             $is_available = true;
         } else {
             $is_available = false;
         }
     }
     if ($is_available == true) {
         $insurance_price = 0;
         $discount = "false";
         $ship_total = $type = $price_need = '';
         $user_id = $observer->getOrder()->getCustomerId();
         $shipping_data = $observer->getOrder()->getShippingAddress()->getData();
         $billing_data = $observer->getOrder()->getBillingAddress()->getData();
         if ($select_country == 'Ekspres') {
             $select_country = 'Danmark';
             $where_shop_id = 'ekspres';
         }
         // Create order.
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, "https://send24.com/wc-api/v3/create_order");
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
         curl_setopt($ch, CURLOPT_HEADER, FALSE);
         curl_setopt($ch, CURLOPT_POST, TRUE);
         curl_setopt($ch, CURLOPT_POSTFIELDS, '
                                         {
                                         "TO_company": "' . $shipping_data['company'] . '",
                                         "TO_first_name": "' . $shipping_data['firstname'] . '",
                                         "TO_last_name": "' . $shipping_data['lastname'] . '",
                                         "TO_phone": "' . $shipping_data['telephone'] . '",
                                         "TO_email": "' . $shipping_data['email'] . '",
                                         "TO_country": "' . $select_country . '",
                                         "TO_city": "' . $shipping_data['city'] . '",
                                         "TO_postcode": "' . $postcode . '",
                                         "Insurance" : "' . $insurance_price . '",
                                         "Weight": "5",
                                         "TO_address": "' . $shipping_data['street'] . '",
                                         "WHAT_product_id": "' . $send24_product_id . '",
                                         "WHERE_shop_id": "' . $where_shop_id . '",
                                         "discount": "' . $discount . '",
                                         "type": "' . $type . '",
                                         "need_points": "' . $price_need . '",
                                         "total": "' . $ship_total . '",
                                         "ship_mail": "' . $shipping_data['email'] . '",
                                         "bill_mail": "' . $billing_data['email'] . '"
                                         }
                                         ');
         curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Basic " . $auth, "Content-Type: application/json"));
         $response = curl_exec($ch);
         curl_close($ch);
     }
     $response_order = json_decode($response, JSON_FORCE_OBJECT);
     $history = Mage::getModel('sales/order_status_history')->setStatus($observer->getOrder()->getStatus())->setComment('<strong>Track parsel </strong><br><a href="' . $response_order['track'] . '" target="_blank">' . $response_order['track'] . '</a>')->setEntityName(Mage_Sales_Model_Order::HISTORY_ENTITY_NAME)->setIsCustomerNotified(false)->setCreatedAt(date('Y-m-d H:i:s', time() - 60 * 60 * 24));
     $observer->getOrder()->addStatusHistory($history);
     // Create custom value for order.
     // it temporarily
     require_once 'app/Mage.php';
     Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
     $installer = new Mage_Sales_Model_Mysql4_Setup();
     $attribute_track_parsel = array('type' => 'varchar', 'backend_type' => 'varchar', 'frontend_input' => 'varchar', 'is_user_defined' => true, 'label' => 'Send24 Track Parsel', 'visible' => false, 'required' => false, 'user_defined' => false, 'searchable' => false, 'filterable' => false, 'comparable' => false, 'default' => '');
     $attribute_printout = array('type' => 'text', 'backend_type' => 'text', 'frontend_input' => 'text', 'is_user_defined' => true, 'label' => 'Send24 Printout', 'visible' => false, 'required' => false, 'user_defined' => false, 'searchable' => false, 'filterable' => false, 'comparable' => false, 'default' => '');
     $installer->addAttribute('order', 'send24_track_parsel', $attribute_track_parsel);
     $installer->addAttribute('order', 'send24_printout', $attribute_printout);
     $installer->endSetup();
     // Add Track parsel.
     $observer->getOrder()->setSend24TrackParsel($response_order['track']);
     // Add Printout.
     $printout = json_encode($response_order);
     $observer->getOrder()->setSend24Printout($printout);
     $observer->getOrder()->save();
     return true;
 }
예제 #20
0
<?php

$installer = $this;
$installer->startSetup();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->run("\r\n\t\tDROP TABLE IF EXISTS {$this->getTable('delivery_note')};\r\n\r\n\t\tCREATE TABLE {$this->getTable('delivery_note')} (\r\n\t\t\t`delivery_note_id` int(7) unsigned NOT NULL auto_increment,\r\n\t\t\t`note` text NOT NULL,\r\n\t\t\tPRIMARY KEY  (`delivery_note_id`)\r\n\t\t) ENGINE=InnoDB DEFAULT CHARSET=utf8;\r\n\t");
$installer->endSetup();
$setup = new Mage_Sales_Model_Mysql4_Setup('sales_setup');
$setup->getConnection()->addColumn($setup->getTable('sales_flat_quote'), 'delivery_note', 'text NULL DEFAULT NULL');
$setup->addAttribute('quote', 'delivery_note', array('type' => 'varchar', 'visible' => false));
$installer->addAttribute('order', 'delivery_note_id', array('type' => 'int', 'visible' => false, 'required' => false));
/**
 * Zitec_Dpd – shipping carrier 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   Zitec
 * @package    Zitec_Dpd
 * @copyright  Copyright (c) 2014 Zitec COM
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
/**
 *
 * @category   Zitec
 * @package    Zitec_Dpd
 * @author     Zitec COM <*****@*****.**>
 */
/* @var $installer Mage_Core_Model_Resource_Setup */
$installer = $this;
$installer->startSetup();
$salesSetup = new Mage_Sales_Model_Mysql4_Setup('sales_setup');
$salesSetup->addAttribute('quote_address', 'valid_auto_postcode', array('type' => 'smallint'));
$salesSetup->addAttribute('order_address', 'valid_auto_postcode', array('type' => 'smallint'));
$salesSetup->addAttribute('quote_address', 'auto_postcode', array('type' => 'varchar', 'length' => 10));
$salesSetup->addAttribute('order_address', 'auto_postcode', array('type' => 'varchar', 'length' => 10));
$installer->endSetup();
예제 #22
0
<?php

require_once 'app/Mage.php';
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
$installer = new Mage_Sales_Model_Mysql4_Setup();
//Mage_Eav_Model_Entity_Setup,Mage_Catalog_Model_Resource_Setup,
$installer->startSetup();
$installer->getConnection()->addColumn($this->getTable('sales/order'), 'dailydeals', 'varchar(255) NULL');
$installer->run("\n\nCREATE TABLE IF NOT EXISTS magegiant_dailydeal (\n  `id` int(11) unsigned NOT NULL auto_increment,\n  `title` varchar(255) NOT NULL default '',\n  `products` varchar(255) NULL,\n  `products_deal` varchar(255) NULL,\n  `product_id` int(11) NOT NULL,\n  `product_name` varchar(255) NOT NULL,\n  `thumbnail_image` varchar(255) NULL,\n  `save` varchar(255) NOT NULL default '0',\n  `deal_price` decimal(12,2) NOT NULL,\n  `quantity` int(11) NOT NULL default '0',\n  `sold` int(11) NOT NULL default '0',\n  `start_time` datetime NULL,\n  `deal_time` int(11) NULL,\n  `time_left` datetime NULL,\n  `close_time` datetime NULL,\n  `status` int(1) NOT NULL default '1',\n  `store_id` text NULL,\n  `process` int(1) NOT NULL default '0',\n  `is_random` int(1) NOT NULL default '0',\n  PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\n    ");
$installer->endSetup();
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * @category   Phoenix
 * @package    Phoenix_CashOnDelivery
 * @copyright  Copyright (c) 2010 - 2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
$this->startSetup();
$setup = new Mage_Sales_Model_Mysql4_Setup('sales_setup');
$setup->addAttribute('order', 'cod_fee_refunded', array('type' => 'decimal'));
$setup->addAttribute('order', 'base_cod_fee_refunded', array('type' => 'decimal'));
$setup->addAttribute('order', 'cod_tax_amount_refunded', array('type' => 'decimal'));
$setup->addAttribute('order', 'base_cod_tax_amount_refunded', array('type' => 'decimal'));
$setup->addAttribute('order', 'cod_fee_canceled', array('type' => 'decimal'));
$setup->addAttribute('order', 'base_cod_fee_canceled', array('type' => 'decimal'));
$setup->addAttribute('order', 'cod_tax_amount_canceled', array('type' => 'decimal'));
$setup->addAttribute('order', 'base_cod_tax_amount_canceled', array('type' => 'decimal'));
$setup->addAttribute('creditmemo', 'cod_fee', array('type' => 'decimal'));
$setup->addAttribute('creditmemo', 'base_cod_fee', array('type' => 'decimal'));
$setup->addAttribute('creditmemo', 'cod_tax_amount', array('type' => 'decimal'));
$setup->addAttribute('creditmemo', 'base_cod_tax_amount', array('type' => 'decimal'));
$this->endSetup();
 * 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();
if (Mage::helper('udropship')->isSalesFlat()) {
    $this->_conn->addColumn($this->getTable('sales_flat_shipment'), 'udropship_payout_status', 'varchar(50)');
    $this->_conn->addColumn($this->getTable('sales_flat_shipment_grid'), 'udropship_payout_status', 'varchar(50)');
    $this->_conn->addKey($this->getTable('sales_flat_shipment_grid'), 'IDX_UDROPSHIP_PAYOUT_STATUS', 'udropship_payout_status');
} else {
    $eav = new Mage_Sales_Model_Mysql4_Setup('sales_setup');
    $eav->addAttribute('shipment', 'udropship_payout_status', array('type' => 'varchar'));
}
$this->_conn->addColumn($this->getTable('udropship_vendor_statement'), 'total_paid', 'decimal(12,4)');
$this->_conn->addColumn($this->getTable('udropship_vendor_statement'), 'total_due', 'decimal(12,4)');
$this->_conn->addColumn($this->getTable('udropship_vendor_statement'), 'notes', 'text');
$this->_conn->addColumn($this->getTable('udropship_vendor_statement'), 'adjustment', 'decimal(12,4)');
$this->_conn->addColumn($this->getTable('udropship_vendor_statement'), 'my_adjustment', 'decimal(12,4)');
$this->_conn->addColumn($this->getTable('udropship_vendor_statement'), 'total_adjustment', 'decimal(12,4)');
$this->_conn->addColumn($this->getTable('udropship_vendor_statement_adjustment'), 'adjustment_prefix', 'varchar(64)');
$this->endSetup();
예제 #25
0
 public function dbCheck()
 {
     $dbOk = true;
     $localError = false;
     $this->messages[] = "Checking database";
     $installer = new Mage_Sales_Model_Mysql4_Setup('sales_setup');
     $installer->startSetup();
     if (isset($_GET['fix'])) {
         $fix = $_GET['fix'] == 'true';
     } else {
         $fix = false;
     }
     foreach ($this->_getDbFields() as $field) {
         switch ($field[0]) {
             case 'eav':
                 try {
                     $sql = "SELECT `attribute_id` FROM `{$installer->getTable('eav_attribute')}` WHERE `attribute_code` ='{$field['2']}'";
                     $test = $installer->getConnection('core_read')->fetchRow($sql);
                     if (!isset($test['attribute_id']) && !$test['attribute_id'] > 0) {
                         throw new Exception('eav attribute ' . $field[2] . ' is not installed');
                     }
                     $this->messages[] = "[OK] eav attribute " . $field[2] . " with id " . $test['attribute_id'] . "";
                 } catch (Exception $e) {
                     if ($fix) {
                         $this->messages[] = "Attempting fix for eav attribute " . $field[2] . "";
                         try {
                             $installer->addAttribute($field[1], $field[2], $field[3]);
                             $this->messages[] = "[FIX OK] eav attribute " . $field[2] . " fixed";
                         } catch (Exception $e) {
                             $this->messages[] = "[FAILED] fixing eav attribute " . $field[2] . "";
                             $dbOk = false;
                             $this->messages[] = $e->getMessage();
                             $localError = true;
                         }
                     } else {
                         $this->messages[] = "[FAILED] eav attribute " . $field[2] . "";
                         Mage::getSingleton('core/session')->addWarning('[FAILED] eav attribute ' . $field[2]);
                         $dbOk = false;
                         $this->messages[] = "[ERR] " . $e->getMessage();
                         $localError = true;
                     }
                 }
                 break;
             case 'sql-column':
                 try {
                     $test = $installer->run("SELECT `{$field['2']}` FROM `{$installer->getTable($field[1])}` LIMIT 0");
                     $this->messages[] = "[OK] column " . $field[2] . "";
                 } catch (Exception $e) {
                     if ($fix) {
                         $this->messages[] = "Attempting fix for column " . $field[2] . "";
                         try {
                             $test = $installer->run("ALTER TABLE `{$installer->getTable($field[1])}` ADD COLUMN `{$field['2']}` {$field['3']}");
                             $this->messages[] = "[FIX OK] column " . $field[2] . " fixed";
                         } catch (Exception $e) {
                             $this->messages[] = "[FAILED] fixing column " . $field[2] . "";
                             $dbOk = false;
                             $this->messages[] = $e->getMessage();
                             $localError = true;
                         }
                     } else {
                         $this->messages[] = "[FAILED] column " . $field[2] . "";
                         $dbOk = false;
                         $this->messages[] = "[ERR] " . $e->getMessage();
                         $localError = true;
                     }
                 }
                 break;
         }
     }
     $installer->endSetup();
     if (empty($localError)) {
         return true;
     } else {
         if ($dbOk == false) {
             $this->messages[] = "<p>The selftest has found some problems with your database install.\n                    You can attempt to fix this by appending ?fix=true to the address or clicking this <a href=\"" . htmlentities($_SERVER['PHP_SELF']) . "?fix=true\">link</a>.</p><p style=\"color:red;\"><em>A DATABASE BACKUP IS strongly RECOMMENDED BEFORE ATTEMPTING THIS!</em></p>";
         }
         return false;
     }
 }
 * @author     Zitec COM <*****@*****.**>
 */
/* @var $installer Mage_Core_Model_Resource_Setup */
$installer = $this;
$installer->startSetup();
$installer->run("\n        DROP TABLE IF EXISTS {$this->getTable('zitec_dpd_ships')};\n        CREATE TABLE {$this->getTable('zitec_dpd_ships')} (\n          `id` int(10) unsigned NOT NULL auto_increment,\n          `shipment_id` int(10) unsigned DEFAULT NULL,\n          `order_id` int(10) unsigned DEFAULT NULL,\n          `save_shipment_call` mediumtext,\n          `save_shipment_response` mediumtext,\n          `shipping_labels` mediumtext,\n          `manifest` mediumtext,\n          PRIMARY KEY  (`id`)\n        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n        \n        \n        DROP TABLE IF EXISTS {$this->getTable('zitec_dpd_tablerate')};\n        CREATE TABLE {$this->getTable('zitec_dpd_tablerate')} (\n            `pk` int(10) unsigned NOT NULL auto_increment,\n            `website_id` int(11) NOT NULL default '0',\n            `dest_country_id` varchar(4) NOT NULL default '0',\n            `dest_region_id` int(10) NOT NULL default '0',\n            `dest_zip` varchar(10) NOT NULL default '',\n            `weight` decimal(12,4) NOT NULL default '0.0000',\n            `price` varchar(10) NOT NULL default '0.0000',\n            `method` varchar(6) NOT NULL default '0',\n            `markup_type` varchar(5) NOT NULL default '0',\n            PRIMARY KEY  (`pk`),\n            UNIQUE KEY `dest_country` (`website_id`,`dest_country_id`,`dest_region_id`,`dest_zip`,`weight`,`method`)\n        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\n");
$installer->run("\n        DROP TABLE IF EXISTS {$this->getTable('zitec_dpd_pickup_order')};\n\n        CREATE TABLE {$this->getTable('zitec_dpd_pickup_order')} (\n            `entity_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,\n            `reference` VARCHAR( 255 ) NOT NULL ,\n            `dpd_id` INT NOT NULL ,\n            `pickup_date` DATETIME NOT NULL ,\n            `pickup_time_from` DATETIME NOT NULL ,\n            `pickup_time_to` DATETIME NOT NULL ,\n            `call_data` MEDIUMTEXT NOT NULL ,\n            `response_data` MEDIUMTEXT NOT NULL ,\n        INDEX (  `pickup_date` ,  `pickup_time_from` ,  `pickup_time_to` ) ,\n        UNIQUE (\n            `reference`\n        )\n        ) ENGINE = INNODB DEFAULT CHARSET=utf8;\n\n       ");
$salesSetup = Mage::getModel('eav/entity_setup', 'sales_setup');
/** @var $salesSetup Mage_Sales_Model_Resource_Setup */
$salesSetup->addAttribute('shipment', 'zitec_dpd_pickup_id', array('type' => 'int'));
$salesSetup = Mage::getModel('eav/entity_setup', 'sales_setup');
/** @var $salesSetup Mage_Sales_Model_Resource_Setup */
$salesSetup->addAttribute('shipment', 'zitec_dpd_pickup_time', array('type' => 'datetime', "grid" => true));
$salesSetup->addAttribute('shipment', 'zitec_dpd_manifest_closed', array('type' => 'int', "grid" => true, "default" => 0));
$installer->getConnection()->addColumn($this->getTable('zitec_dpd_tablerate'), 'cashondelivery_surcharge', "varchar(20) DEFAULT NULL");
$salesSetup = new Mage_Sales_Model_Mysql4_Setup('sales_setup');
$salesSetup->addAttribute('quote_address', 'zitec_dpd_cashondelivery_surcharge', array('type' => 'decimal'));
$salesSetup->addAttribute('quote_address', 'base_zitec_dpd_cashondelivery_surcharge', array('type' => 'decimal'));
$salesSetup->addAttribute('order', 'zitec_dpd_cashondelivery_surcharge', array('type' => 'decimal'));
$salesSetup->addAttribute('order', 'base_zitec_dpd_cashondelivery_surcharge', array('type' => 'decimal'));
$salesSetup->addAttribute('invoice', 'zitec_dpd_cashondelivery_surcharge', array('type' => 'decimal'));
$salesSetup->addAttribute('invoice', 'base_zitec_dpd_cashondelivery_surcharge', array('type' => 'decimal'));
$salesSetup->addAttribute('creditmemo', 'zitec_dpd_cashondelivery_surcharge', array('type' => 'decimal'));
$salesSetup->addAttribute('creditmemo', 'base_zitec_dpd_cashondelivery_surcharge', array('type' => 'decimal'));
$salesSetup->addAttribute('quote_address', 'zitec_dpd_cashondelivery_surcharge_tax', array('type' => 'decimal'));
$salesSetup->addAttribute('quote_address', 'base_zitec_dpd_cashondelivery_surcharge_tax', array('type' => 'decimal'));
$salesSetup->addAttribute('order', 'zitec_dpd_cashondelivery_surcharge_tax', array('type' => 'decimal'));
$salesSetup->addAttribute('order', 'base_zitec_dpd_cashondelivery_surcharge_tax', array('type' => 'decimal'));
$salesSetup->addAttribute('invoice', 'zitec_dpd_cashondelivery_surcharge_tax', array('type' => 'decimal'));
$salesSetup->addAttribute('invoice', 'base_zitec_dpd_cashondelivery_surcharge_tax', array('type' => 'decimal'));
$salesSetup->addAttribute('creditmemo', 'zitec_dpd_cashondelivery_surcharge_tax', array('type' => 'decimal'));
<?php

/* @var $installer Mage_Core_Model_Resource_Setup */
$installer = $this;
$installer->startSetup();
$installer->getConnection()->addColumn($this->getTable('sales/order'), 'base_affiliate_credit', 'decimal(12,4) default NULL');
$installer->getConnection()->addColumn($this->getTable('sales/order'), 'affiliate_credit', 'decimal(12,4) default NULL');
$installer->getConnection()->addColumn($this->getTable('affiliateplus_transaction'), 'holding_from', 'datetime NULL');
if (version_compare(Mage::getVersion(), '1.4.1.0', '>=')) {
    $installer->getConnection()->addColumn($this->getTable('sales/invoice'), 'base_affiliate_credit', 'decimal(12,4) default NULL');
    $installer->getConnection()->addColumn($this->getTable('sales/invoice'), 'affiliate_credit', 'decimal(12,4) default NULL');
    $installer->getConnection()->addColumn($this->getTable('sales/creditmemo'), 'base_affiliate_credit', 'decimal(12,4) default NULL');
    $installer->getConnection()->addColumn($this->getTable('sales/creditmemo'), 'affiliate_credit', 'decimal(12,4) default NULL');
} else {
    $setup = new Mage_Sales_Model_Mysql4_Setup('sales_setup');
    $setup->addAttribute('invoice', 'affiliate_credit', array('type' => 'decimal'));
    $setup->addAttribute('invoice', 'base_affiliate_credit', array('type' => 'decimal'));
    $setup->addAttribute('creditmemo', 'affiliate_credit', array('type' => 'decimal'));
    $setup->addAttribute('creditmemo', 'base_affiliate_credit', array('type' => 'decimal'));
}
// Withdraw Tax
$installer->getConnection()->addColumn($this->getTable('affiliateplus_payment'), 'tax_amount', 'decimal(12,4) default NULL');
$installer->getConnection()->addColumn($this->getTable('affiliateplus_payment'), 'amount_incl_tax', 'decimal(12,4) default NULL');
$installer->run("\n\nDROP TABLE IF EXISTS {$this->getTable('affiliateplus_tracking')};\nCREATE TABLE {$this->getTable('affiliateplus_tracking')}(\n    `tracking_id` int(10) unsigned NOT NULL auto_increment,\n    `account_id` int(10) unsigned NOT NULL,\n    `customer_id` int(10) unsigned NOT NULL,\n    `customer_email` varchar(255) NOT NULL default '',\n    `created_time` datetime NULL,\n    PRIMARY KEY (`tracking_id`),\n    KEY `FK_AFFILIATEPLUS_TRACKING_ACCOUNT_ID` (`account_id`),\n    CONSTRAINT `FK_AFFILIATEPLUS_TRACKING_ACCOUNT` FOREIGN KEY (`account_id`) REFERENCES {$this->getTable('affiliateplus_account')} (`account_id`) ON DELETE CASCADE ON UPDATE CASCADE\n)ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\n\nDROP TABLE IF EXISTS {$this->getTable('affiliateplus_credit')};\nCREATE TABLE {$this->getTable('affiliateplus_credit')}(\n    `id` int(10) unsigned NOT NULL auto_increment,\n    `payment_id` int(10) unsigned NOT NULL,\n    `order_id` int(10) unsigned NOT NULL,\n    `order_increment_id` varchar(255) NOT NULL default '',\n    `base_paid_amount` decimal(12,4) NOT NULL default '0',\n    `paid_amount` decimal(12,4) NOT NULL default '0',\n    `base_refund_amount` decimal(12,4) NOT NULL default '0',\n    `refund_amount` decimal(12,4) NOT NULL default '0',\n    PRIMARY KEY (`id`),\n    INDEX(`payment_id`),\n    FOREIGN KEY (`payment_id`) REFERENCES {$this->getTable('affiliateplus_payment')} (`payment_id`) ON DELETE CASCADE ON UPDATE CASCADE\n)ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\n\nDROP TABLE IF EXISTS {$this->getTable('affiliateplus_payment_history')};\nCREATE TABLE {$this->getTable('affiliateplus_payment_history')}(\n    `history_id` int(10) unsigned NOT NULL auto_increment,\n    `payment_id` int(10) unsigned NOT NULL,\n    `status` tinyint(1) NOT NULL default '1',\n    `created_time` datetime NULL,\n    `description` text NOT NULL,\n    PRIMARY KEY (`history_id`),\n    INDEX(`payment_id`),\n    FOREIGN KEY (`payment_id`) REFERENCES {$this->getTable('affiliateplus_payment')} (`payment_id`) ON DELETE CASCADE ON UPDATE CASCADE\n)ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\n\n");
$paymentSelect = $installer->getConnection()->select()->reset()->from(array('p' => $this->getTable('affiliateplus_payment')), array('payment_id' => 'payment_id', 'status' => 'ABS(1)', 'created_time' => 'request_time', 'description' => "LTRIM('Create Withdrawal')"));
$updateSql = $paymentSelect->insertFromSelect($this->getTable('affiliateplus_payment_history'), array('payment_id', 'status', 'created_time', 'description'), true);
$installer->getConnection()->query($updateSql);
// Convert from old configuration to new configuration fields
$movingPre = 'affiliateplus/';
$movingMap = array('material/enable' => 'general/material_enable', 'material/page' => 'general/material_page', 'general/register_description' => 'account/register_description', 'general/required_address' => 'account/required_address', 'general/required_paypal' => 'account/required_paypal', 'general/need_approved' => 'account/need_approved', 'general/notification_after_signing_up' => 'account/notification_after_signing_up', 'sharing/balance' => 'account/balance', 'general/affiliate_type' => 'commission/affiliate_type', 'general/commission_type' => 'commission/commission_type', 'general/commission' => 'commission/commission', 'payment/updatebalance_orderstatus' => 'commission/updatebalance_orderstatus', 'payment/decrease_commission_creditmemo' => 'commission/decrease_commission_creditmemo', 'payment/cancel_transaction_orderstatus' => 'commission/cancel_transaction_orderstatus', 'general/allow_discount' => 'discount/allow_discount', 'general/discount_type' => 'discount/discount_type', 'general/discount' => 'discount/discount', 'general/type_discount' => 'discount/type_discount', 'sales/type' => 'commission/type', 'sales/commission_type' => 'commission/add_commission_type', 'sales/month' => 'commission/month', 'sales/month_tier' => 'commission/month_tier', 'sales/year' => 'commission/year', 'sales/year_tier' => 'commission/year_tier', 'sales/show' => 'commission/show');
$movingSql = '';
 *
 * @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;
if (Mage::helper('udropship')->isSalesFlat()) {
    $searchSelect = $conn->select()->from(array('po' => $this->getTable('sales/shipment')), array('entity_id'))->joinLeft(array('vs' => $this->getTable('udropship/vendor_statement')), 'vs.statement_id=po.statement_id', array())->where("po.statement_id is not null and po.statement_id!='' and vs.statement_id is null");
    $updateSelect = $conn->select()->join(array('_orp' => $searchSelect), '_orp.entity_id=_po.entity_id', array())->columns(array('statement_id' => new Zend_Db_Expr('NULL')));
    $updateSql = $updateSelect->crossUpdateFromSelect(array('_po' => $this->getTable('sales/shipment')));
    //print $updateSql."\n\n\n";
    $conn->raw_query($updateSql);
    $updateSql = $updateSelect->crossUpdateFromSelect(array('_po' => $this->getTable('sales/shipment_grid')));
    //print $updateSql."\n\n\n";
    $conn->raw_query($updateSql);
} else {
    $eav = new Mage_Sales_Model_Mysql4_Setup('sales_setup');
    $poAttr = $eav->getAttribute('shipment', 'statement_id');
    $sET = $eav->getEntityType('shipment');
    $searchSelect = $conn->select()->from(array('orp' => $this->getTable($sET['entity_table']) . '_' . $poAttr['backend_type']), array('entity_id'))->joinLeft(array('vs' => $this->getTable('udropship/vendor_statement')), 'vs.statement_id=orp.value', array())->where("orp.value is not null and orp.value!='' and vs.statement_id is null")->where('orp.attribute_id=?', $poAttr['attribute_id']);
    //print $searchSelect."\n\n\n";
    $poIds = $conn->fetchCol($searchSelect);
    //print_r($poIds);
    if (!empty($poIds)) {
        $conn->delete($this->getTable($sET['entity_table']) . '_' . $poAttr['backend_type'], $conn->quoteInto('entity_id in (?) ', $poIds) . $conn->quoteInto(' and attribute_id=?', $poAttr['attribute_id']));
    }
}
//throw new Exception('test');
$this->endSetup();
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * @category   Phoenix
 * @package    Phoenix_CashOnDelivery
 * @copyright  Copyright (c) 2010 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
$this->startSetup();
$setup = new Mage_Sales_Model_Mysql4_Setup('sales_setup');
$setup->addAttribute('order', 'cod_fee', array('type' => 'decimal'));
$setup->addAttribute('order', 'base_cod_fee', array('type' => 'decimal'));
$setup->addAttribute('order', 'cod_fee_invoiced', array('type' => 'decimal'));
$setup->addAttribute('order', 'base_cod_fee_invoiced', array('type' => 'decimal'));
$setup->addAttribute('order', 'cod_tax_amount', array('type' => 'decimal'));
$setup->addAttribute('order', 'base_cod_tax_amount', array('type' => 'decimal'));
$setup->addAttribute('order', 'cod_tax_amount_invoiced', array('type' => 'decimal'));
$setup->addAttribute('order', 'base_cod_tax_amount_invoiced', array('type' => 'decimal'));
$setup->addAttribute('invoice', 'cod_fee', array('type' => 'decimal'));
$setup->addAttribute('invoice', 'base_cod_fee', array('type' => 'decimal'));
$setup->addAttribute('invoice', 'cod_tax_amount', array('type' => 'decimal'));
$setup->addAttribute('invoice', 'base_cod_tax_amount', array('type' => 'decimal'));
$setup->addAttribute('quote', 'cod_fee', array('type' => 'decimal'));
$setup->addAttribute('quote', 'base_cod_fee', array('type' => 'decimal'));
$setup->addAttribute('quote', 'cod_tax_amount', array('type' => 'decimal'));
<?php

/**
 * @category Warby
 * @package Warby_MqModule
 * @author Warby Parker (Jarad Delorenzo, Jeff Uthaichai, Jesse Zlata, Karina Ruzinov) <*****@*****.**>
 * @copyright Massachusetts Institute of Technology License (MITL)
 * @license  http://opensource.org/licenses/MIT
 */
$sales_setup = new Mage_Sales_Model_Mysql4_Setup('sales_setup');
$sales_setup->addAttribute('order', 'mqmodule_status', array('type' => 'varchar', 'default_value' => null));