zencart 数据迁移到magento 数据库操作

来源:互联网 发布:网络460是什么意思 编辑:程序博客网 时间:2024/05/17 04:30

原文请查看:http://www.php-source.com/thread-22618-1-1.html



drop table if exists export_magento;


create table export_magento (
   store               varchar(30)     not null
  ,websites            varchar(30)     not null
  ,attribute_set       varchar(30)     not null
  ,type                varchar(30)     not null
  ,sku                 varchar(50)     not null
  ,name                varchar(512)    not null
  ,product_name        varchar(512)    not null
  ,market_price        decimal(8,2)    null
  ,price               decimal(8,2)    not null
  ,special_price       decimal(8,2)    null
  ,weight              varchar(30)     not null default ''
  ,short_description   varchar(1000)   not null default ''
  ,description         text            not null
  ,meta_title          varchar(512)    not null default ''
  ,meta_keyword        varchar(512)    not null default ''
  ,meta_description    varchar(2000)   not null default ''
  ,image               varchar(255)    not null default ''
  ,small_image         varchar(255)    not null default ''
  ,thumbnail           varchar(255)    not null default ''
  ,gallery             varchar(512)    not null default ''
  ,status              varchar(10)     not null default 'Enabled'
  ,tax_class_id        varchar(10)     not null default 'None'
  ,qty                 int             not null default 0
  ,category_ids        varchar(50)     not null default ''
  ,is_in_stock         tinyint         not null default 1
  ,visibility          varchar(30)     not null default ''
  ,adddate             varchar(30)     not null default ''
);


truncate table export_magento;
insert into export_magento
select 'admin' as store
      ,'base' as websites
      ,'Common' as attribute_set
      ,'simple' as type
      ,p.products_model as sku
      ,pd.products_name as name
      ,pd.products_name as product_name
      ,'' as market_price
      ,p.products_price_retail as price
      ,p.products_price          -- ifnull(s.specials_new_products_price, p.products_price_sorter) as special_price
      ,p.products_weight  as weight
      ,'Brand new, never refurbished, 100% compatible' as short_description
      ,pd.products_description as description
      ,pd.products_name as meta_title
      ,'' as meta_keyword
      ,pd.products_name as meta_description
      ,substring_index(p.products_image, ',', 1) as image
      ,substring_index(p.products_image, ',', 1) as small_image
      ,substring_index(p.products_image, ',', 1) as thumbnail
      ,replace(p.products_image, ',', ';') as gallery
      ,'Enabled' as status
      ,'None' as tax_class_id
      ,p.products_quantity as qty
      ,p.master_categories_id as category_ids
      ,1 as is_in_stock
      ,'Catalog, Search' as visibility
      ,date_format(now(),'%Y/%d/%c') as adddate
  from products p
          inner join products_description pd
    on p.products_id = pd.products_id
 where pd.language_id = 1
   and p.master_categories_id in ();