Php 使用Magento重新索引刚通过编程更改的产品
我的Magento商店里有130000多种产品。尽管我安装了(顺便说一句,这节省了很多时间,例如:只需10分钟的重新索引,而不是大约4小时),但当我通过PHP文件添加或更改两个产品时,通过Magento后端界面重新索引所有内容需要很多时间 是否可以仅为添加/更改的产品重新索引所有内容(搜索、价格、股票等)?我使用该工具添加/更改它们。我的PHP代码如下所示:Php 使用Magento重新索引刚通过编程更改的产品,php,mysql,magento,indexing,magmi,Php,Mysql,Magento,Indexing,Magmi,我的Magento商店里有130000多种产品。尽管我安装了(顺便说一句,这节省了很多时间,例如:只需10分钟的重新索引,而不是大约4小时),但当我通过PHP文件添加或更改两个产品时,通过Magento后端界面重新索引所有内容需要很多时间 是否可以仅为添加/更改的产品重新索引所有内容(搜索、价格、股票等)?我使用该工具添加/更改它们。我的PHP代码如下所示: $in=array(); $in[]= 'magmi'; $in[]= 'magmi/inc'; $in[]= 'magmi/integr
$in=array();
$in[]= 'magmi';
$in[]= 'magmi/inc';
$in[]= 'magmi/integration/inc';
$in[]= 'magmi/engines';
$inpath="";
foreach ($in as $i){
$inpath .= $i .':';
}
$inpath .= '.';
set_include_path($inpath);
require_once("magmi_datapump.php"); // call Datapump
$dp=Magmi_DataPumpFactory::getDataPumpInstance("productimport");
$dp->beginImportSession("default","create"); // default- name of profile , create - we want to create and update items
$row = 0;
$handle = fopen("data.csv", "r");
while (($item = fgetcsv($handle, 1000, ",")) !== FALSE) {
$row++;
if($row > 0 && $row < 135000){
$newProductData = array(
'name' => (string) $item[1]." ".$item[3], // name
'sku' => (string) $item[1], // sku
'price' => (real) $item[4], // price
'store' => 'admin',
'description' => (string) $item[2]."\n".$item[3]."\nHerstellerteilenummer: ".$item[1], // full description
'short_description' => (string) $item[2]."\n".$item[3]."\nHerstellerteilenummer: ".$item[1], // short description
'category_ids' => '4', // ID of categories
'tax_class_id' => '1', // tax class id (check your ids)
'manufacturer' => (string) $item[2], // manufacturer
'attribute_set' => 'Default',
'weight' => (string) "0",
'use_config_manage_stock' => 0
);
$newProductData['image']='+'.(string) '/media/catalog/product/placeholder/high/'.$item[2].'.png'; // + show picture, - dont show picture
$newProductData['small_image']='+'.(string) '/media/catalog/product/placeholder/small/'.$item[2].'.png'; // small img
$newProductData['thumbnail']='+'.(string) '/media/catalog/product/placeholder/thumb/'.$item[2].'.png'; // thumbnail
$dp->ingest($newProductData);
print_r($newProductData);
echo "PRODUCT NR: " . $row;
echo '' . ' mem:'.memory_get_usage() . " ... Done! <br />\n"; //memory usage check
$newProductData=null; //clear memory
unset($newProductData); //clear memory
}
}
unset($item);
$dp->endImportSession();
$in=array();
【】中的美元=magmi;
[]中的美元=magmi/inc;
[]中的美元=magmi/integration/inc';
[]中的美元=magmi/引擎;
$inpath=“”;
foreach($i){
$inpath.=$i.:';
}
$inpath.=';
设置包含路径($inpath);
需要一次(“magmi_datapump.php”);//呼叫数据泵
$dp=Magmi_数据泵工厂::getDataPumpInstance(“产品导入”);
$dp->beginImportSession(“默认”、“创建”);//默认-配置文件名称,创建-我们要创建和更新项目
$row=0;
$handle=fopen(“data.csv”、“r”);
while(($item=fgetcsv($handle,1000,“,”)!==FALSE){
$row++;
如果($row>0&&$row<135000){
$newProductData=array(
'name'=>(字符串)$item[1]。“”.$item[3],//名称
'sku'=>(字符串)$item[1],//sku
'价格'=>(实际)$item[4],//价格
'存储'=>'管理',
'description'=>(字符串)$item[2]。“\n.$item[3]。\nHerstellenummer:“..$item[1],//完整说明
'short\u description'=>(字符串)$item[2]。“\n”。$item[3]。\nHerstellenummer:“..$item[1],//简短描述
'category_ID'=>'4',//类别的ID
'tax_class_id'=>'1',//tax class id(检查您的id)
'manufacturer'=>(字符串)$item[2],//制造商
'attribute_set'=>'Default',
“权重”=>(字符串)“0”,
“使用配置管理库存”=>0
);
$newProductData['image']='+'(字符串)'/media/catalog/product/placeholder/high/'.$item[2]..png';/+显示图片,-不显示图片
$newProductData['small_image']='+'(string)/media/catalog/product/placeholder/small/'.$item[2]..png';//small img
$newProductData['thumbnail']='+'(字符串)/media/catalog/product/placeholder/thumb/'.$item[2]..png';//缩略图
$dp->ingest($newProductData);
打印(新产品数据);
echo“产品编号:.$行;
回显“”。“mem:”。内存使用率()。“…完成!
\n”//内存使用率检查
$newProductData=null;//清除内存
取消设置($newProductData);//清除内存
}
}
未结算(项目);
$dp->endImportSession();
所谓“重新索引”是指在表上重新创建MySQL索引吗?如果是这样,就没有必要这样做。索引是动态维护的。所谓“重新索引”,是指在表上重新创建MySQL索引吗?如果是这样,就没有必要这样做。索引是动态维护的。但当我添加产品时,它们在搜索中不可见,当我更改产品价格时,这些更改仅在产品页面本身可见(例如,在类别页面上不可见)。我必须手动重新编制所有内容的索引,以使更改可见(或使新产品可见)。请提供SHOW CREATE TABLE
。但是,当我添加产品时,它们在搜索中不可见,当我更改产品价格时,这些更改仅在产品页面本身可见(例如,在类别页面上不可见). 我必须手动重新索引所有内容,以使更改可见(或使新产品可见),请提供SHOW CREATE TABLE
。