magento批量清除产品和分类
在magento的开发和模板调试的时候都需要加入一些分类和产品,等到网站正式上线的时候又是很麻烦的事情,所以自己写了一个php,用于清除产品和分类
<form action="" method="post">
Enter check product web:
<input type="text" name="web" size="40" maxlength="40"/>
<input type="submit" name="sub" value="submit">
</form>
<?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"."<br>";
echo "password:$password"."<br>";
$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="
相关新闻>>
- 发表评论
-
- 最新评论 更多>>