private function processProcessingRequestTable() { $connection = $this->installer->getConnection(); $tempTable = $this->installer->getTable('m2epro_processing_request'); $connection->update($tempTable, array('responser_model' => new Zend_Db_Expr("REPLACE(`responser_model`,'_Tasks','')"))); $connection->update($tempTable, array('responser_model' => 'M2ePro/Amazon_Synchronization_Orders_Receive_Responser'), array("responser_model = 'M2ePro/Amazon_Synchronization_Orders_Responser'")); }
private function getStoreCategoryPathById($categoryId, $accountId, $delimiter = ' -> ') { if (empty($categoryId) || empty($accountId)) { return ''; } $ebayStoreCategoryTable = $this->installer->getTable('m2epro' . self::PREFIX_TABLE_BACKUP . '_ebay_account_store_category'); $categories = $this->installer->getConnection()->select()->from($ebayStoreCategoryTable, '*')->where('account_id = ?', $accountId)->where('category_id = ?', $categoryId)->query()->fetchAll(); $path = array(); while (true) { $currentCategory = NULL; foreach ($categories as $category) { if ($category['category_id'] == $categoryId) { $currentCategory = $category; break; } } if (is_null($currentCategory)) { break; } $path[] = $currentCategory['title']; if ($currentCategory['parent_id'] == 0) { break; } $categoryId = $currentCategory['parent_id']; } return implode($delimiter, array_reverse($path)); }
private function processSynchronizationConfigTable() { $connection = $this->installer->getConnection(); $tempTable = $this->installer->getTable('m2epro_synchronization_config'); $tempQuery = "SELECT * FROM `{$tempTable}` WHERE `group` IS NULL AND `key` = 'last_access'"; $tempRow = $connection->query($tempQuery)->fetch(); if ($tempRow === false) { $this->installer->run(<<<SQL INSERT INTO `m2epro_synchronization_config` (`group`,`key`,`value`,`notice`,`update_date`,`create_date`) VALUES (NULL, 'last_access', NULL, NULL, '2014-01-01 00:00:00', '2014-01-01 00:00:00'), (NULL, 'last_run', NULL, NULL, '2014-01-01 00:00:00', '2014-01-01 00:00:00'); SQL ); } $where = "(`key` = 'max_deactivate_time') "; $where .= "OR (`group` = '/feedbacks/') "; $where .= "OR (`group` = '/marketplaces/') "; $where .= "OR (`group` = '/orders/') "; $where .= "OR (`group` = '/other_listings/') "; $where .= "OR (`group` = '/policies/') "; $where .= "OR (`group` = '/templates/') "; $where .= "OR (`group` = '/defaults/processing/') "; $where .= "OR (`group` = '/settings/profiler/')"; $connection->delete($tempTable, $where); $connection->update($tempTable, array('key' => 'type'), "`group` = '/defaults/inspector/product_changes/' AND `key` = 'mode'"); $subWhere = "`group` = '/amazon/orders/reserve_cancellation/' "; $subWhere .= "OR `group` = '/ebay/feedbacks/receive/' "; $subWhere .= "OR `group` = '/ebay/feedbacks/response/' "; $subWhere .= "OR `group` = '/ebay/orders/cancellation/' "; $subWhere .= "OR `group` = '/ebay/orders/reserve_cancellation/'"; $connection->update($tempTable, array('key' => 'last_time'), "`key` = 'last_access' AND ({$subWhere})"); }
private function processProductActions() { $connection = $this->installer->getConnection(); $processingTable = $this->installer->getTable('m2epro_processing_request'); $oldProcessingRows = $connection->query("\n SELECT * FROM `{$processingTable}`\n WHERE responser_model REGEXP '^M2ePro\\/Connector_(Amazon|Buy|Play){1}_Product_*'\n ")->fetchAll(); $newProcessingRows = array(); foreach ($oldProcessingRows as $row) { $responserParams = $row['responser_params'] ? json_decode($row['responser_params'], true) : array(); if (empty($responserParams)) { $newProcessingRows[] = $row; continue; } if (!isset($responserParams['action_identifier'], $responserParams['listing_log_action'])) { $newProcessingRows[] = $row; continue; } $responserParams['lock_identifier'] = $responserParams['action_identifier']; $responserParams['action_type'] = $responserParams['lock_identifier']; $responserParams['action_type'] == 'stop_and_remove' && ($responserParams['action_type'] = 'stop'); $responserParams['action_type'] == 'delete_and_remove' && ($responserParams['action_type'] = 'delete'); $responserParams['action_type'] = $this->getActionType($responserParams['action_type']); unset($responserParams['action_identifier']); $responserParams['logs_action'] = $responserParams['listing_log_action']; unset($responserParams['listing_log_action']); if (empty($responserParams['products']) || !is_array($responserParams['products'])) { $row['responser_params'] = json_encode($responserParams); $newProcessingRows[] = $row; continue; } $newProducts = array(); foreach ($responserParams['products'] as $id => $product) { $newProducts[$id] = $product['request']['sended_data']; } $responserParams['products'] = $newProducts; $row['responser_params'] = json_encode($responserParams); $newProcessingRows[] = $row; } if (!empty($newProcessingRows)) { $connection->insertOnDuplicate($processingTable, $newProcessingRows); } }
function dropIndexes(Ess_M2ePro_Model_Upgrade_MySqlSetup $installer, $tableName, $indexesToDrop) { $tempTable = $installer->getTable($tableName); if (!$tempTable) { return; } $tempTableIndexesList = $installer->getConnection()->getIndexList($tempTable); foreach ($indexesToDrop as $indexToDrop) { if (isset($tempTableIndexesList[strtoupper($indexToDrop)])) { $installer->getConnection()->dropKey($tempTable, $indexToDrop); } } }
private function deleteOldData() { $connection = $this->installer->getConnection(); $this->installer->run(<<<SQL DROP TABLE IF EXISTS `m2epro_listing_category`; DROP TABLE IF EXISTS `m2epro_ebay_listing_auto_category`; DROP TABLE IF EXISTS `m2epro_ebay_listing_auto_category_group`; SQL ); $oldTable = $this->installer->getTable('m2epro_temp_ebay_listing_auto_category_group'); $newTable = $this->installer->getTable('m2epro_ebay_listing_auto_category_group'); if ($this->installer->tableExists($oldTable) && !$this->installer->tableExists($newTable)) { $connection->query("RENAME TABLE `{$oldTable}` TO `{$newTable}`"); } $tempTable = $this->installer->getTable('m2epro_ebay_listing'); $tempTableIndexList = $connection->getIndexList($tempTable); if (isset($tempTableIndexList[strtoupper('auto_mode')])) { $connection->dropKey($tempTable, 'auto_mode'); } if (isset($tempTableIndexList[strtoupper('auto_global_adding_mode')])) { $connection->dropKey($tempTable, 'auto_global_adding_mode'); } if (isset($tempTableIndexList[strtoupper('auto_website_adding_mode')])) { $connection->dropKey($tempTable, 'auto_website_adding_mode'); } if (isset($tempTableIndexList[strtoupper('auto_website_deleting_mode')])) { $connection->dropKey($tempTable, 'auto_website_deleting_mode'); } if ($connection->tableColumnExists($tempTable, 'auto_mode') !== false) { $connection->dropColumn($tempTable, 'auto_mode'); } if ($connection->tableColumnExists($tempTable, 'auto_global_adding_mode') !== false) { $connection->dropColumn($tempTable, 'auto_global_adding_mode'); } if ($connection->tableColumnExists($tempTable, 'auto_website_adding_mode') !== false) { $connection->dropColumn($tempTable, 'auto_website_adding_mode'); } if ($connection->tableColumnExists($tempTable, 'auto_website_deleting_mode') !== false) { $connection->dropColumn($tempTable, 'auto_website_deleting_mode'); } $tempTable = $this->installer->getTable('m2epro_listing'); if ($connection->tableColumnExists($tempTable, 'categories_add_action') !== false) { $connection->dropColumn($tempTable, 'categories_add_action'); } if ($connection->tableColumnExists($tempTable, 'categories_delete_action') !== false) { $connection->dropColumn($tempTable, 'categories_delete_action'); } }
private function processWizard() { $tempTable = $this->installer->getTable('m2epro_wizard'); $tempQuery = "SELECT * FROM `{$tempTable}` WHERE `nick` = 'migrationNewAmazon'"; $tempRow = $this->installer->getConnection()->query($tempQuery)->fetch(); if ($tempRow !== false) { return; } $this->getInstaller()->run(<<<SQL INSERT INTO `m2epro_wizard` (`nick`, `view`, `status`, `step`, `type`, `priority`) VALUES ('migrationNewAmazon', 'common', 0, NULL, 0, 6); SQL ); }
private function processOrderLogTable() { $connection = $this->installer->getConnection(); $tempTable = $this->installer->getTable('m2epro_order_log'); $tempTableIndexList = $connection->getIndexList($tempTable); if ($connection->tableColumnExists($tempTable, 'type') !== false) { $connection->changeColumn($tempTable, 'type', 'type', 'TINYINT(2) UNSIGNED NOT NULL DEFAULT 2'); } if ($connection->tableColumnExists($tempTable, 'message') !== false) { $connection->changeColumn($tempTable, 'message', 'message', 'TEXT NOT NULL AFTER `initiator`'); } if (!isset($tempTableIndexList[strtoupper('component_mode')])) { $connection->addKey($tempTable, 'component_mode', 'component_mode'); } $offset = 5; $connection->update($tempTable, array('type' => new Zend_Db_Expr('`type` + ' . $offset)), '`type` IN (0,2)'); $connection->update($tempTable, array('type' => 2), '`type` = ' . (0 + $offset)); $connection->update($tempTable, array('type' => 4), '`type` = ' . (2 + $offset)); }
private function processAmazonMarketplace() { $connection = $this->installer->getConnection(); $tempTable = $this->installer->getTable('m2epro_amazon_marketplace'); $tempTableIndexList = $connection->getIndexList($tempTable); if ($connection->tableColumnExists($tempTable, 'is_asin_available') === false) { $connection->addColumn($tempTable, 'is_asin_available', 'tinyint(2) UNSIGNED NOT NULL DEFAULT 1 AFTER default_currency'); } if (!isset($tempTableIndexList[strtoupper('is_asin_available')])) { $connection->addKey($tempTable, 'is_asin_available', 'is_asin_available'); } $this->installer->run(<<<SQL UPDATE `m2epro_amazon_marketplace` SET is_asin_available = 0 WHERE marketplace_id = 24; SQL ); }
private function prepareOrdersConfigTable() { $connection = $this->installer->getConnection(); $tempTable = $this->installer->getTable('m2epro_config'); $tempQuery = <<<SQL SELECT * FROM `{$tempTable}` WHERE `group` = '/ebay/order/migration_to_v611/' AND `key` = 'is_need_migrate' SQL; $tempRow = $connection->query($tempQuery)->fetch(); if ($tempRow === false) { $this->installer->run(<<<SQL INSERT INTO `m2epro_config` (`group`,`key`,`value`,`notice`,`update_date`,`create_date`) VALUES ('/ebay/order/migration_to_v611/', 'is_need_migrate', '1', null, '2013-09-18 00:00:00', '2013-09-18 00:00:00'); SQL ); } }
private function processEbayTemplates() { $this->installer->run(<<<SQL CREATE TABLE IF NOT EXISTS `m2epro_ebay_template_description` ( template_description_id INT(11) UNSIGNED NOT NULL, is_custom_template TINYINT(2) UNSIGNED NOT NULL DEFAULT 1, title_mode TINYINT(2) UNSIGNED NOT NULL DEFAULT 0, title_template VARCHAR(255) NOT NULL, subtitle_mode TINYINT(2) UNSIGNED NOT NULL DEFAULT 0, subtitle_template VARCHAR(255) NOT NULL, description_mode TINYINT(2) UNSIGNED NOT NULL DEFAULT 0, description_template LONGTEXT NOT NULL, condition_mode TINYINT(2) UNSIGNED NOT NULL DEFAULT 0, condition_value INT(11) UNSIGNED NOT NULL DEFAULT 0, condition_attribute VARCHAR(255) NOT NULL, condition_note_mode TINYINT(2) UNSIGNED NOT NULL DEFAULT 0, condition_note_template TEXT NOT NULL, product_details TEXT DEFAULT NULL, cut_long_titles TINYINT(2) UNSIGNED NOT NULL DEFAULT 0, hit_counter VARCHAR(255) NOT NULL, editor_type TINYINT(2) UNSIGNED NOT NULL DEFAULT 0, enhancement VARCHAR(255) NOT NULL, gallery_type TINYINT(2) UNSIGNED NOT NULL DEFAULT 4, image_main_mode TINYINT(2) UNSIGNED NOT NULL DEFAULT 0, image_main_attribute VARCHAR(255) NOT NULL, gallery_images_mode TINYINT(2) UNSIGNED NOT NULL DEFAULT 0, gallery_images_limit TINYINT(2) UNSIGNED NOT NULL DEFAULT 1, gallery_images_attribute VARCHAR(255) NOT NULL, default_image_url VARCHAR(255) DEFAULT NULL, variation_configurable_images VARCHAR(255) NOT NULL, use_supersize_images TINYINT(2) UNSIGNED NOT NULL DEFAULT 0, watermark_mode TINYINT(2) UNSIGNED NOT NULL DEFAULT 0, watermark_image LONGBLOB DEFAULT NULL, watermark_settings TEXT DEFAULT NULL, PRIMARY KEY (template_description_id), INDEX is_custom_template (is_custom_template) ) ENGINE = INNODB CHARACTER SET utf8 COLLATE utf8_general_ci; SQL ); $descriptionTable = $this->installer->getTable('m2epro_template_description'); $ebayDescriptionTable = $this->installer->getTable('m2epro_ebay_template_description'); $backupTable = $this->getBackupTableName('m2epro_ebay_template_description'); if (!$this->installer->tableExists($backupTable) || !$this->installer->tableExists($ebayDescriptionTable) || !$this->installer->tableExists($descriptionTable)) { return; } $tempQuery = "SELECT * FROM `{$descriptionTable}` WHERE `component_mode` = 'ebay'"; $tempRow = $this->installer->getConnection()->query($tempQuery)->fetch(); if ($tempRow !== false) { return; } $this->installer->run(<<<SQL INSERT INTO `m2epro_template_description` SELECT `id`, `title`, 'ebay', `create_date`, `update_date` FROM {$backupTable}; INSERT INTO `m2epro_ebay_template_description` SELECT `id`, `is_custom_template`, `title_mode`, `title_template`, `subtitle_mode`, `subtitle_template`, `description_mode`, `description_template`, `condition_mode`, `condition_value`, `condition_attribute`, `condition_note_mode`, `condition_note_template`, `product_details`, `cut_long_titles`, `hit_counter`, `editor_type`, `enhancement`, `gallery_type`, `image_main_mode`, `image_main_attribute`, `gallery_images_mode`, `gallery_images_limit`, `gallery_images_attribute`, `default_image_url`, `variation_configurable_images`, `use_supersize_images`, `watermark_mode`, `watermark_image`, `watermark_settings` FROM {$backupTable}; SQL ); }
private function checkToSkipStep($nextTable) { $nextTable = $this->installer->getTable($nextTable); return (bool) $this->installer->tableExists($nextTable); }
private function processSearch() { $connection = $this->installer->getConnection(); $tempTable = $this->installer->getTable('m2epro_amazon_listing_product'); if ($connection->tableColumnExists($tempTable, 'general_id_search_status') !== false) { $this->installer->run(<<<SQL UPDATE `m2epro_amazon_listing_product` SET general_id_search_status = 0, general_id_search_suggest_data = NULL; UPDATE `m2epro_buy_listing_product` SET general_id_search_status = 0, general_id_search_suggest_data = NULL; UPDATE `m2epro_play_listing_product` SET general_id_search_status = 0, general_id_search_suggest_data = NULL; SQL ); } if ($connection->tableColumnExists($tempTable, 'general_id_search_status') !== false && $connection->tableColumnExists($tempTable, 'search_settings_status') === false) { $connection->changeColumn($tempTable, 'general_id_search_status', 'search_settings_status', 'TINYINT(2) UNSIGNED DEFAULT NULL'); } if ($connection->tableColumnExists($tempTable, 'general_id_search_suggest_data') !== false && $connection->tableColumnExists($tempTable, 'search_settings_data') === false) { $connection->changeColumn($tempTable, 'general_id_search_suggest_data', 'search_settings_data', 'TEXT DEFAULT NULL'); } if ($connection->tableColumnExists($tempTable, 'general_id_search_info') === false) { $connection->addColumn($tempTable, 'general_id_search_info', 'TEXT DEFAULT NULL AFTER general_id'); } $tempTableIndexList = $connection->getIndexList($tempTable); if (isset($tempTableIndexList[strtoupper('general_id_search_status')])) { $connection->dropKey($tempTable, 'general_id_search_status'); } if (!isset($tempTableIndexList[strtoupper('search_settings_status')])) { $connection->addKey($tempTable, 'search_settings_status', 'search_settings_status'); } $tempTable = $this->installer->getTable('m2epro_buy_listing_product'); if ($connection->tableColumnExists($tempTable, 'general_id_search_status') !== false && $connection->tableColumnExists($tempTable, 'search_settings_status') === false) { $connection->changeColumn($tempTable, 'general_id_search_status', 'search_settings_status', 'TINYINT(2) UNSIGNED DEFAULT NULL'); } if ($connection->tableColumnExists($tempTable, 'general_id_search_suggest_data') !== false && $connection->tableColumnExists($tempTable, 'search_settings_data') === false) { $connection->changeColumn($tempTable, 'general_id_search_suggest_data', 'search_settings_data', 'TEXT DEFAULT NULL'); } if ($connection->tableColumnExists($tempTable, 'general_id_search_info') === false) { $connection->addColumn($tempTable, 'general_id_search_info', 'TEXT DEFAULT NULL AFTER general_id'); } $tempTableIndexList = $connection->getIndexList($tempTable); if (isset($tempTableIndexList[strtoupper('general_id_search_status')])) { $connection->dropKey($tempTable, 'general_id_search_status'); } if (!isset($tempTableIndexList[strtoupper('search_settings_status')])) { $connection->addKey($tempTable, 'search_settings_status', 'search_settings_status'); } $tempTable = $this->installer->getTable('m2epro_play_listing_product'); if ($connection->tableColumnExists($tempTable, 'general_id_search_status') !== false && $connection->tableColumnExists($tempTable, 'search_settings_status') === false) { $connection->changeColumn($tempTable, 'general_id_search_status', 'search_settings_status', 'TINYINT(2) UNSIGNED DEFAULT NULL'); } if ($connection->tableColumnExists($tempTable, 'general_id_search_suggest_data') !== false && $connection->tableColumnExists($tempTable, 'search_settings_data') === false) { $connection->changeColumn($tempTable, 'general_id_search_suggest_data', 'search_settings_data', 'TEXT DEFAULT NULL'); } if ($connection->tableColumnExists($tempTable, 'general_id_search_info') === false) { $connection->addColumn($tempTable, 'general_id_search_info', 'TEXT DEFAULT NULL AFTER link_info'); } $tempTableIndexList = $connection->getIndexList($tempTable); if (isset($tempTableIndexList[strtoupper('general_id_search_status')])) { $connection->dropKey($tempTable, 'general_id_search_status'); } if (!isset($tempTableIndexList[strtoupper('search_settings_status')])) { $connection->addKey($tempTable, 'search_settings_status', 'search_settings_status'); } }
private function alterTables() { $connection = $this->installer->getConnection(); $tempTable = $this->installer->getTable('m2epro_amazon_template_description'); $tempTableIndexList = $connection->getIndexList($tempTable); if ($connection->tableColumnExists($tempTable, 'title') !== false) { $connection->dropColumn($tempTable, 'title'); } if ($connection->tableColumnExists($tempTable, 'create_date') !== false) { $connection->dropColumn($tempTable, 'create_date'); } if ($connection->tableColumnExists($tempTable, 'update_date') !== false) { $connection->dropColumn($tempTable, 'update_date'); } if ($connection->tableColumnExists($tempTable, 'node_title') !== false) { $connection->dropColumn($tempTable, 'node_title'); } if ($connection->tableColumnExists($tempTable, 'xsd_hash') !== false) { $connection->dropColumn($tempTable, 'xsd_hash'); } if ($connection->tableColumnExists($tempTable, 'identifiers') !== false) { $connection->dropColumn($tempTable, 'identifiers'); } if ($connection->tableColumnExists($tempTable, 'id') !== false && $connection->tableColumnExists($tempTable, 'template_description_id') === false) { $this->installer->run(<<<SQL ALTER TABLE `m2epro_amazon_template_description` CHANGE COLUMN id template_description_id int(11) UNSIGNED NOT NULL, DROP PRIMARY KEY, ADD PRIMARY KEY (template_description_id); SQL ); } if ($connection->tableColumnExists($tempTable, 'category_path') !== false) { $connection->changeColumn($tempTable, 'category_path', 'category_path', 'VARCHAR(255) DEFAULT NULL'); } if ($connection->tableColumnExists($tempTable, 'is_new_asin_accepted') === false) { $connection->addColumn($tempTable, 'is_new_asin_accepted', 'TINYINT(2) UNSIGNED DEFAULT 0 AFTER marketplace_id'); } if ($connection->tableColumnExists($tempTable, 'product_data_nick') === false) { $connection->addColumn($tempTable, 'product_data_nick', 'VARCHAR(255) DEFAULT NULL AFTER is_new_asin_accepted'); } if ($connection->tableColumnExists($tempTable, 'browsenode_id') === false) { $connection->addColumn($tempTable, 'browsenode_id', 'DECIMAL(20, 0) UNSIGNED DEFAULT NULL AFTER category_path'); } if (!isset($tempTableIndexList[strtoupper('is_new_asin_accepted')])) { $connection->addKey($tempTable, 'is_new_asin_accepted', 'is_new_asin_accepted'); } if (!isset($tempTableIndexList[strtoupper('product_data_nick')])) { $connection->addKey($tempTable, 'product_data_nick', 'product_data_nick'); } if (!isset($tempTableIndexList[strtoupper('browsenode_id')])) { $connection->addKey($tempTable, 'browsenode_id', 'browsenode_id'); } // ------------------------------ $tempTable = $this->installer->getTable('m2epro_amazon_template_description_definition'); if ($connection->tableColumnExists($tempTable, 'template_new_product_id') !== false && $connection->tableColumnExists($tempTable, 'template_description_id') === false) { $this->installer->run(<<<SQL ALTER TABLE `m2epro_amazon_template_description_definition` CHANGE COLUMN template_new_product_id template_description_id int(11) UNSIGNED NOT NULL, DROP PRIMARY KEY, ADD PRIMARY KEY (template_description_id); SQL ); } if ($connection->tableColumnExists($tempTable, 'brand_custom_attribute') === false && $connection->tableColumnExists($tempTable, 'brand_template') !== false) { $connection->changeColumn($tempTable, 'brand_template', 'brand_custom_attribute', 'VARCHAR(255) DEFAULT NULL'); } if ($connection->tableColumnExists($tempTable, 'manufacturer_custom_attribute') === false && $connection->tableColumnExists($tempTable, 'manufacturer_template') !== false) { $connection->changeColumn($tempTable, 'manufacturer_template', 'manufacturer_custom_attribute', 'VARCHAR(255) DEFAULT NULL'); } if ($connection->tableColumnExists($tempTable, 'target_audience') === false && $connection->tableColumnExists($tempTable, 'target_audience_custom_value') !== false) { $connection->changeColumn($tempTable, 'target_audience_custom_value', 'target_audience', 'TEXT NOT NULL'); } if ($connection->tableColumnExists($tempTable, 'brand_custom_value') === false) { $connection->addColumn($tempTable, 'brand_custom_value', 'VARCHAR(255) DEFAULT NULL AFTER `brand_mode`'); } if ($connection->tableColumnExists($tempTable, 'manufacturer_custom_value') === false) { $connection->addColumn($tempTable, 'manufacturer_custom_value', 'VARCHAR(255) DEFAULT NULL AFTER manufacturer_mode'); } if ($connection->tableColumnExists($tempTable, 'target_audience_custom_attribute') !== false) { $connection->dropColumn($tempTable, 'target_audience_custom_attribute'); } // ----- if ($connection->tableColumnExists($tempTable, 'item_dimensions_volume_mode') === false) { $connection->addColumn($tempTable, 'item_dimensions_volume_mode', 'TINYINT(2) UNSIGNED DEFAULT 0 AFTER manufacturer_part_number_custom_attribute'); } if ($connection->tableColumnExists($tempTable, 'item_dimensions_volume_length_custom_value') === false) { $connection->addColumn($tempTable, 'item_dimensions_volume_length_custom_value', 'VARCHAR(255) DEFAULT NULL AFTER item_dimensions_volume_mode'); } if ($connection->tableColumnExists($tempTable, 'item_dimensions_volume_width_custom_value') === false) { $connection->addColumn($tempTable, 'item_dimensions_volume_width_custom_value', 'VARCHAR(255) DEFAULT NULL AFTER item_dimensions_volume_length_custom_value'); } if ($connection->tableColumnExists($tempTable, 'item_dimensions_volume_height_custom_value') === false) { $connection->addColumn($tempTable, 'item_dimensions_volume_height_custom_value', 'VARCHAR(255) DEFAULT NULL AFTER item_dimensions_volume_width_custom_value'); } if ($connection->tableColumnExists($tempTable, 'item_dimensions_volume_length_custom_attribute') === false) { $connection->addColumn($tempTable, 'item_dimensions_volume_length_custom_attribute', 'VARCHAR(255) DEFAULT NULL AFTER item_dimensions_volume_height_custom_value'); } if ($connection->tableColumnExists($tempTable, 'item_dimensions_volume_width_custom_attribute') === false) { $connection->addColumn($tempTable, 'item_dimensions_volume_width_custom_attribute', 'VARCHAR(255) DEFAULT NULL AFTER item_dimensions_volume_length_custom_attribute'); } if ($connection->tableColumnExists($tempTable, 'item_dimensions_volume_height_custom_attribute') === false) { $connection->addColumn($tempTable, 'item_dimensions_volume_height_custom_attribute', 'VARCHAR(255) DEFAULT NULL AFTER item_dimensions_volume_width_custom_attribute'); } if ($connection->tableColumnExists($tempTable, 'item_dimensions_volume_unit_of_measure_mode') === false) { $connection->addColumn($tempTable, 'item_dimensions_volume_unit_of_measure_mode', 'TINYINT(2) UNSIGNED DEFAULT 0 AFTER item_dimensions_volume_height_custom_attribute'); } if ($connection->tableColumnExists($tempTable, 'item_dimensions_volume_unit_of_measure_custom_value') === false) { $connection->addColumn($tempTable, 'item_dimensions_volume_unit_of_measure_custom_value', 'VARCHAR(255) DEFAULT NULL AFTER item_dimensions_volume_unit_of_measure_mode'); } if ($connection->tableColumnExists($tempTable, 'item_dimensions_volume_unit_of_measure_custom_attribute') === false) { $connection->addColumn($tempTable, 'item_dimensions_volume_unit_of_measure_custom_attribute', 'VARCHAR(255) DEFAULT NULL AFTER item_dimensions_volume_unit_of_measure_custom_value'); } if ($connection->tableColumnExists($tempTable, 'item_dimensions_weight_mode') === false) { $connection->addColumn($tempTable, 'item_dimensions_weight_mode', 'TINYINT(2) UNSIGNED DEFAULT 0 AFTER item_dimensions_volume_unit_of_measure_custom_attribute'); } if ($connection->tableColumnExists($tempTable, 'item_dimensions_weight_custom_value') === false) { $connection->addColumn($tempTable, 'item_dimensions_weight_custom_value', 'DECIMAL(10, 2) UNSIGNED DEFAULT NULL AFTER item_dimensions_weight_mode'); } if ($connection->tableColumnExists($tempTable, 'item_dimensions_weight_custom_attribute') === false) { $connection->addColumn($tempTable, 'item_dimensions_weight_custom_attribute', 'VARCHAR(255) DEFAULT NULL AFTER item_dimensions_weight_custom_value'); } if ($connection->tableColumnExists($tempTable, 'item_dimensions_weight_unit_of_measure_mode') === false) { $connection->addColumn($tempTable, 'item_dimensions_weight_unit_of_measure_mode', 'TINYINT(2) UNSIGNED DEFAULT 0 AFTER item_dimensions_weight_custom_attribute'); } if ($connection->tableColumnExists($tempTable, 'item_dimensions_weight_unit_of_measure_custom_value') === false) { $connection->addColumn($tempTable, 'item_dimensions_weight_unit_of_measure_custom_value', 'VARCHAR(255) DEFAULT NULL AFTER item_dimensions_weight_unit_of_measure_mode'); } if ($connection->tableColumnExists($tempTable, 'item_dimensions_weight_unit_of_measure_custom_attribute') === false) { $connection->addColumn($tempTable, 'item_dimensions_weight_unit_of_measure_custom_attribute', 'VARCHAR(255) DEFAULT NULL AFTER item_dimensions_weight_unit_of_measure_custom_value'); } // ----- if ($connection->tableColumnExists($tempTable, 'package_dimensions_volume_mode') === false) { $connection->addColumn($tempTable, 'package_dimensions_volume_mode', 'TINYINT(2) UNSIGNED DEFAULT 0 AFTER item_dimensions_weight_unit_of_measure_custom_attribute'); } if ($connection->tableColumnExists($tempTable, 'package_dimensions_volume_length_custom_value') === false) { $connection->addColumn($tempTable, 'package_dimensions_volume_length_custom_value', 'VARCHAR(255) DEFAULT NULL AFTER package_dimensions_volume_mode'); } if ($connection->tableColumnExists($tempTable, 'package_dimensions_volume_width_custom_value') === false) { $connection->addColumn($tempTable, 'package_dimensions_volume_width_custom_value', 'VARCHAR(255) DEFAULT NULL AFTER package_dimensions_volume_length_custom_value'); } if ($connection->tableColumnExists($tempTable, 'package_dimensions_volume_height_custom_value') === false) { $connection->addColumn($tempTable, 'package_dimensions_volume_height_custom_value', 'VARCHAR(255) DEFAULT NULL AFTER package_dimensions_volume_width_custom_value'); } if ($connection->tableColumnExists($tempTable, 'package_dimensions_volume_length_custom_attribute') === false) { $connection->addColumn($tempTable, 'package_dimensions_volume_length_custom_attribute', 'VARCHAR(255) DEFAULT NULL AFTER package_dimensions_volume_height_custom_value'); } if ($connection->tableColumnExists($tempTable, 'package_dimensions_volume_width_custom_attribute') === false) { $connection->addColumn($tempTable, 'package_dimensions_volume_width_custom_attribute', 'VARCHAR(255) DEFAULT NULL AFTER package_dimensions_volume_length_custom_attribute'); } if ($connection->tableColumnExists($tempTable, 'package_dimensions_volume_height_custom_attribute') === false) { $connection->addColumn($tempTable, 'package_dimensions_volume_height_custom_attribute', 'VARCHAR(255) DEFAULT NULL AFTER package_dimensions_volume_width_custom_attribute'); } if ($connection->tableColumnExists($tempTable, 'package_dimensions_volume_unit_of_measure_mode') === false) { $connection->addColumn($tempTable, 'package_dimensions_volume_unit_of_measure_mode', 'TINYINT(2) UNSIGNED DEFAULT 0 AFTER package_dimensions_volume_height_custom_attribute'); } $columnName = 'package_dimensions_volume_unit_of_measure_custom_value'; if ($connection->tableColumnExists($tempTable, $columnName) === false) { $connection->addColumn($tempTable, $columnName, 'VARCHAR(255) DEFAULT NULL AFTER package_dimensions_volume_unit_of_measure_mode'); } $columnName = 'package_dimensions_volume_unit_of_measure_custom_attribute'; if ($connection->tableColumnExists($tempTable, $columnName) === false) { $connection->addColumn($tempTable, $columnName, 'VARCHAR(255) DEFAULT NULL AFTER package_dimensions_volume_unit_of_measure_custom_value'); } // ------------------------------ $tempTable = $this->installer->getTable('m2epro_amazon_template_description_specific'); $tempTableIndexList = $connection->getIndexList($tempTable); if (isset($tempTableIndexList[strtoupper('template_new_product_id')])) { $connection->dropKey($tempTable, 'template_new_product_id'); } if ($connection->tableColumnExists($tempTable, 'template_new_product_id') !== false && $connection->tableColumnExists($tempTable, 'template_description_id') === false) { $connection->changeColumn($tempTable, 'template_new_product_id', 'template_description_id', 'int(11) UNSIGNED NOT NULL'); } if (!isset($tempTableIndexList[strtoupper('template_description_id')])) { $connection->addKey($tempTable, 'template_description_id', 'template_description_id'); } // ------------------------------ }