ZenCart SQL批量常用数据库命令

ZenCart SQL批量常用数据库命令

一 批量删除全部商品等数据

# 清空商品分类、商品、属性
TRUNCATE TABLE categories;
TRUNCATE TABLE categories_description;
 
# 清空商品以及属性
TRUNCATE TABLE media_clips;
TRUNCATE TABLE media_manager;
TRUNCATE TABLE media_to_products;
TRUNCATE TABLE media_types;
TRUNCATE TABLE music_genre;
TRUNCATE TABLE product_music_extra;
TRUNCATE TABLE product_types_to_category;
TRUNCATE TABLE products;
TRUNCATE TABLE products_attributes;
TRUNCATE TABLE products_attributes_download;
TRUNCATE TABLE products_description;
TRUNCATE TABLE products_discount_quantity;
TRUNCATE TABLE products_notifications;
TRUNCATE TABLE products_options;
TRUNCATE TABLE products_options_values;
TRUNCATE TABLE products_options_values_to_products_options;
TRUNCATE TABLE products_to_categories;
TRUNCATE TABLE record_artists;
TRUNCATE TABLE record_artists_info;
TRUNCATE TABLE record_company;
TRUNCATE TABLE record_company_info;
 
# 清空推荐商品
TRUNCATE TABLE featured;
 
# 清空促销商品
TRUNCATE TABLE salemaker_sales;
 
# 清空特价商品
TRUNCATE TABLE specials;
 
# 清空团体价格
TRUNCATE TABLE group_pricing;
 
# 清空厂家及资料
TRUNCATE TABLE manufacturers;
TRUNCATE TABLE manufacturers_info;
 
# 清空客户评论
TRUNCATE TABLE reviews;
TRUNCATE TABLE reviews_description;
 
#清空前台注册用户 订单 历史订单等信息 慎用
TRUNCATE TABLE `address_book`;
TRUNCATE TABLE `admin_activity_log`;
TRUNCATE TABLE `counter`;
TRUNCATE TABLE `counter_history`;
TRUNCATE TABLE `customers`;
TRUNCATE TABLE `customers_basket`;
TRUNCATE TABLE `customers_info`;
TRUNCATE TABLE `orders`;
TRUNCATE TABLE `orders_products`;
TRUNCATE TABLE `orders_status_history`;
TRUNCATE TABLE `orders_total`;
TRUNCATE TABLE `paypal`;
TRUNCATE TABLE `paypal_payment_status_history`;
TRUNCATE TABLE `paypal_session`;
update `products_description` set `products_viewed` = '0' WHERE `products_viewed` > '0';
update `products` set `products_ordered` = '0' WHERE `products_ordered` > '0';

二 批量变更商品部分属性

#批量设置特价商品起始时间, 其中 0001-01-01 为 无起始时间
UPDATE specials SET specials_date_available ='0001-01-01';
 
#批量设置特价商品到期时间 其中 2020-12-31 为到期时间
UPDATE specials SET expires_date ='2020-12-31';
 
#批量开启特价商品
UPDATE specials SET status ='1';
 
#批量关闭特价商品
UPDATE specials SET status ='0';
 
#批量设置全站商品免运费
UPDATE products SET product_is_always_free_shipping = '1'; 
 
#批量更改商品添加时间 其中 2011-10-01 为添加时期
UPDATE products SET products_date_added = '2011-10-01'; 
 
#批量更改商品重量 其中 500 为重量值
UPDATE products SET products_weight = '500'; 
 
#批量设置库存数量 其中 99 为库存数量
UPDATE `products` SET `products_quantity` = '99';
 
#批量设置特价,其中 +11.55 指的是增加 11.55,如果是减少就是 -11.55
UPDATE specials SET specials_new_products_price=specials_new_products_price+11.55;
UPDATE products p,specials s SET p.products_price_sorter = s.specials_new_products_price WHERE p.products_id = s.products_id;
 
#批量设置原价,其中 +22.66 指的是增加 22.66,如果是减少就是 -22.66
UPDATE `products` SET `products_price`=`products_price`+22.66;
 
#批量替换商品描述指定字符
update products_description set products_description=replace(products_description,'这里输入要替换的字符','')
posted @ 2012-09-24 21:39  外贸乐  阅读(1740)  评论(0编辑  收藏  举报