服务报价 | 域名主机 | 网络营销 | 软件工具| [加入收藏]
 热线电话: #
当前位置: 主页 > php教程 > prestashop教程 >

PrestaShop批量去除简介品牌和产品名称的品牌

时间:2016-01-14 09:08来源: 作者: 点击:
PrestaShop批量去除简介品牌和产品名称的品牌 ?php define(PS_ADMIN_DIR, getcwd()); include(PS_ADMIN_DIR./../config/config.inc.php); $product = Db::getInstance()-ExecuteS(SELECT `id_product`, `name`, `description` FROM `mkshop_p

PrestaShop批量去除简介品牌和产品名称的品牌
<?php
define(‘PS_ADMIN_DIR’, getcwd());

include(PS_ADMIN_DIR.’/../config/config.inc.php’);

$product = Db::getInstance()->ExecuteS(‘SELECT `id_product`, `name`, `description` FROM `mkshop_product_lang`’);

foreach($product as $p){
preg_match(‘/Brand:(.*?)<br \/>/isu’, $p['description'], $replace);

if(is_array($replace) && count($replace)){
$name = trim(str_ireplace($replace[1], ”, $p['name']));
$description = str_ireplace($replace[0], ”, $p['description']);

Db::getInstance()->autoExecute(‘mkshop_product_lang’, array(‘name’ => $name, ‘description’ => $description), ‘UPDATE’, ‘id_product = ‘.(int)$p['id_product'].”);
echo (int)$p['id_product'];
}
}
echo ‘<h1>OK~</h1>’;
//include(PS_ADMIN_DIR.’/footer.inc.php’);
?>

(责任编辑:最模板)
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
栏目列表
热点内容