Перейти к содержанию
Форум поддержки пользователей VamShop

Пример переноса данных и структуры таблицы из osCommerce VaM Edition (VamShop) в OpenCart


support

Рекомендуемые сообщения

SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';

DROP TABLE IF EXISTS `copy_orders_products_attributes`;
CREATE TABLE `copy_orders_products_attributes` LIKE `orders_products_attributes`;
INSERT INTO `copy_orders_products_attributes` SELECT * FROM `orders_products_attributes`;


ALTER TABLE `copy_orders_products_attributes`
CHANGE `orders_products_attributes_id` `order_option_id` int(11) NOT NULL AUTO_INCREMENT FIRST,
CHANGE `orders_id` `order_id` int(11) NOT NULL DEFAULT '0' AFTER `order_option_id`,
CHANGE `orders_products_id` `order_product_id` int(11) NOT NULL DEFAULT '0' AFTER `order_id`,
CHANGE `products_options_id` `product_option_id` int(11) NOT NULL DEFAULT '0' AFTER `order_product_id`,
CHANGE `products_options_values_id` `product_option_value_id` int(11) NOT NULL DEFAULT '0' AFTER `product_option_id`,
CHANGE `products_options` `value` varchar(32) COLLATE 'utf8_general_ci' NOT NULL DEFAULT '' AFTER `product_option_value_id`,
CHANGE `products_options_values` `name` text COLLATE 'utf8_general_ci' NOT NULL AFTER `value`,
CHANGE `price_prefix` `type` varchar(32) COLLATE 'utf8_general_ci' NOT NULL DEFAULT '' AFTER `name`;

DROP TABLE IF EXISTS `oc_order_option`;
ALTER TABLE `copy_orders_products_attributes`
RENAME TO `oc_order_option`;

ALTER TABLE `oc_order_option`
DROP `options_values_price`;

Update `oc_order_option` set type = 'select';

#Теперь продукты:

SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';

DROP TABLE IF EXISTS `copy_orders_products`;
CREATE TABLE `copy_orders_products` LIKE `orders_products`;
INSERT INTO `copy_orders_products` SELECT * FROM `orders_products`;


ALTER TABLE `copy_orders_products`
CHANGE `orders_products_id` `order_product_id` int(11) NOT NULL AUTO_INCREMENT FIRST,
CHANGE `orders_id` `order_id` int(11) NOT NULL DEFAULT '0' AFTER `order_product_id`,
CHANGE `products_id` `product_id` int(11) NOT NULL DEFAULT '0' AFTER `order_id`,
CHANGE `products_model` `model` varchar(255) COLLATE 'utf8_general_ci' NULL AFTER `product_id`,
CHANGE `products_name` `name` varchar(255) COLLATE 'utf8_general_ci' NOT NULL DEFAULT '' AFTER `model`,
CHANGE `products_price` `price` decimal(15,4) NOT NULL DEFAULT '0.0000' AFTER `name`,
CHANGE `final_price` `total` decimal(15,4) NOT NULL DEFAULT '0.0000' AFTER `price`,
CHANGE `products_tax` `tax` decimal(7,4) NOT NULL DEFAULT '0.0000' AFTER `total`,
CHANGE `products_quantity` `quantity` int(2) NOT NULL DEFAULT '0' AFTER `tax`;


ALTER TABLE `copy_orders_products`
CHANGE `name` `name` varchar(255) COLLATE 'utf8_general_ci' NOT NULL DEFAULT '' AFTER `product_id`,
CHANGE `model` `model` varchar(255) COLLATE 'utf8_general_ci' NULL AFTER `name`,
CHANGE `quantity` `quantity` int(4) NOT NULL DEFAULT '0' AFTER `model`,
CHANGE `price` `price` decimal(15,4) NOT NULL DEFAULT '0.0000' AFTER `quantity`,
CHANGE `total` `total` decimal(15,4) NOT NULL DEFAULT '0.0000' AFTER `price`,
CHANGE `tax` `tax` decimal(15,4) NOT NULL DEFAULT '0.0000' AFTER `total`,
ADD `reward` int(8) NOT NULL;


DROP TABLE `oc_order_product`;


ALTER TABLE `copy_orders_products`
RENAME TO `oc_order_product`;

#История заказов

DROP TABLE IF EXISTS `copy_orders_status_history`;
CREATE TABLE `copy_orders_status_history` LIKE `orders_status_history`;
INSERT INTO `copy_orders_status_history` SELECT * FROM `orders_status_history`;

ALTER TABLE `copy_orders_status_history`
CHANGE `orders_status_history_id` `order_history_id` int(11) NOT NULL AUTO_INCREMENT FIRST,
CHANGE `orders_id` `order_id` int(11) NOT NULL DEFAULT '0' AFTER `order_history_id`,
CHANGE `orders_status_id` `order_status_id` int(5) NOT NULL DEFAULT '0' AFTER `order_id`,
CHANGE `customer_notified` `notify` int(1) NULL DEFAULT '0' AFTER `order_status_id`,
CHANGE `comments` `comment` text COLLATE 'utf8_general_ci' NULL AFTER `notify`,
CHANGE `date_added` `date_added` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `comment`;


ALTER TABLE `copy_orders_status_history`
CHANGE `notify` `notify` tinyint(1) NULL DEFAULT '0' AFTER `order_status_id`;
 
 DROP TABLE `oc_order_history`;


ALTER TABLE `copy_orders_status_history`
RENAME TO `oc_order_history`;

 

Ссылка на сообщение
Поделиться на другие сайты
×
×
  • Создать...