- 浏览: 13763708 次
- 性别:
- 来自: 洛杉矶
-
文章分类
- 全部博客 (1994)
- Php / Pear / Mysql / Node.js (378)
- Javascript /Jquery / Bootstrap / Web (435)
- Phone / IOS / Objective-C / Swift (137)
- Ubuntu / Mac / Github / Aptana / Nginx / Shell / Linux (335)
- Perl / Koha / Ruby / Markdown (8)
- Java / Jsp (12)
- Python 2 / Wxpython (25)
- Codeigniter / CakePHP (32)
- Div / Css / XML / HTML5 (179)
- WP / Joomla! / Magento / Shopify / Drupal / Moodle / Zimbra (275)
- Apache / VPN / Software (31)
- AS3.0/2.0 / Flex / Flash (45)
- Smarty (6)
- SEO (24)
- Google / Facebook / Pinterest / SNS (80)
- Tools (22)
最新评论
-
1455975567:
xuezhongyu01 写道wocan23 写道我想问下那个 ...
Mysql: LBS实现查找附近的人 (两经纬度之间的距离) -
xuezhongyu01:
wocan23 写道我想问下那个111.1是怎么得来的我也看不 ...
Mysql: LBS实现查找附近的人 (两经纬度之间的距离) -
18335864773:
试试 pageoffice 在线打开 PDF 文件吧. pag ...
jquery在线预览PDF文件,打开PDF文件 -
青春依旧:
opacity: 0.5; 个人喜欢这种方式!关于其他css特 ...
css透明度的设置 (兼容所有浏览器) -
July01:
推荐用StratoIO打印控件,浏览器和系统的兼容性都很好,而 ...
搞定网页打印自动分页问题
清空magento所有的产品数据 Delete magento category / products by SQL
Magento 1.5 and 1.6
Truncate products
This should remove all the products and their related records.
TRUNCATE TABLE `catalog_product_bundle_option`; TRUNCATE TABLE `catalog_product_bundle_option_value`; TRUNCATE TABLE `catalog_product_bundle_selection`; TRUNCATE TABLE `catalog_product_entity_datetime`; TRUNCATE TABLE `catalog_product_entity_decimal`; TRUNCATE TABLE `catalog_product_entity_gallery`; TRUNCATE TABLE `catalog_product_entity_int`; TRUNCATE TABLE `catalog_product_entity_media_gallery`; TRUNCATE TABLE `catalog_product_entity_media_gallery_value`; TRUNCATE TABLE `catalog_product_entity_text`; TRUNCATE TABLE `catalog_product_entity_tier_price`; TRUNCATE TABLE `catalog_product_entity_varchar`; TRUNCATE TABLE `catalog_product_link`; TRUNCATE TABLE `catalog_product_link_attribute`; TRUNCATE TABLE `catalog_product_link_attribute_decimal`; TRUNCATE TABLE `catalog_product_link_attribute_int`; TRUNCATE TABLE `catalog_product_link_attribute_varchar`; TRUNCATE TABLE `catalog_product_link_type`; TRUNCATE TABLE `catalog_product_option`; TRUNCATE TABLE `catalog_product_option_price`; TRUNCATE TABLE `catalog_product_option_title`; TRUNCATE TABLE `catalog_product_option_type_price`; TRUNCATE TABLE `catalog_product_option_type_title`; TRUNCATE TABLE `catalog_product_option_type_value`; TRUNCATE TABLE `catalog_product_super_attribute`; TRUNCATE TABLE `catalog_product_super_attribute_label`; TRUNCATE TABLE `catalog_product_super_attribute_pricing`; TRUNCATE TABLE `catalog_product_super_link`; TRUNCATE TABLE `catalog_product_enabled_index`; TRUNCATE TABLE `catalog_product_website`; TRUNCATE TABLE `catalog_product_entity`; TRUNCATE TABLE `cataloginventory_stock`; TRUNCATE TABLE `cataloginventory_stock_item`; TRUNCATE TABLE `cataloginventory_stock_status`; INSERT INTO `catalog_product_link_type`(`link_type_id`,`code`) VALUES (1,'relation'),(2,'bundle'),(3,'super'),(4,'up_sell'),(5,'cross_sell'); INSERT INTO `catalog_product_link_attribute`(`product_link_attribute_id`,`link_type_id`,`product_link_attribute_code`,`data_type`) VALUES (1,2,'qty','decimal'),(2,1,'position','int'),(3,4,'position','int'),(4,5,'position','int'),(6,1,'qty','decimal'),(7,3,'position','int'),(8,3,'qty','decimal'); INSERT INTO `cataloginventory_stock`(`stock_id`,`stock_name`) VALUES (1,'Default');
n magento 1.5 you need to add in cataloginventory_stock., I added a record with stock_id 1 and stock_name to Default. Without this there will be a foreign key constraint fail, see http://www.magentocommerce.com/boards/v/viewthread/41764/#t169087 for further explanation
Truncate categories |
This should remove all the categories and their related records. It will also create new Root category.
TRUNCATE TABLE `catalog_category_entity`; TRUNCATE TABLE `catalog_category_entity_datetime`; TRUNCATE TABLE `catalog_category_entity_decimal`; TRUNCATE TABLE `catalog_category_entity_int`; TRUNCATE TABLE `catalog_category_entity_text`; TRUNCATE TABLE `catalog_category_entity_varchar`; TRUNCATE TABLE `catalog_category_product`; TRUNCATE TABLE `catalog_category_product_index`; INSERT INTO `catalog_category_entity`(`entity_id`,`entity_type_id`,`attribute_set_id`,`parent_id`,`created_at`,`updated_at`,`path`,`POSITION`,`level`,`children_count`) VALUES (1,3,0,0,'0000-00-00 00:00:00','2009-02-20 00:25:34','1',1,0,1),(2,3,3,0,'2009-02-20 00:25:34','2009-02-20 00:25:34','1/2',1,1,0); INSERT INTO `catalog_category_entity_int`(`value_id`,`entity_type_id`,`attribute_id`,`store_id`,`entity_id`,`value`) VALUES (1,3,32,0,2,1),(2,3,32,1,2,1); INSERT INTO `catalog_category_entity_varchar`(`value_id`,`entity_type_id`,`attribute_id`,`store_id`,`entity_id`,`value`) VALUES (1,3,31,0,1,'Root Catalog'),(2,3,33,0,1,'root-catalog'),(3,3,31,0,2,'Default Category'),(4,3,39,0,2,'PRODUCTS'),(5,3,33,0,2,'default-category'); /**** Magento ver. 1.6.x.x ****/ TRUNCATE TABLE `catalog_category_entity`; TRUNCATE TABLE `catalog_category_entity_datetime`; TRUNCATE TABLE `catalog_category_entity_decimal`; TRUNCATE TABLE `catalog_category_entity_int`; TRUNCATE TABLE `catalog_category_entity_text`; TRUNCATE TABLE `catalog_category_entity_varchar`; TRUNCATE TABLE `catalog_category_product`; TRUNCATE TABLE `catalog_category_product_index`; INSERT INTO `catalog_category_entity`(`entity_id`,`entity_type_id`,`attribute_set_id`,`parent_id`,`created_at`,`updated_at`,`path`,`POSITION`,`level`,`children_count`) VALUES (1,3,0,0,'0000-00-00 00:00:00','0000-00-00 00:00:00','1',1,0,1), (2,3,3,1,'0000-00-00 00:00:00','0000-00-00 00:00:00','1/2','1','1','0'); INSERT INTO `catalog_category_entity_int`(`value_id`,`entity_type_id`,`attribute_id`,`store_id`,`entity_id`,`value`) VALUES (1,3,32,0,2,1),(2,3,36,0,2,1),(3,3,61,0,2,1),(4,3,44,0,2,NULL),(5,3,45,0,2,1),(6,3,62,0,2,1),(7,3,63,0,2,1),(8,3,64,0,2,NULL); INSERT INTO `catalog_category_entity_varchar`(`value_id`,`entity_type_id`,`attribute_id`,`store_id`,`entity_id`,`value`) VALUES (1,3,31,0,1,'Root Catalog'),(2,3,35,0,2,'Default Category'),(3,3,37,0,2,'default-category'),(4,3,40,0,2,NULL),(5,3,43,0,2,'PRODUCTS'),(6,3,52,0,2,NULL),(7,3,55,0,2,NULL); /**** Magento ver. 1.6.x.x ****/
Truncate customers
This should remove all the customers and their related records.
TRUNCATE TABLE `customer_address_entity`; TRUNCATE TABLE `customer_address_entity_datetime`; TRUNCATE TABLE `customer_address_entity_decimal`; TRUNCATE TABLE `customer_address_entity_int`; TRUNCATE TABLE `customer_address_entity_text`; TRUNCATE TABLE `customer_address_entity_varchar`; TRUNCATE TABLE `customer_entity`; TRUNCATE TABLE `customer_entity_datetime`; TRUNCATE TABLE `customer_entity_decimal`; TRUNCATE TABLE `customer_entity_int`; TRUNCATE TABLE `customer_entity_text`; TRUNCATE TABLE `customer_entity_varchar`;
Magento 1.7
I was writing a bulk category/product import script for magento 1.7. For debugging I had to frequently clear all the erroneous data inserted while coding and run my script again and again. Searching for an easy solution I came into this magento wiki that has the queries to delete all the products and categories for Magento 1.5 and 1.6. In 1.7 the attribute ids are not same so I needed an updated one. So here is the queries for 1.7 to reset your product / category tables to the initial position just after fresh magento installation.
Please note the first and last sql commands that are used to ignore the foreign key constraints. Without these 2 lines, you will get error.
SET FOREIGN_KEY_CHECKS = 0; TRUNCATE TABLE `catalog_product_bundle_option`; TRUNCATE TABLE `catalog_product_bundle_option_value`; TRUNCATE TABLE `catalog_product_bundle_selection`; TRUNCATE TABLE `catalog_product_entity_datetime`; TRUNCATE TABLE `catalog_product_entity_decimal`; TRUNCATE TABLE `catalog_product_entity_gallery`; TRUNCATE TABLE `catalog_product_entity_int`; TRUNCATE TABLE `catalog_product_entity_media_gallery`; TRUNCATE TABLE `catalog_product_entity_media_gallery_value`; TRUNCATE TABLE `catalog_product_entity_text`; TRUNCATE TABLE `catalog_product_entity_tier_price`; TRUNCATE TABLE `catalog_product_entity_varchar`; TRUNCATE TABLE `catalog_product_link`; TRUNCATE TABLE `catalog_product_link_attribute`; TRUNCATE TABLE `catalog_product_link_attribute_decimal`; TRUNCATE TABLE `catalog_product_link_attribute_int`; TRUNCATE TABLE `catalog_product_link_attribute_varchar`; TRUNCATE TABLE `catalog_product_link_type`; TRUNCATE TABLE `catalog_product_option`; TRUNCATE TABLE `catalog_product_option_price`; TRUNCATE TABLE `catalog_product_option_title`; TRUNCATE TABLE `catalog_product_option_type_price`; TRUNCATE TABLE `catalog_product_option_type_title`; TRUNCATE TABLE `catalog_product_option_type_value`; TRUNCATE TABLE `catalog_product_super_attribute`; TRUNCATE TABLE `catalog_product_super_attribute_label`; TRUNCATE TABLE `catalog_product_super_attribute_pricing`; TRUNCATE TABLE `catalog_product_super_link`; TRUNCATE TABLE `catalog_product_enabled_index`; TRUNCATE TABLE `catalog_product_website`; TRUNCATE TABLE `catalog_product_entity`; TRUNCATE TABLE `cataloginventory_stock`; TRUNCATE TABLE `cataloginventory_stock_item`; TRUNCATE TABLE `cataloginventory_stock_status`; TRUNCATE TABLE `catalog_category_entity`; TRUNCATE TABLE `catalog_category_entity_datetime`; TRUNCATE TABLE `catalog_category_entity_decimal`; TRUNCATE TABLE `catalog_category_entity_int`; TRUNCATE TABLE `catalog_category_entity_text`; TRUNCATE TABLE `catalog_category_entity_varchar`; TRUNCATE TABLE `catalog_category_product`; TRUNCATE TABLE `catalog_category_product_index`; INSERT INTO `catalog_category_entity` (`entity_id`, `entity_type_id`, `attribute_set_id`, `parent_id`, `created_at`, `updated_at`, `path`, `position`, `level`, `children_count`) VALUES (1, 3, 0, 0, ’2012-06-17 22:20:47′, ’2012-06-17 22:20:47′, ’1′, 0, 0, 1), (2, 3, 3, 1, ’2012-06-17 22:20:47′, ’2012-06-17 22:20:47′, ’1/2′, 1, 1, 0); INSERT INTO `catalog_category_entity_int` (`value_id`, `entity_type_id`, `attribute_id`, `store_id`, `entity_id`, `value`) VALUES (1, 3, 67, 0, 1, 1), (2, 3, 67, 1, 1, 1), (3, 3, 42, 0, 2, 1), (4, 3, 67, 0, 2, 1), (5, 3, 42, 1, 2, 1), (6, 3, 67, 1, 2, 1); INSERT INTO `catalog_category_entity_varchar` (`value_id`, `entity_type_id`, `attribute_id`, `store_id`, `entity_id`, `value`) VALUES (1, 3, 41, 0, 1, ‘Root Catalog’), (2, 3, 41, 1, 1, ‘Root Catalog’), (3, 3, 43, 1, 1, ‘root-catalog’), (4, 3, 41, 0, 2, ‘Default Category’), (5, 3, 41, 1, 2, ‘Default Category’), (6, 3, 49, 1, 2, ‘PRODUCTS’), (7, 3, 43, 1, 2, ‘default-category’); INSERT INTO `catalog_product_link_type` (`link_type_id`, `code`) VALUES (1, ‘relation’), (3, ‘super’), (4, ‘up_sell’), (5, ‘cross_sell’); INSERT INTO `catalog_product_link_attribute` (`product_link_attribute_id`, `link_type_id`, `product_link_attribute_code`, `data_type`) VALUES (1, 1, ‘position’, ‘int’), (2, 3, ‘position’, ‘int’), (3, 3, ‘qty’, ‘decimal’), (4, 4, ‘position’, ‘int’), (5, 5, ‘position’, ‘int’); INSERT INTO `cataloginventory_stock` (`stock_id`, `stock_name`) VALUES (1, ‘Default’); SET FOREIGN_KEY_CHECKS = 1;
from: http://www.imranulhoque.com/magento/reset-delete-magento-category-products-by-sql-for-magento-version-1-7/
发表评论
-
Magento: 后台显示图片不能找到 Image file was not found on product tab
2016-08-30 02:22 3005I was uploading some images f ... -
理解WordPress的PingBack和TrackBack
2016-08-26 02:21 5811pingback和trackback的功 ... -
零基础 Amazon Web Services (AWS) 入门教程图文版(四)
2016-06-07 11:40 1036自上一篇之后,5天过去了,这篇文章总算是挤出来了... 其实 ... -
零基础 Amazon Web Services (AWS) 入门教程图文版(三)
2016-06-07 11:41 2063原则上WDCP安装好了,就可以直接使用了,FTP、MySQL ... -
零基础 Amazon Web Services (AWS) 入门教程图文版(二)
2016-06-07 01:33 1021上一篇讲到,主机正常运转了。但是此时如果直接访问公网IP是 ... -
零基础 Amazon Web Services (AWS) 入门教程图文版(一)
2016-06-07 01:31 21807现在小站唯一的流量都靠AWS这个关键词了,刚好要用AWS重新 ... -
零基础 Amazon Web Services (AWS) 入门教程 (列表)
2016-06-07 01:32 2099在 Amazon Web Services 上托 ... -
Magento 1.9:新订单通知 Admin Order Notifier
2016-06-02 02:48 870Here is a little Mag ... -
Magento 1.9.X 系列教程
2016-05-14 02:44 2305Magento安装下载教学: Magento教程 1 ... -
Magento: 产品页面下jquery change函数失效 Call javascript function onchange product option
2016-05-05 06:39 1775明显的原因是change函数跟magento默认的oncha ... -
Magento: 判断是否为手机浏览 Optimise Web's Mobile Detect Class for Magento
2016-04-29 07:01 1178项目地址:Optimise Web's Mobile Det ... -
Magento: Gird 和 form 区域 Module Development Series – Magento Admin Module
2016-04-28 02:39 690In this tutorial, we are goi ... -
Magento: addAttributeToFilter 和 addFieldToFilter 的区别 Difference between addAttri
2016-04-28 02:34 1027addAttributeToFilter is use ... -
Magento: 后台获取menu链接 Getting the admin panel urls
2016-04-28 02:34 791The url for customer page in t ... -
Magento : 调用文件上传 upload file frontend
2016-04-27 01:25 1377bool mkdir ( string $pathname ... -
Magento: 自定义用户登录导向页面 Redirect Customer to Previous Page After Login
2016-04-26 02:45 1869Configuration Settings – L ... -
Magento: 代替flash上传 How to disable Flash uploader in Magento (product images and
2016-04-06 05:04 11401. 替换产品页flash上传按钮 - 使用 Du ... -
Magento: 在客户账户中添加自定义链接 My Account Add Link
2016-04-05 14:05 1420This extension add new link an ... -
Magento: 根据产品属性加载产品信息 Load A Category or Product by an Attribute
2016-03-26 01:35 961Load a Product by ID <?ph ... -
Magento模块开发之数据库SQL操作方法说明
2016-03-26 01:31 1394今天主要来看Magento中的Mysql4/Resource ...
相关推荐
在执行大规模导出时,应考虑到数据库性能,避免一次性导出所有数据,而是分批进行。 2. **数据权限**:确保你有适当的数据库访问权限,执行导出操作可能需要读取、写入甚至修改数据的权限。 3. **数据安全**:导出...
在Magento系统中,有时可能需要清理或删除特定的订单数据,比如当测试环境中积累了大量无用的订单记录,或者在某些特殊情况下需要手动清除错误的订单等。本文将详细介绍如何通过编写SQL语句来实现这一操作,并确保...
标题:“Magento数据结构分析” 描述:“Magento数据字典”提供了对Magento系统中各种数据库表的深入理解,这对于理解和优化Magento的性能至关重要。 一、Magento数据结构解析 Magento是一款功能强大的电子商务...
以上就是使用SQL批量修改Magento产品名称和描述的方法。记住,尽管这种方法效率高,但必须谨慎操作,以免误改数据。在进行任何数据库级别的操作时,确保你对Magento的数据库结构有深入理解,并遵循最佳实践。
- 将图片文件夹上传到服务器的`magento/media/import`目录下。如果图片数量大,可先压缩再上传,到达后在控制面板解压。 4. **上传数据包**: - 使用FTP工具将CSV数据包上传至服务器的`var/import`目录下。若无此...
根据提供的文件信息,我们可以归纳出一系列与Magento相关的SQL命令及应用场景。Magento是一款广泛使用的电子商务平台,对于维护其数据库的操作非常重要。下面将详细解释文件中提到的各个知识点。 ### Magento SQL ...
Magento-sample-data-1.6.1.0这个压缩包就提供了这样的数据集,让你能够在安装Magento 1.6.1.0时预填充商店信息,无需从零开始创建所有内容。 样例数据的安装通常包括以下几个步骤: 1. **下载并解压**: 首先,你...
在电子商务领域,Magento是一款非常流行的开源电子商务平台,它提供了丰富的功能和灵活性,使得...通过上述步骤,我们可以在Magento系统中有效地通过产品名称获取产品ID,这对于自动化处理和数据分析流程具有重要意义。
"magento-演示数据1.6.1.0"是一个专门为Magento 1.6.1.0版本准备的示例数据包,它包含了用于演示和测试 Magento 商店功能的各种数据,如产品、类别、顾客、订单等。 该压缩包文件“magento-sample-data-1.6.1.0”...
首先,我们要理解Magento的产品数据存储结构。Magento将产品信息分散在多个数据库表中,主要包括`catalog_product_entity`作为主产品表,以及一系列以`_attribute`结尾的表来存储产品的不同属性。自定义属性则存储在...
- 在此之前,最好再次确认所有数据都已经成功迁移,以防万一。 #### 四、注意事项 - **备份数据**:在开始任何迁移工作之前,务必对当前环境的数据进行全面备份。 - **环境兼容性**:确保新版本的Magento与当前...
这会创建 Magento 需要的所有表,包括 `catalog_product_entity`(产品信息)、`sales_flat_order`(订单数据)、`customer_entity`(客户信息)等。 4. **加载样本数据**:除了基础架构,这个包可能还包含一些示例...
标题提到的"我终于实现了把FirePHP集成进Magento了,终于能监测SQL了",这是一个关于将FirePHP日志框架与Magento电子商务平台整合的成就,使得开发者能够更方便地追踪和分析系统中的SQL查询。下面将详细阐述这一集成...
Controller 使用 Object Models,这一步骤中,Magento 的 Model 开始配置(加载 config.xml, system.xml, layout 下的*.xml 等所有配置文件)。Object Model 是 Magento 的核心组件之一,负责处理数据和业务逻辑。 ...
3. 测试:在导入所有数据后,进行详尽的测试,确保所有功能正常运行,无数据丢失或错误。 文件"magento批量导入.txt"可能包含了关于Magento批量导入功能的详细指南,这对于整个迁移过程至关重要。请仔细阅读并遵循...
在Magento1中,产品预览功能是提升用户体验的关键部分,它允许用户在不实际进入产品详情页面的情况下预览产品的图片。这样的设计可以提高网站的交互性和用户满意度,因为他们能够快速浏览商品,决定是否需要进一步...
### Magento站点首页显示新产品及产品数量 在Magento中,首页是吸引客户的第一界面,因此如何有效地展示新产品及其数量显得尤为重要。本文将详细介绍如何在Magento站点的首页上展示新产品及其数量,并提供具体的...
"Magento批量产品多图上传"是针对Magento系统的一个功能模块,主要解决了在Magento 1.7版本中一次性上传多个产品图片的问题,极大地提高了产品管理效率。 在默认情况下,Magento允许用户为每个产品添加多张图片,但...
- 清空Magento缓存。 - 在后台管理界面中,进入System -> Configuration -> Advanced。 - 展开“DisableModulesOutput”选项。 - 确认“App_Configviewer”是否显示在列表中。 4. **添加模块逻辑** 至此,您...
"DeleteOrder"插件是针对Magento系统的一个特定解决方案,解决了在默认情况下,Magento系统不支持直接删除订单的问题。这个插件允许用户在必要时永久删除订单,但需要注意的是,一旦订单被删除,数据将无法恢复,...