在magento的开发和模板调试的时候都需要加入一些分类和产品,等到网站正式上线的时候又是很麻烦的事情,所以自己写了一个php,用于清除产品和分类
$path="/var/html" //网站的目录
//include("mysql.class.php");
if($_POST[web]){
$web=$_POST[web];
$xml=simplexml_load_file("/$path/$web/app/etc/local.xml"); //读取xml文件
$dbname=$xml->global->resources->default_setup->connection->dbname;
$password=$xml->global->resources->default_setup->connection->password;
$username=$xml->global->resources->default_setup->connection->username;
echo "dbname:$dbname"."
";
echo "password:$password"."
";
$mysqli=new mysqli("localhost","$username","$password","$dbname");
//以下是清除语句
$csql1="TRUNCATE TABLE `catalog_category_entity`";
$csql2="TRUNCATE TABLE `catalog_category_entity_datetime`";
$csql3="TRUNCATE TABLE `catalog_category_entity_decimal`";
$csql4="TRUNCATE TABLE `catalog_category_entity_int`";
$csql5="TRUNCATE TABLE `catalog_category_entity_text`";
$csql6="TRUNCATE TABLE `catalog_category_entity_varchar`";
$csql7="TRUNCATE TABLE `catalog_category_product`";
$csql8="TRUNCATE TABLE `catalog_category_product_index`";
$csql9="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)";
$csql10="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)";
$csql11="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')";
$sqls="$csql1;$csql2;$csql3;$csql4;$csql5;$csql6;$csql7;$csql8;$csql9;$csql10;$csql11";
$dsql="TRUNCATE TABLE `catalog_product_bundle_option`;";
$dsql.=" TRUNCATE TABLE `catalog_product_bundle_option_value`;";
$dsql.=" TRUNCATE TABLE `catalog_product_bundle_selection`;";
$dsql.=" TRUNCATE TABLE `catalog_product_entity_datetime`;";
$dsql.=" TRUNCATE TABLE `catalog_product_entity_decimal`;";
$dsql.=" TRUNCATE TABLE `catalog_product_entity_gallery`;";
$dsql.=" TRUNCATE TABLE `catalog_product_entity_int`;";
$dsql.=" TRUNCATE TABLE `catalog_product_entity_media_gallery`;";
$dsql.=" TRUNCATE TABLE `catalog_product_entity_media_gallery_value`;";
$dsql.=" TRUNCATE TABLE `catalog_product_entity_text`;";
$dsql.=" TRUNCATE TABLE `catalog_product_entity_tier_price`;";
$dsql.=" TRUNCATE TABLE `catalog_product_entity_varchar`;";
$dsql.=" TRUNCATE TABLE `catalog_product_link`;";
$dsql.=" TRUNCATE TABLE `catalog_product_link_attribute`;";
$dsql.=" TRUNCATE TABLE `catalog_product_link_attribute_decimal`;";
$dsql.=" TRUNCATE TABLE `catalog_product_link_attribute_int`;";
$dsql.=" TRUNCATE TABLE `catalog_product_link_attribute_varchar`;";
$dsql.=" TRUNCATE TABLE `catalog_product_link_type`;";
$dsql.=" TRUNCATE TABLE `catalog_product_option`;";
$dsql.=" TRUNCATE TABLE `catalog_product_option_price`;";
$dsql.=" TRUNCATE TABLE `catalog_product_option_title`;";
$dsql.=" TRUNCATE TABLE `catalog_product_option_type_price`;";
$dsql.=" TRUNCATE TABLE `catalog_product_option_type_title`";
$dsql.=" TRUNCATE TABLE `catalog_product_option_type_value`;";
$dsql.=" TRUNCATE TABLE `catalog_product_super_attribute`;";
$dsql.=" TRUNCATE TABLE `catalog_product_super_attribute_label`;";
$dsql.=" TRUNCATE TABLE `catalog_product_super_attribute_pricing`;";
$dsql.=" TRUNCATE TABLE `catalog_product_super_link`;";
$dsql.=" TRUNCATE TABLE `catalog_product_enabled_index`;";
$dsql.=" TRUNCATE TABLE `catalog_product_website`;";
$dsql.=" TRUNCATE TABLE `catalog_product_entity`;";
$dsql.=" TRUNCATE TABLE `cataloginventory_stock`;";
$dsql.=" TRUNCATE TABLE `cataloginventory_stock_item`;";
$dsql.=" TRUNCATE TABLE `cataloginventory_stock_status`;";
$dsql.=" INSERT INTO `catalog_product_link_type`(`link_type_id`,`code`) VALUES (1,'relation'),(2,'bundle'),(3,'super'),(4,'up_sell'),(5,'cross_sell');";
$dsql.=" 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');";
$dsql.=" INSERT INTO `cataloginventory_stock`(`stock_id`,`stock_name`) VALUES (1,'Default')";
echo $sqls."
";
echo $dsql."
";
$sql="$dsql;$sqls";
if($mysqli->multi_query($sql)){
echo "CheckProduct Ok".$mysqli->insert_id."
";
echo "affected_rows".$mysqli->affected_rows."
";
}
else{
echo"CheckProduct false";
}
$mysqli->close();
}
?>
本文出自 “mcshell学习博客” 博客

