public function endSetup() { $cacheKey = Mage::helper('M2ePro/Module')->getName() . '_VERSION_UPDATER'; Mage::app()->getCache()->remove($cacheKey); Mage::helper('M2ePro/Data')->removeAllCacheValues(); return parent::endSetup(); }
/** * Instal Sample database * * $data = array( * [db_host] * [db_name] * [db_user] * [db_pass] * ) * * @param array $data */ public function installSampleDB_($data) { $config = array('host' => $data['db_host'], 'username' => $data['db_user'], 'password' => $data['db_pass'], 'dbname' => $data['db_name']); $connection = Mage::getSingleton('core/resource')->createConnection('core_setup', $this->_getConnenctionType(), $config); $installer = new Mage_Core_Model_Resource_Setup('core_setup'); $installer->startSetup(); //Get content from sample data //Default sample data //$tablePrefix = (string)Mage::getConfig()->getTablePrefix(); $tablePrefix = $data['db_prefix']; $base_url = $data['unsecure_base_url']; $base_surl = $base_url; if (!empty($data['use_secure'])) { $base_surl = $data['secure_base_url']; } /* Run sample_data.sql if found, by pass default sample data from Magento */ $file = Mage::getConfig()->getBaseDir() . '/sql/sample_data.sql'; if (is_file($file) && ($sqls = file_get_contents($file))) { $sqls = str_replace('#__', $tablePrefix, $sqls); $installer->run($sqls); } else { $file = Mage::getConfig()->getBaseDir() . '/sql/magento_sample_data_for_1.2.0.sql'; if (is_file($file) && ($sqls = file_get_contents($file))) { $sqls = str_replace('#__', $tablePrefix, $sqls); $installer->run($sqls); } } $installer->run("\n\t\t\tUPDATE `{$tablePrefix}core_config_data` SET `value`='{$base_url}' where `path`='web/unsecure/base_url';\n\t\t\tUPDATE `{$tablePrefix}core_config_data` SET `value`='{$base_surl}' where `path`='web/secure/base_url';\n\t\t"); $installer->endSetup(); }
public function endSetup() { $this->removeConfigDuplicates(); $this->updateInstallationVersionHistory(); Mage::helper('M2ePro/Module')->clearCache(); return parent::endSetup(); }
public function installQuickstartDB_ ($data) { $config = array( 'host' => $data['db_host'], 'username' => $data['db_user'], 'password' => $data['db_pass'], 'dbname' => $data['db_name'] ); $connection = Mage::getSingleton('core/resource')->createConnection('core_setup', $this->_getConnenctionType(), $config); $installer = new Mage_Core_Model_Resource_Setup('core_setup'); $installer->startSetup(); //Get content from quickstart data $tablePrefix = $data['db_prefix']; $base_url = $data['unsecure_base_url']; $base_surl = $base_url; if (!empty($data['use_secure'])) $base_surl = $data['secure_base_url']; $file = Mage::getConfig()->getBaseDir().'/sql/'.$this->quickstart_db_name; if (is_file($file) && ($sqls = file_get_contents ($file))) { $sqls = str_replace ('#__', $tablePrefix, $sqls); $installer->run ($sqls); } $installer->run (" UPDATE `{$tablePrefix}core_config_data` SET `value`='$base_url' where `path`='web/unsecure/base_url'; UPDATE `{$tablePrefix}core_config_data` SET `value`='$base_surl' where `path`='web/secure/base_url'; " ); $installer->endSetup(); }
public function endSetup() { $this->removeConfigDuplicates(); Mage::helper('M2ePro/Module')->clearCache(); return parent::endSetup(); }
public function reinstallAction() { $installer = new Mage_Core_Model_Resource_Setup('core_setup'); $installer->startSetup(); $installer->run("\n\t\t\tDELETE FROM {$installer->getTable('core_resource')} WHERE `{$installer->getTable('core_resource')}`.`code` = 'webpos_setup';\n\t\t"); $installer->endSetup(); echo $this->__('Successfully! Please refresh magento cache to get the new version'); }
public function endSetup() { Mage::helper('M2ePro/Module')->clearCache(); return parent::endSetup(); }
public function endSetup() { parent::endSetup(); $this->afterFileExecution(); if ($this->isLockFileExists() && @file_get_contents($this->getLockFilePath()) != $this->lockId) { exit; } return $this; }
public function updatedb23Action() { $installer = new Mage_Core_Model_Resource_Setup(); $installer->startSetup(); $webposHelper = Mage::helper("webpos"); if (!$webposHelper->columnExist($installer->getTable('sales_flat_order'), 'webpos_admin_id')) { $installer->run("ALTER TABLE {$installer->getTable('sales_flat_order')} ADD COLUMN `webpos_admin_id` int(10) default NULL"); } if (!$webposHelper->columnExist($installer->getTable('sales_flat_order'), 'webpos_admin_name')) { $installer->run("ALTER TABLE {$installer->getTable('sales_flat_order')} ADD COLUMN `webpos_admin_name` varchar(255) default NULL"); } if (!$webposHelper->columnExist($installer->getTable('webpos_user'), 'store_ids')) { $installer->run("ALTER TABLE {$installer->getTable('webpos_user')} ADD `store_ids` VARCHAR(255) NOT NULL AFTER `user_id`;"); } if (!$webposHelper->columnExist($installer->getTable('webpos_transaction'), 'user_id')) { $installer->run("ALTER TABLE {$installer->getTable('webpos_transaction')} ADD `user_id` int(4) unsigned DEFAULT NULL;"); } if (!$webposHelper->columnExist($installer->getTable('webpos_transaction'), 'till_id')) { $installer->run("ALTER TABLE {$installer->getTable('webpos_transaction')} ADD `till_id` unsigned NULL DEFAULT 0;"); } if (!$webposHelper->columnExist($installer->getTable('webpos_transaction'), 'location_id')) { $installer->run("ALTER TABLE {$installer->getTable('webpos_transaction')} ADD `location_id` unsigned NULL DEFAULT 0;"); } if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'till_id')) { $installer->run(" ALTER TABLE {$installer->getTable('sales/order')} ADD `till_id` int(11) unsigned NOT NULL DEFAULT 0; "); } if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'location_id')) { $installer->run(" ALTER TABLE {$installer->getTable('sales/order')} ADD `location_id` int(11) unsigned NOT NULL DEFAULT 0; "); } if (!$webposHelper->columnExist($installer->getTable('sales/quote_payment'), 'ccforpos_ref_no')) { $installer->run(" ALTER TABLE {$installer->getTable('sales/quote_payment')} ADD `ccforpos_ref_no` VARCHAR( 255 ) NOT NULL; "); } if (!$webposHelper->columnExist($installer->getTable('sales/order_payment'), 'ccforpos_ref_no')) { $installer->run(" ALTER TABLE {$installer->getTable('sales/order_payment')} ADD `ccforpos_ref_no` VARCHAR( 255 ) NOT NULL; "); } if (!$webposHelper->columnExist($installer->getTable('webpos_order'), 'till_id')) { $installer->run(" ALTER TABLE {$installer->getTable('webpos_order')} ADD `till_id` int(11) unsigned NOT NULL DEFAULT 0; "); } if (!$webposHelper->columnExist($installer->getTable('webpos_order'), 'location_id')) { $installer->run(" ALTER TABLE {$installer->getTable('webpos_order')} ADD `location_id` int(11) unsigned NOT NULL DEFAULT 0; "); } if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_cash')) { $installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_cash` decimal(12,4) NOT NULL default '0'"); } if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_base_cash')) { $installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_base_cash` decimal(12,4) NOT NULL default '0'"); } if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_cash')) { $installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_cash` decimal(12,4) NOT NULL default '0'"); } if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_base_cash')) { $installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_base_cash` decimal(12,4) NOT NULL default '0'"); } if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_ccforpos')) { $installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_ccforpos` decimal(12,4) NOT NULL default '0'"); } if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_base_ccforpos')) { $installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_base_ccforpos` decimal(12,4) NOT NULL default '0'"); } if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_ccforpos')) { $installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_ccforpos` decimal(12,4) NOT NULL default '0'"); } if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_base_ccforpos')) { $installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_base_ccforpos` decimal(12,4) NOT NULL default '0'"); } if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_cp1forpos')) { $installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_cp1forpos` decimal(12,4) NOT NULL default '0'"); } if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_base_cp1forpos')) { $installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_base_cp1forpos` decimal(12,4) NOT NULL default '0'"); } if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_cp1forpos')) { $installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_cp1forpos` decimal(12,4) NOT NULL default '0'"); } if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_base_cp1forpos')) { $installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_base_cp1forpos` decimal(12,4) NOT NULL default '0'"); } if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_cp2forpos')) { $installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_cp2forpos` decimal(12,4) NOT NULL default '0'"); } if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_base_cp2forpos')) { $installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_base_cp2forpos` decimal(12,4) NOT NULL default '0'"); } if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_cp2forpos')) { $installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_cp2forpos` decimal(12,4) NOT NULL default '0'"); } if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_base_cp2forpos')) { $installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_base_cp2forpos` decimal(12,4) NOT NULL default '0'"); } if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_change')) { $installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_change` decimal(12,4) NOT NULL default '0'"); } if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_base_change')) { $installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_base_change` decimal(12,4) NOT NULL default '0'"); } if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_change')) { $installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_change` decimal(12,4) NOT NULL default '0'"); } if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_base_change')) { $installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_base_change` decimal(12,4) NOT NULL default '0'"); } $installer->endSetup(); $installer = new Mage_Eav_Model_Entity_Setup(); $installer->startSetup(); $fieldList = array('tax_class_id'); foreach ($fieldList as $field) { $applyTo = explode(',', $installer->getAttribute(Mage_Catalog_Model_Product::ENTITY, $field, 'apply_to')); if (!in_array('customsale', $applyTo)) { $applyTo[] = 'customsale'; $installer->updateAttribute(Mage_Catalog_Model_Product::ENTITY, $field, 'apply_to', implode(',', $applyTo)); } } $installer->endSetup(); $product = Mage::getModel('catalog/product'); $product->getIdBySku('webpos-customsale'); if ($product->getId()) { try { $product->setData('tax_class_id', 0); $product->save(); } catch (Exception $e) { Zend_debug::dump($e->getMessage()); } } }