PrestaShop: Delete all testing data before production

微笑、不失礼 提交于 2020-01-02 05:39:06

问题


I'm searching a script to run on MySql to delete (truncate table) all the testing data (customer, order,cart, etc) on a PrestaShop database version 1.4.9. Thank Pascal


回答1:


Install the Prestashop Cleaner and in configure you have options to delete catalog, orders and customers




回答2:


For 1.5.6.2 (probably works for 1.5.6*, even maybe for 1.5.*) :

TRUNCATE `ps_access`;
TRUNCATE `ps_address`;
TRUNCATE `ps_alias`;
TRUNCATE `ps_attribute`;
TRUNCATE `ps_attribute_group`;
TRUNCATE `ps_attribute_group_lang`;
TRUNCATE `ps_attribute_group_shop`;
TRUNCATE `ps_attribute_lang`;
TRUNCATE `ps_attribute_shop`;
TRUNCATE `ps_carrier`;
TRUNCATE `ps_carrier_group`;
TRUNCATE `ps_carrier_lang`;
TRUNCATE `ps_carrier_shop`;
TRUNCATE `ps_carrier_tax_rules_group_shop`;
TRUNCATE `ps_carrier_zone`;
TRUNCATE `ps_cart`;
TRUNCATE `ps_cart_product`;
TRUNCATE `ps_category`;
TRUNCATE `ps_category_group`;
TRUNCATE `ps_category_lang`;
TRUNCATE `ps_category_product`;
TRUNCATE `ps_category_shop`;
TRUNCATE `ps_cms`;
TRUNCATE `ps_cms_block`;
TRUNCATE `ps_cms_block_lang`;
TRUNCATE `ps_cms_block_page`;
TRUNCATE `ps_cms_block_shop`;
TRUNCATE `ps_cms_category`;
TRUNCATE `ps_cms_category_lang`;
TRUNCATE `ps_cms_lang`;
TRUNCATE `ps_cms_shop`;
TRUNCATE `ps_connections`;
TRUNCATE `ps_contact_lang`;
TRUNCATE `ps_contact_shop`;
TRUNCATE `ps_customer`;
TRUNCATE `ps_customer_group`;
TRUNCATE `ps_delivery`;
TRUNCATE `ps_feature`;
TRUNCATE `ps_feature_lang`;
TRUNCATE `ps_feature_shop`;
TRUNCATE `ps_feature_value`;
TRUNCATE `ps_feature_value_lang`;
TRUNCATE `ps_guest`;
TRUNCATE `ps_homeslider`;
TRUNCATE `ps_homeslider_slides`;
TRUNCATE `ps_homeslider_slides_lang`;
TRUNCATE `ps_image`;
TRUNCATE `ps_image_lang`;
TRUNCATE `ps_image_shop`;
TRUNCATE `ps_image_type`;
TRUNCATE `ps_manufacturer`;
TRUNCATE `ps_manufacturer_lang`;
TRUNCATE `ps_manufacturer_shop`;
TRUNCATE `ps_orders`;
TRUNCATE `ps_order_carrier`;
TRUNCATE `ps_order_cart_rule`;
TRUNCATE `ps_order_detail`;
TRUNCATE `ps_order_detail_tax`;
TRUNCATE `ps_order_history`;
TRUNCATE `ps_order_invoice`;
TRUNCATE `ps_order_invoice_payment`;
TRUNCATE `ps_order_invoice_tax`;
TRUNCATE `ps_order_message`;
TRUNCATE `ps_order_message_lang`;
TRUNCATE `ps_order_return_state`;
TRUNCATE `ps_order_return_state_lang`;
TRUNCATE `ps_order_state`;
TRUNCATE `ps_order_state_lang`;
TRUNCATE `ps_page`;
TRUNCATE `ps_page_type`;
TRUNCATE `ps_product`;
TRUNCATE `ps_product_attribute`;
TRUNCATE `ps_product_attribute_combination`;
TRUNCATE `ps_product_attribute_image`;
TRUNCATE `ps_product_attribute_shop`;
TRUNCATE `ps_product_lang`;
TRUNCATE `ps_product_shop`;
TRUNCATE `ps_product_supplier`;
TRUNCATE `ps_product_tag`;
TRUNCATE `ps_range_price`;
TRUNCATE `ps_range_weight`;
TRUNCATE `ps_reinsurance`;
TRUNCATE `ps_reinsurance_lang`;
TRUNCATE `ps_scene`;
TRUNCATE `ps_scene_category`;
TRUNCATE `ps_scene_lang`;
TRUNCATE `ps_scene_products`;
TRUNCATE `ps_scene_shop`;
TRUNCATE `ps_search_index`;
TRUNCATE `ps_search_word`;
TRUNCATE `ps_specific_price`;
TRUNCATE `ps_stock_available`;
TRUNCATE `ps_stock_mvt_reason`;
TRUNCATE `ps_stock_mvt_reason_lang`;
TRUNCATE `ps_store`;
TRUNCATE `ps_store_shop`;
TRUNCATE `ps_supplier`;
TRUNCATE `ps_supplier_lang`;
TRUNCATE `ps_supplier_shop`;
TRUNCATE `ps_supply_order_state`;
TRUNCATE `ps_supply_order_state_lang`;
TRUNCATE `ps_tag`;

Will give you a clean, ready database before you start.




回答3:


Kindly note, that this site not for finding scripts for any kind of your work. It is just to give advices and based on that advices give step by step guidance and sample scripts / codes . How you can remove the test data from your PS installation is easy.

1) Go to Admin panel. 2) Delete categories and products 3) Delete customers 4) Delete carts and orders.

This is the easiest way. But if you want to truncate the tables for them, then follow the following steps

1) Go to PhpMyAdmin at your server. 2) Find the database your PS installation is using 3) For customers, truncate ps_customers, ps_address 4) For cart, truncate ps_cart, ps_cart_products 5) For orders, truncate ps_order, ps_order_details,

Please note that the above truncation will only remove those data from the admin and also from the database, but there are some other tables also which can be truncated. But necessarily required, because if you dont do that, then the data will be not shown at admin, so no need at all. I cant list them, because with new PS versions, tables are changed.



来源:https://stackoverflow.com/questions/15277017/prestashop-delete-all-testing-data-before-production

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!