/** * 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; }
public function emitirAction() { $orders = $_POST['order_ids']; foreach ($orders as $number) { $order = Mage::getModel('sales/order')->load($number); // Emissão automática de Nota Fiscal $notafiscal = new WebmaniaBR_NFe_Model_Observer(); $response = $notafiscal->emitirNfe($order, null, null, true); $orderno = (int) $order->getIncrementId(); if (isset($response->error)) { Mage::getSingleton('core/session')->addError("Nota Fiscal #" . $orderno . ': ' . $response->error); if ($response->log) { foreach ($response->log as $erros) { foreach ($erros as $erro) { Mage::getSingleton('core/session')->addError("- " . $erro); } } } } else { $setup = new Mage_Sales_Model_Resource_Setup('core_setup'); $attribute = array('type' => 'text', 'input' => 'text', 'label' => 'NFe emitidas', 'global' => 0, 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'visible_on_front' => 0); $setup->addAttribute('order', 'all_nfe', $attribute); $setup->endSetup(); $existing_nfe = unserialize(base64_decode($order->getData('all_nfe'))); if (!$existing_nfe) { $existing_nfe = array(); } $nfe_info = array('status' => (string) $response->status, 'chave_acesso' => $response->chave, 'n_recibo' => (int) $response->recibo, 'n_nfe' => (int) $response->nfe, 'n_serie' => (int) $response->serie, 'url_xml' => (string) $response->xml, 'url_danfe' => (string) $response->danfe, 'data' => date('d/m/Y')); $existing_nfe[] = $nfe_info; $nfe_info_str = base64_encode(serialize($existing_nfe)); $order->setData('all_nfe', $nfe_info_str); $order->save(); Mage::getSingleton('core/session')->addSuccess("Nota Fiscal #" . $orderno . ': Emitida com sucesso.'); } } session_write_close(); $url = Mage::helper('adminhtml')->getUrl('adminhtml/sales_order/'); $this->_redirectUrl($url); }
<?php $installer = $this; $installer->startSetup(); $table = $installer->getConnection()->newTable($installer->getTable('tasks_addgifttocheckout/isgift'))->addColumn('gift_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array('unsigned' => true, 'nullable' => false, 'primary' => true, 'identity' => true), 'Gift ID')->addColumn('value', Varien_Db_Ddl_Table::TYPE_VARCHAR, 128, array('nullable' => 'false'), 'Value'); $installer->getConnection()->createTable($table); $installer->endSetup(); $installer = new Mage_Sales_Model_Resource_Setup('core_setup'); $installer->startSetup(); $installer->addAttribute('order', 'is_gift', array('type' => 'int', 'label' => 'Is Gift', 'input' => 'select', 'source' => 'tasks_addgifttocheckout/isgift', 'visible' => true, 'required' => false, 'unique' => false)); $installer->addAttribute('quote', 'is_gift', array('type' => 'int', 'label' => 'Is Gift', 'source' => 'tasks_addgifttocheckout/isgift', 'input' => 'select', 'visible' => true, 'required' => false, 'unique' => false)); $installer->endSetup();
<?php $installer = new Mage_Sales_Model_Resource_Setup('core_setup'); $entities = array('quote_item', 'order_item'); $options = array('type' => Varien_Db_Ddl_Table::TYPE_VARCHAR, 'visible' => true, 'required' => false); foreach ($entities as $entity) { $installer->addAttribute($entity, 'commission_amount', $options); } $installer->endSetup();
<?php $this->startSetup(); $this->_conn->addColumn($this->getTable('sales_flat_quote'), 'payexinvoice_payment_fee', 'decimal(12,4)'); $this->_conn->addColumn($this->getTable('sales_flat_quote'), 'base_payexinvoice_payment_fee', 'decimal(12,4)'); $this->_conn->addColumn($this->getTable('sales_flat_order'), 'payexinvoice_payment_fee', 'decimal(12,4)'); $this->_conn->addColumn($this->getTable('sales_flat_order'), 'base_payexinvoice_payment_fee', 'decimal(12,4)'); $eav = new Mage_Sales_Model_Resource_Setup('sales_setup'); $eav->addAttribute('quote', 'payexinvoice_payment_fee', array('type' => 'decimal')); $eav->addAttribute('quote', 'base_payexinvoice_payment_fee', array('type' => 'decimal')); $eav->addAttribute('order', 'payexinvoice_payment_fee', array('type' => 'decimal')); $eav->addAttribute('order', 'base_payexinvoice_payment_fee', array('type' => 'decimal')); $this->endSetup();
$allOrderGroups = $connection->fetchAll($select); if ($allOrderGroups) { $installer->run('LOCK TABLES ' . $connection->quoteIdentifier($installer->getTable('sales/order_grid'), true) . ' WRITE;'); foreach ($allOrderGroups as $value) { $connection->update($installer->getTable('sales/order_grid'), array('order_group_id' => intval($value['order_group_id'])), 'entity_id = ' . intval($value['order_id'])); } $installer->run('UNLOCK TABLES;'); $installer->run('LOCK TABLES ' . $connection->quoteIdentifier($installer->getTable('sales/order'), true) . ' WRITE;'); foreach ($allOrderGroups as $value) { $connection->update($installer->getTable('sales/order'), array('order_group_id' => intval($value['order_group_id'])), 'entity_id = ' . intval($value['order_id'])); } $installer->run('UNLOCK TABLES; DROP TABLE IF EXISTS `' . $installer->getTable('mageworx_orderspro_order_item_group') . '`; ALTER TABLE `' . $installer->getTable('mageworx_orderspro_order_group') . '` CHANGE `order_group_id` `order_group_id` TINYINT UNSIGNED NOT NULL AUTO_INCREMENT;'); } } } // 1.18.9 > 1.19.0 $pathLike = 'mageworx_sales/orderspro/%'; $configCollection = Mage::getModel('core/config_data')->getCollection(); $configCollection->getSelect()->where('path like ?', $pathLike); foreach ($configCollection as $conf) { $path = $conf->getPath(); $path = str_replace('orderspro', 'general', $path); $path = str_replace('mageworx_sales', 'mageworx_orderspro', $path); $conf->setPath($path)->save(); } $salesInstaller = new Mage_Sales_Model_Resource_Setup('core_setup'); $salesInstaller->addAttribute('quote_item', 'orderspro_is_temporary', array('type' => 'int', 'nullable' => true, 'grid' => false)); $salesInstaller->endSetup(); $installer->endSetup();
<?php /** * Install data tables * * @category Snap * @package Snap_Card * @author alex */ /** @var $installer Mage_Sales_Model_Resource_Setup */ $installer = new Mage_Sales_Model_Resource_Setup(); $installer->startSetup(); $installer->run("CREATE TABLE IF NOT EXISTS `{$installer->getTable('snap_card/entity')}`(\n `entity_id` INT(6) UNSIGNED NOT NULL AUTO_INCREMENT,\n `code` VARCHAR(32) NOT NULL,\n `pin` INT(8) DEFAULT NULL,\n `status` VARCHAR(64) NOT NULL DEFAULT 'Activated',\n `total` DECIMAL(12,4) NOT NULL DEFAULT '0.0000',\n `balance` DECIMAL(12,4) NOT NULL DEFAULT '0.0000',\n `customer_id` INT(6) DEFAULT NULL,\n `created_at` DATETIME DEFAULT '0000-00-00 00:00:00',\n PRIMARY KEY (`entity_id`),\n UNIQUE KEY `IDX_CODE` (`code`)\n) ENGINE=INNODB DEFAULT CHARSET=utf8;"); $installer->run("CREATE TABLE IF NOT EXISTS `{$installer->getTable('snap_card/usage')}`(\n `entity_id` int(6) unsigned NOT NULL AUTO_INCREMENT,\n `card_id` int(6) NOT NULL,\n `website_id` smallint(5) unsigned NOT NULL,\n `amount` decimal(12,4) NOT NULL DEFAULT '0.0000',\n `customer_id` int(6) DEFAULT NULL,\n `order_id` int(6) DEFAULT NULL,\n PRIMARY KEY (`entity_id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8"); $installer->endSetup();
<?php /** * @category Graphic Sourcecode * @package Rofra_Salesorderitemgrid * @license http://www.apache.org/licenses/LICENSE-2.0 * @author Rodolphe Franceschi <*****@*****.**> */ /* @var $installer Mage_Sales_Model_Resource_Setup */ $installer = new Mage_Sales_Model_Resource_Setup('core_setup'); /** * Add 'custom_attribute' attribute for entities */ $entities = array('order_item'); // Add VARCHAR attributes $options = array('type' => Varien_Db_Ddl_Table::TYPE_VARCHAR, 'visible' => true, 'required' => false); foreach ($entities as $entity) { $installer->addAttribute($entity, Rofra_Salesorderitemgrid_Helper_Attributes::COLUMN1, $options); $installer->addAttribute($entity, Rofra_Salesorderitemgrid_Helper_Attributes::COLUMN2, $options); $installer->addAttribute($entity, Rofra_Salesorderitemgrid_Helper_Attributes::COLUMN3, $options); } $installer->endSetup();
<?php $setup = new Mage_Sales_Model_Resource_Setup('core_setup'); if (!$this->getAttribute(Mage_Sales_Model_Order::ENTITY, 'vindi_subscription_id', 'attribute_id')) { $setup->addAttribute(Mage_Sales_Model_Order::ENTITY, 'vindi_subscription_id', ['type' => 'varchar', 'input' => 'text', 'backend' => '', 'frontend' => '', 'label' => 'Id da Assinatura Vindi', 'class' => '', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 'visible' => false, 'required' => false, 'user_defined' => false, 'default' => '', 'searchable' => false, 'filterable' => false, 'comparable' => false, 'visible_on_front' => false, 'unique' => false]); } if (!$this->getAttribute(Mage_Sales_Model_Order::ENTITY, 'vindi_subscription_period', 'attribute_id')) { $setup->addAttribute(Mage_Sales_Model_Order::ENTITY, 'vindi_subscription_period', ['type' => 'varchar', 'input' => 'text', 'backend' => '', 'frontend' => '', 'label' => 'Período da Assinatura Vindi', 'class' => '', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 'visible' => false, 'required' => false, 'user_defined' => false, 'default' => '', 'searchable' => false, 'filterable' => false, 'comparable' => false, 'visible_on_front' => false, 'unique' => false]); } $setup->endSetup();
<?php $installer = new Mage_Sales_Model_Resource_Setup('core_setup'); $entities = array('quote_item', 'order_item'); $options = array('type' => Varien_Db_Ddl_Table::TYPE_VARCHAR, 'visible' => true, 'required' => false); foreach ($entities as $entity) { $installer->addAttribute($entity, 'vendor_id', $options); } $installer->endSetup();
<?php /** * Add date attribute to quote and order item */ $_installer = new Mage_Sales_Model_Resource_Setup('core_setup'); $_entities = array('quote_item', 'order_item'); $_options = array('type' => Varien_Db_Ddl_Table::TYPE_DATETIME, 'visible' => true, 'required' => false); $_optionsForSerialize = array('type' => Varien_Db_Ddl_Table::TYPE_TEXT, 'visible' => true, 'required' => false); foreach ($_entities as $_entity) { $_installer->addAttribute($_entity, 'start_turnover_before', $_options); $_installer->addAttribute($_entity, 'end_turnover_after', $_options); $_installer->addAttribute($_entity, 'item_booked_serialize', $_optionsForSerialize); } $_installer->endSetup(); $_installer = $this; $_installer->startSetup(); $_installer->run("ALTER TABLE {$this->getTable('payperrentals/reservationorders')} ADD `start_turnover_before` DATETIME NOT NULL"); $_installer->run("ALTER TABLE {$this->getTable('payperrentals/reservationorders')} ADD `end_turnover_after` DATETIME NOT NULL"); $_installer->run("ALTER TABLE {$this->getTable('payperrentals/reservationorders')} ADD `item_booked_serialize` TEXT NOT NULL"); $_installer->endSetup();
<?php /* @var $installer Mage_Core_Model_Resource_Setup */ //$installer = $this; $installer = new Mage_Sales_Model_Resource_Setup('core_setup'); $installer->startSetup(); $installer->getConnection()->addColumn($installer->getTable('sales/quote_payment'), 'installment_type_id', Varien_Db_Ddl_Table::TYPE_INTEGER); $installer->addAttribute('quote_payment', 'installment_type_id', array('type' => 'int', 'visible' => false)); $installer->endSetup();
<?php $this->startSetup(); $setup = new Mage_Sales_Model_Resource_Setup('core_setup'); $setup->addAttribute('order', 'delivery_instructions', array('type' => 'varchar', 'nullable' => true, 'grid' => true)); $setup->addAttribute('quote', 'delivery_instructions', array('type' => 'varchar', 'nullable' => true, 'grid' => true)); $this->endSetup();
<?php $installer = new Mage_Sales_Model_Resource_Setup('core_setup'); /** * Add 'custom_attribute' attribute for entities * */ $entities = array('quote', 'quote_address', 'quote_item', 'quote_address_item', 'order', 'order_item'); $options = array('type' => Varien_Db_Ddl_Table::TYPE_VARCHAR, 'visible' => true, 'required' => false); foreach ($entities as $entity) { $installer->addAttribute($entity, 'custom_attribute', $options); } $installer->endSetup();
* Create table 'gift/customer_group' if not exists. */ $table = $installer->getConnection()->newTable($installer->getTable('gift/customer_group'))->addColumn('rule_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('unsigned' => true, 'nullable' => false, 'primary' => true), 'Rule Id')->addColumn('customer_group_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array('unsigned' => true, 'nullable' => false, 'primary' => true), 'Customer Group Id')->addIndex($installer->getIdxName('gift/customer_group', array('rule_id')), array('rule_id'))->addIndex($installer->getIdxName('gift/customer_group', array('customer_group_id')), array('customer_group_id'))->addForeignKey($installer->getFkName('gift/customer_group', 'rule_id', 'gift/rule', 'rule_id'), 'rule_id', $installer->getTable('gift/rule'), 'rule_id', Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)->addForeignKey($installer->getFkName('gift/customer_group', 'customer_group_id', 'customer/customer_group', 'customer_group_id'), 'customer_group_id', $installer->getTable('customer/customer_group'), 'customer_group_id', Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)->setComment('Gift Rules To Customer Groups Relations'); $installer->getConnection()->createTable($table); /** * Create table 'gift/label' */ $table = $installer->getConnection()->newTable($installer->getTable('gift/label'))->addColumn('label_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), 'Label Id')->addColumn('rule_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('unsigned' => true, 'nullable' => false), 'Rule Id')->addColumn('store_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array('unsigned' => true, 'nullable' => false), 'Store Id')->addColumn('label', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(), 'Label')->addIndex($installer->getIdxName('gift/label', array('rule_id', 'store_id'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), array('rule_id', 'store_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE))->addIndex($installer->getIdxName('gift/label', array('store_id')), array('store_id'))->addIndex($installer->getIdxName('gift/label', array('rule_id')), array('rule_id'))->addForeignKey($installer->getFkName('gift/label', 'rule_id', 'gift/rule', 'rule_id'), 'rule_id', $installer->getTable('gift/rule'), 'rule_id', Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)->addForeignKey($installer->getFkName('gift/label', 'store_id', 'core/store', 'store_id'), 'store_id', $installer->getTable('core/store'), 'store_id', Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)->setComment('Gift Label'); $installer->getConnection()->createTable($table); /** * Create table 'gift/product' if not exists. */ $table = $installer->getConnection()->newTable($installer->getTable('gift/product'))->addColumn('rule_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('unsigned' => true, 'nullable' => false, 'primary' => true), 'Rule Id')->addColumn('product_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array('unsigned' => true, 'nullable' => false, 'primary' => true), 'Product Id')->addIndex($installer->getIdxName('gift/product', array('rule_id')), array('rule_id'))->addIndex($installer->getIdxName('gift/product', array('product_id')), array('product_id'))->addForeignKey($installer->getFkName('gift/product', 'rule_id', 'gift/rule', 'rule_id'), 'rule_id', $installer->getTable('gift/rule'), 'rule_id', Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)->addForeignKey($installer->getFkName('gift/product', 'product_id', 'catalog/product', 'product_id'), 'product_id', $installer->getTable('catalog/product'), 'entity_id', Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)->setComment('Gift Rules To Product Relations'); $installer->getConnection()->createTable($table); /** * Create table 'gift/product_attribute' */ $table = $installer->getConnection()->newTable($installer->getTable('gift/product_attribute'))->addColumn('rule_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('unsigned' => true, 'nullable' => false, 'primary' => true), 'Rule Id')->addColumn('website_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array('unsigned' => true, 'nullable' => false, 'primary' => true), 'Website Id')->addColumn('customer_group_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array('unsigned' => true, 'nullable' => false, 'primary' => true), 'Customer Group Id')->addColumn('attribute_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array('unsigned' => true, 'nullable' => false, 'primary' => true), 'Attribute Id')->addIndex($installer->getIdxName('gift/product_attribute', array('website_id')), array('website_id'))->addIndex($installer->getIdxName('gift/product_attribute', array('customer_group_id')), array('customer_group_id'))->addIndex($installer->getIdxName('gift/product_attribute', array('attribute_id')), array('attribute_id'))->addForeignKey($installer->getFkName('gift/product_attribute', 'attribute_id', 'eav/attribute', 'attribute_id'), 'attribute_id', $installer->getTable('eav/attribute'), 'attribute_id', Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_NO_ACTION)->addForeignKey($installer->getFkName('gift/product_attribute', 'customer_group_id', 'customer/customer_group', 'customer_group_id'), 'customer_group_id', $installer->getTable('customer/customer_group'), 'customer_group_id', Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_NO_ACTION)->addForeignKey($installer->getFkName('gift/product_attribute', 'rule_id', 'gift/rule', 'rule_id'), 'rule_id', $installer->getTable('gift/rule'), 'rule_id', Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_NO_ACTION)->addForeignKey($installer->getFkName('gift/product_attribute', 'website_id', 'core/website', 'website_id'), 'website_id', $installer->getTable('core/website'), 'website_id', Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_NO_ACTION)->setComment('Gift Product Attribute'); $installer->getConnection()->createTable($table); $installer->endSetup(); $installer = new Mage_Sales_Model_Resource_Setup('core_setup'); $installer->startSetup(); /** * Add 'gift_rule_ids' attribute for entities */ $entities = array('quote', 'quote_address', 'order'); $options = array('type' => Varien_Db_Ddl_Table::TYPE_VARCHAR, 'visible' => false, 'required' => false); foreach ($entities as $entity) { $installer->addAttribute($entity, 'gift_rule_ids', $options); } $installer->endSetup();
<?php /* * @copyright Copyright (C) 2016 Gamuza Technologies (http://www.gamuza.com.br/) * @author Eneias Ramos de Melo <*****@*****.**> */ $installer = new Mage_Sales_Model_Resource_Setup('pagarme_setup'); $installer->startSetup(); // Order Payment $entity = 'order_payment'; $attributes = array('pagarme_subscription_id' => array('type' => Varien_Db_Ddl_Table::TYPE_INTEGER)); foreach ($attributes as $attribute => $options) { $installer->addAttribute($entity, $attribute, $options); } $installer->endSetup();
<?php //Für das anlegen des Cookie Attributes bei Bestellungen siehe Affiliate $setup = new Mage_Sales_Model_Resource_Setup(); $setup->startSetup(); //EAN $setup->addAttribute('quote', "customer_source", array('type' => 'text', 'visible' => true, 'backend_type' => 'text', 'frontend_input' => 'text', 'label' => 'Costumer Source', 'input' => 'text', 'required' => false, 'user_defined' => true, 'default' => NULL, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'searchable' => false, 'is_configurable' => false)); $setup->endSetup();
<?php $installer = new Mage_Sales_Model_Resource_Setup('core_setup'); $installer->startSetup(); $entities = array('quote', 'quote_address', 'quote_item', 'quote_address_item', 'order', 'order_item'); $options = array('type' => Varien_Db_Ddl_Table::TYPE_VARCHAR, 'visible' => true, 'required' => false); foreach ($entities as $entity) { $installer->addAttribute($entity, 'code_model', $options); } $installer->endSetup();
/** * Prepare RMA item attribute values to save in additional table * * @param array $attr * @return array */ protected function _prepareValues($attr) { $data = parent::_prepareValues($attr); $data = array_merge($data, array('is_visible' => $this->_getValue($attr, 'visible', 1), 'is_system' => $this->_getValue($attr, 'system', 1), 'input_filter' => $this->_getValue($attr, 'input_filter', null), 'multiline_count' => $this->_getValue($attr, 'multiline_count', 0), 'validate_rules' => $this->_getValue($attr, 'validate_rules', null), 'data_model' => $this->_getValue($attr, 'data', null), 'sort_order' => $this->_getValue($attr, 'position', 0))); return $data; }
$eav->addAttribute('quote', 'payexinvoice_payment_fee', array('type' => 'decimal')); $eav->addAttribute('quote', 'base_payexinvoice_payment_fee', array('type' => 'decimal')); $eav->addAttribute('order', 'payexinvoice_payment_fee', array('type' => 'decimal')); $eav->addAttribute('order', 'base_payexinvoice_payment_fee', array('type' => 'decimal')); // Clean up unnecessary data try { $this->_conn->dropColumn($this->getTable('sales_flat_order'), 'px_invoice_fee'); $this->_conn->dropColumn($this->getTable('sales_flat_order'), 'base_px_invoice_fee'); $this->_conn->dropColumn($this->getTable('sales_flat_invoice'), 'px_invoice_fee'); $this->_conn->dropColumn($this->getTable('sales_flat_invoice'), 'base_px_invoice_fee'); $this->_conn->dropColumn($this->getTable('sales_flat_quote'), 'px_invoice_fee'); $this->_conn->dropColumn($this->getTable('sales_flat_quote'), 'base_px_invoice_fee'); $this->_conn->dropColumn($this->getTable('sales_flat_quote_address'), 'payexinvoice_payment_fee'); $this->_conn->dropColumn($this->getTable('sales_flat_quote_address'), 'base_payexinvoice_payment_fee'); } catch (Exception $e) { Mage::logException($e); } try { $eav = new Mage_Sales_Model_Resource_Setup('sales_setup'); $eav->removeAttribute('order', 'px_invoice_fee'); $eav->removeAttribute('order', 'base_px_invoice_fee'); $eav->removeAttribute('invoice', 'px_invoice_fee'); $eav->removeAttribute('invoice', 'base_px_invoice_fee'); $eav->removeAttribute('quote', 'px_invoice_fee'); $eav->removeAttribute('quote', 'base_px_invoice_fee'); $eav->removeAttribute('quote_address', 'px_invoice_fee'); $eav->removeAttribute('quote_address', 'base_px_invoice_fee'); } catch (Exception $e) { Mage::logException($e); } $this->endSetup();
<?php $this->startSetup(); $this->_conn->addColumn($this->getTable('sales_flat_quote'), 'factoring_payment_fee', 'decimal(12,4)'); $this->_conn->addColumn($this->getTable('sales_flat_quote'), 'base_factoring_payment_fee', 'decimal(12,4)'); $this->_conn->addColumn($this->getTable('sales_flat_order'), 'factoring_payment_fee', 'decimal(12,4)'); $this->_conn->addColumn($this->getTable('sales_flat_order'), 'base_factoring_payment_fee', 'decimal(12,4)'); $eav = new Mage_Sales_Model_Resource_Setup('sales_setup'); $eav->addAttribute('quote', 'factoring_payment_fee', array('type' => 'decimal')); $eav->addAttribute('quote', 'base_factoring_payment_fee', array('type' => 'decimal')); $eav->addAttribute('order', 'factoring_payment_fee', array('type' => 'decimal')); $eav->addAttribute('order', 'base_factoring_payment_fee', array('type' => 'decimal')); $this->endSetup();
<?php /* * @copyright Copyright (C) 2015 Gamuza Technologies (http://www.gamuza.com.br/) * @author Eneias Ramos de Melo <*****@*****.**> */ $installer = new Mage_Sales_Model_Resource_Setup('pagarme_setup'); $installer->startSetup(); function addFeeColumns($installer) { $table = $installer->getTable('sales/quote_address'); $installer->getConnection()->addColumn($table, 'fee_amount', array('type' => Varien_Db_Ddl_Table::TYPE_DECIMAL, 'unsigned' => true, 'nullable' => false, 'comment' => 'Fee Amount')); $installer->getConnection()->addColumn($table, 'base_fee_amount', array('type' => Varien_Db_Ddl_Table::TYPE_DECIMAL, 'unsigned' => true, 'nullable' => false, 'comment' => 'Base Fee Amount')); $table = $installer->getTable('sales/order'); $installer->getConnection()->addColumn($table, 'fee_amount', array('type' => Varien_Db_Ddl_Table::TYPE_DECIMAL, 'unsigned' => true, 'nullable' => false, 'comment' => 'Fee Amount')); $installer->getConnection()->addColumn($table, 'base_fee_amount', array('type' => Varien_Db_Ddl_Table::TYPE_DECIMAL, 'unsigned' => true, 'nullable' => false, 'comment' => 'Base Fee Amount')); $installer->getConnection()->addColumn($table, 'fee_amount_invoiced', array('type' => Varien_Db_Ddl_Table::TYPE_DECIMAL, 'unsigned' => true, 'nullable' => false, 'comment' => 'Fee Amount Invoiced')); $installer->getConnection()->addColumn($table, 'base_fee_amount_invoiced', array('type' => Varien_Db_Ddl_Table::TYPE_DECIMAL, 'unsigned' => true, 'nullable' => false, 'comment' => 'Base Fee Amount Invoiced')); $installer->getConnection()->addColumn($table, 'fee_amount_refunded', array('type' => Varien_Db_Ddl_Table::TYPE_DECIMAL, 'unsigned' => true, 'nullable' => false, 'comment' => 'Fee Amount Refunded')); $installer->getConnection()->addColumn($table, 'base_fee_amount_refunded', array('type' => Varien_Db_Ddl_Table::TYPE_DECIMAL, 'unsigned' => true, 'nullable' => false, 'comment' => 'Base Fee Amount Refunded')); $table = $installer->getTable('sales/invoice'); $installer->getConnection()->addColumn($table, 'fee_amount', array('type' => Varien_Db_Ddl_Table::TYPE_DECIMAL, 'unsigned' => true, 'nullable' => false, 'comment' => 'Fee Amount')); $installer->getConnection()->addColumn($table, 'base_fee_amount', array('type' => Varien_Db_Ddl_Table::TYPE_DECIMAL, 'unsigned' => true, 'nullable' => false, 'comment' => 'Base Fee Amount')); $table = $installer->getTable('sales/creditmemo'); $installer->getConnection()->addColumn($table, 'fee_amount', array('type' => Varien_Db_Ddl_Table::TYPE_DECIMAL, 'unsigned' => true, 'nullable' => false, 'comment' => 'Fee Amount')); $installer->getConnection()->addColumn($table, 'base_fee_amount', array('type' => Varien_Db_Ddl_Table::TYPE_DECIMAL, 'unsigned' => true, 'nullable' => false, 'comment' => 'Base Fee Amount')); } addFeeColumns($installer); $installer->endSetup();
<?php /** * Cybage Marketplace Plugin * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * It is available on the World Wide Web at: * http://opensource.org/licenses/osl-3.0.php * If you are unable to access it on the World Wide Web, please send an email * To: Support_Magento@cybage.com. We will send you a copy of the source file. * * @category Marketplace Plugin * @package Cybage_Marketplace * @copyright Copyright (c) 2014 Cybage Software Pvt. Ltd., India * http://www.cybage.com/pages/centers-of-excellence/ecommerce/ecommerce.aspx * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @author Cybage Software Pvt. Ltd. <*****@*****.**> */ $installer = new Mage_Sales_Model_Resource_Setup('core_setup'); $installer->startSetup(); $attribute = array('type' => 'int', 'backend_type' => 'text', 'frontend_input' => 'text', 'is_user_defined' => true, 'label' => 'Seller id', 'visible' => true, 'required' => false, 'user_defined' => true, 'searchable' => false, 'filterable' => true, 'comparable' => true, 'default' => 0); $installer->addAttribute('quote_item', 'seller_id', $attribute); $installer->endSetup();
* obtain it through the world-wide-web, please send an email * to license@magentocommerce.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * * @category Atwix * @package Atwix_CustomAttribute * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ /* @var $installer Mage_Sales_Model_Resource_Setup */ $installer = new Mage_Sales_Model_Resource_Setup('core_setup'); /** * Add 'custom_attribute' attribute for entities */ /* $entities = array( 'quote_item', 'order_item' ); $options = array( 'type' => Varien_Db_Ddl_Table::TYPE_VARCHAR, 'visible' => true, 'required' => false ); foreach ($entities as $entity) { $installer->addAttribute($entity, 'refrigeration_seal', $options);
<?php $installer = $this; $installer->startSetup(); /** * SQL Table for delivery restriction * Data from CSV */ $installer->run("\nDROP TABLE IF EXISTS `{$installer->getTable('balticode_dpd_delivery_price')}`;\nCREATE TABLE `{$installer->getTable('balticode_dpd_delivery_price')}` (\n `id_dpd_delivery_price` int(11) NOT NULL AUTO_INCREMENT,\n `postcode` int(11) NOT NULL,\n `price` text NOT NULL,\n `free_from_price` text NULL,\n `carrier_id` text NOT NULL,\n `weight` text NULL,\n `height` text NULL,\n `width` text NULL,\n `depth` text NULL,\n `oversized_price` text NULL,\n `overweight_price` text NULL,\n `id_shop` int(11) NOT NULL,\n PRIMARY KEY (`id_dpd_delivery_price`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='DPD Delivery Price by Postcode';\n"); /** * SQL Table for delivery points * Data from DPD API about Parcel Store places */ $installer->run("\nDROP TABLE IF EXISTS `{$installer->getTable('balticode_dpd_delivery_point')}`;\nCREATE TABLE `{$installer->getTable('balticode_dpd_delivery_point')}` (\n `id_dpd_delivery_points` int(11) NOT NULL AUTO_INCREMENT,\n `parcelshop_id` int(11) NOT NULL,\n `company` text NOT NULL,\n `city` text NOT NULL,\n `pcode` text NOT NULL,\n `street` text NOT NULL,\n `country` text NOT NULL,\n `email` text NOT NULL,\n `phone` text NOT NULL,\n `comment` text NOT NULL,\n `created_time` text NOT NULL,\n `update_time` text NOT NULL,\n `active` int(1) DEFAULT '1',\n `deleted` int(1) DEFAULT '0',\n PRIMARY KEY (`id_dpd_delivery_points`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='DPD Delivery Points Data';\n"); $installer->endSetup(); /** * Add Attribute to Order to save order options */ $setup = new Mage_Sales_Model_Resource_Setup('core_setup'); $setup->startSetup(); $setup->addAttribute('order', 'dpd_delivery_options', array('type' => 'varchar', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 'default' => null)); $setup->addAttribute('quote', 'dpd_delivery_options', array('type' => 'varchar', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 'default' => null)); $setup->endSetup(); $installer = new Mage_Sales_Model_Resource_Setup('core_setup'); $installer->startSetup(); $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'package_height', array('label' => Mage::helper('adminhtml')->__('Height'), 'group' => 'General', 'type' => 'decimal', 'input' => 'text', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'user_defined' => false, 'required' => false, 'visible' => true, 'source' => null, 'backend' => null, 'searchable' => false, 'visible_in_advanced_search' => false, 'visible_on_front' => false, 'is_configurable' => false, 'is_html_allowed_on_front' => false, 'sort_order' => '5', 'apply_to' => 'simple')); $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'package_width', array('label' => Mage::helper('adminhtml')->__('Width'), 'group' => 'General', 'type' => 'decimal', 'input' => 'text', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'user_defined' => false, 'required' => false, 'visible' => true, 'source' => null, 'backend' => null, 'searchable' => false, 'visible_in_advanced_search' => false, 'visible_on_front' => false, 'is_configurable' => false, 'is_html_allowed_on_front' => false, 'sort_order' => '5', 'apply_to' => 'simple')); $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'package_depth', array('label' => Mage::helper('adminhtml')->__('Depth'), 'group' => 'General', 'type' => 'decimal', 'input' => 'text', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'user_defined' => false, 'required' => false, 'visible' => true, 'source' => null, 'backend' => null, 'searchable' => false, 'visible_in_advanced_search' => false, 'visible_on_front' => false, 'is_configurable' => false, 'is_html_allowed_on_front' => false, 'sort_order' => '5', 'apply_to' => 'simple')); $installer->endSetup();
<?php /** * Cybage Marketplace Plugin * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * It is available on the World Wide Web at: * http://opensource.org/licenses/osl-3.0.php * If you are unable to access it on the World Wide Web, please send an email * To: Support_Magento@cybage.com. We will send you a copy of the source file. * * @category Marketplace Plugin * @package Cybage_Marketplace * @copyright Copyright (c) 2014 Cybage Software Pvt. Ltd., India * http://www.cybage.com/pages/centers-of-excellence/ecommerce/ecommerce.aspx * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @author Cybage Software Pvt. Ltd. <*****@*****.**> */ $installer = new Mage_Sales_Model_Resource_Setup('core_setup'); $installer->startSetup(); $attribute = array('type' => 'int', 'backend_type' => 'text', 'frontend_input' => 'text', 'is_user_defined' => true, 'label' => 'Shipping Charges', 'visible' => true, 'required' => false, 'user_defined' => true, 'searchable' => false, 'filterable' => true, 'comparable' => true, 'default' => 0); $installer->addAttribute('quote_item', 'shipping_charges', $attribute); $installer->addAttribute('order_item', 'shipping_charges', $attribute); $installer->endSetup();
<?php /** * @var $installer Mage_Core_Model_Resource_Setup */ $installer = $this; $installer->startSetup(); /** Remove Attributes */ $_attributesArray = array('catalog_product' => array('payperrentals_buyoutprice', 'payperrentals_enable_extend', 'payperrentals_enable_buyout', 'payperrentals_buyout_onproduct')); $_attributeModel = new Mage_Sales_Model_Resource_Setup('sales_setup'); foreach ($_attributesArray as $_attributeType => $_attributeArray) { foreach ($_attributeArray as $_attributeCode) { try { $_attributeModel->removeAttribute($_attributeType, $_attributeCode); } catch (Exception $_e) { Mage::logException($_e); } } } $installer->endSetup();
function addPosSaleIdAttributeToOrders() { Mage::log("Adding POS Sale ID Attribute to orders", Zend_Log::INFO); $setup = new Mage_Sales_Model_Resource_Setup('core_setup'); $setup->addAttribute('order', 'pos_sale_id', array('type' => 'int', 'label' => 'Octahedron POS sale ID', 'visible' => false, 'required' => false, 'visible_on_front' => false, 'user_defined' => false)); }
* * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE_AFL.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-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. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * * @category Magentando * @package Magentando_SplitDelivery * @copyright Copyright (c) 2014 Magentando <http://www.magentando.com.br> * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * @author Leandro Rosa <*****@*****.**> * */ $installer = new Mage_Sales_Model_Resource_Setup('core_setup'); $entities = array('quote', 'quote_item', 'order', 'order_item'); $options = array('type' => Varien_Db_Ddl_Table::TYPE_TEXT, 'visible' => true, 'required' => false); foreach ($entities as $entity) { $installer->addAttribute($entity, 'splitdelivery', $options); } $installer->endSetup();
<?php $setup = new Mage_Sales_Model_Resource_Setup('core_setup'); $setup->startSetup(); $setup->addAttribute('order', 'do_export_to_alvine', array('type' => 'boolean', 'label' => 'Do export to Alvine', 'input' => 'boolean', 'required' => false, 'user_defined' => false, 'default' => NULL, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'visible' => false)); $setup->endSetup(); $collection = Mage::getResourceModel('sales/order_collection'); foreach ($collection as $order) { $order->setData('do_export_to_alvine', 0); $order->getResource()->saveAttribute($order, 'do_export_to_alvine'); }