<p>Windows 11 改进了系统中的个性化功能,这使用户可以查看之前所做的桌面背景更改的近期历史记录。当您进入windows系统设置应用程序中的个性化部分时,您可以看到各种选项,更改背景壁纸也是其中之一。但是现在可以看到您系统上设置的背景壁纸的最新历史。如果您不喜欢看到此内容并想清除或删除此最近的历史记录,请继续阅读这篇文章,它将帮助您详细了解如何使用注册表编辑器进行操作。</p><h2>如何使用注册表编辑

当您的PC存储空间不足时,您可以立即查看许多文件夹以释放空间。其中一个消耗很大一部分的是WindowsDefender保护历史记录,但你可以在Windows11中清除它吗?尽管并非完全必要,但删除保护历史记录实际上有助于清除系统上的一些存储空间。对于某些用户来说,这些文件占用了20-25GB的空间,如果您的计算机存储空间不足,这可能会令人生畏。那么,让我们找出什么是保护历史记录,在Windows11中清除它的所有方式,以及如何将其配置为在设置的时间后自动清除。什么是保护历史?M

手机在感染了某种木马病毒后,通过杀毒软件是无法发现查杀的,这个原理就像电脑感染了某种顽固病毒一样,只能通过格式化C盘重装系统,才能将病毒彻底清理掉,那么接下来我就讲解一下手机感染顽固病毒后,彻底清理病毒的方法。方法一打开手机依次点击“设置”-其他设置“-”还原手机“,将手机恢复至出厂设置即可。注意:恢复出厂设置前要先备份手机里面的重要资料,出厂设置就等同于电脑的”格式化重装系统一样“,恢复完之后手机里面的资料将会清空。方法二(1)首先将手机关机,然后同时按住手机“电源键”+“音量+键或音量-键”

win10如何批量重命名文件后缀?现在有非常多的用户都在使用Win10系统,而我们在平时使用电脑的过程中,经常会用到很多的快捷键,因为快捷键能让我们的操作更方便,那么要怎么批量重命名文件?下面,小编就为大家介绍下Win10批量重命名文件的操作。Win10批量重命名文件的操作1、全选你想重命名的文件。2、在选中状态的一个文件上点右键,选择重命名。3、一个文件改好新名称后,其他文件依次被序号标记。方法很简单,只不过修改的时候要注意文件排列顺序,以及被修改的样本文件排序位置。序号是从被修改的样本文件开

产品参数是指产品属性的意思。比如服装参数有品牌、材质、型号、大小、风格、面料、适应人群和颜色等;食品参数有品牌、重量、材质、卫生许可证号、适应人群和颜色等;家电参数有品牌、尺寸、颜色、产地、适应电压、信号、接口和功率等。

WPS云文档空间满了怎么清除随着云技术的快速发展,越来越多的人开始使用云端存储来存储和管理自己的文件。其中,WPS云文档作为一款智能办公软件,备受用户喜爱。然而,随着使用时间的增长和文件的累积,WPS云文档的存储空间可能会被占满。那么,当WPS云文档的空间满了时,我们应该如何清除呢?接下来,将为大家介绍一些常用的清理方法。第一种方法是彻底删除不需要的文件。W

有几种方法可以清除控制台或输出屏幕,其中之一是clrscr()函数。它在调用函数时清除屏幕。它在“conio.h”头文件中声明。还有一些其他方法,如system("cls")和system("clear"),它们在“stdlib.h”头文件中声明。以下是在C语言中清除控制台的语法:clrscr();ORsystem(“cls”);ORsystem(“clear”);以下是一个用

Inthisarticle,wewilllearnhowtoclearanLRUcacheimplementedinPython.Beforewedivedeepintothecodingaspect,let'sexplorealittleaboutwhatanLRUcacheisandwhyitispopular.LRUCache,也被称为最近最少使用缓存,是一种在计算机科学中广泛使用的数据结构,通过减少访问频繁使用的数据所需的时间来提高应用程序的性能。LRUCache存储了有限数量的项目,并


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

SublimeText3 Mac version
God-level code editing software (SublimeText3)

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver CS6
Visual web development tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software
