Php 使用图像插件的Magento质量导入器(MAGMI)
我正在使用数据泵,一切正常,但我需要添加图像处理器。到目前为止没有运气。有人知道怎么做吗?这是你的电话号码。这是我正在使用的代码。我没有把车放进去Php 使用图像插件的Magento质量导入器(MAGMI),php,magento,e-commerce,magmi,Php,Magento,E Commerce,Magmi,我正在使用数据泵,一切正常,但我需要添加图像处理器。到目前为止没有运气。有人知道怎么做吗?这是你的电话号码。这是我正在使用的代码。我没有把车放进去 require_once(MAGENTO."/magmi/integration/magmi_datapump.php"); class TestLogger{ public function log($data,$type){ $mess.="$type:$data\n"; } } $dp=Magmi_DataPum
require_once(MAGENTO."/magmi/integration/magmi_datapump.php");
class TestLogger{
public function log($data,$type){
$mess.="$type:$data\n";
}
}
$dp=Magmi_DataPumpFactory::getDataPumpInstance("productimport");
$dp->beginImportSession("default","create",new TestLogger());
$item=array(
"type"=>"simple",
"sku"=>$sku,
"name"=>$p_name,
"short_description"=>$shortdesc,
"description"=>$longdesc,
"cost"=>$cost,
"price"=>$price,
"min_qty"=>0,
"qty"=>$stock,
"tax_class_id"=>2,
"status"=>2,
"attribute_set"=>$attribute_set,
"category_ids"=>implode(",",array_unique($cat_list)),
"manufacturer"=>$manufacturer
);
//This doesn't seem to be working.
$item["image"]="http://images.domain.com/product_images".$image[0];
$item["store"]="";
$dp->ingest($item);
$dp->endImportSession();
现在我已经浏览了,我不知道如何加载插件。。有没有办法修理它?Tk要使imageprocessor正常工作,您必须通过magmi配置UI将其添加到“默认”配置文件的选定插件列表中。,因此我无法执行此操作。。但我现在也知道为什么了。。因为我没有使用UI,我没有使用所有的类,所以我不能使用itemprocessor,然后是图像处理器,因为它继承了它。下面是我如何解决这个问题的。我只是在MAGMI通过数据泵做了这件事之后重新翻看了一下列表。这里是如何
$imgAttrIds = array(79,80,81);
$imageGalId = 82;
$conn = Mage::getSingleton('core/resource')->getConnection('core_read');
$connW = Mage::getSingleton('core/resource')->getConnection('core_write');
if($image[0]!=''){
$image_file="http://domain.com/product_images".$image[0];
$param=array();
$config=array();
$p=Mage::getModel('catalog/product')->loadByAttribute('sku',$line[0]);
$entity_id=$p->getId();
$insertData = array();
$skusToInsert = array();
for ($i = 0; $i <= count($image)-1; $i++) {
//there is a very nifty image sizer there so $params is a for that ;)
$param['to']="/media/catalog/product".$image[$i];
echo function_supersizer($param,$config)."<br/>";
if($i<=0){
foreach($imgAttrIds as $img) {
$insertData[] = "(4, ".$img.", 0, ".$entity_id.", '".$image[$i]."')";
}
}
$skusToInsert[] = "(".$imageGalId.", ".$entity_id.", '".$image[$i]."')";
}
$sql = "INSERT INTO mag_catalog_product_entity_media_gallery (attribute_id, entity_id, value) VALUES ".implode(",",$skusToInsert).";";
$connW->query($sql);
$sql = "INSERT INTO mag_catalog_product_entity_varchar (entity_type_id, attribute_id, store_id, entity_id, value) VALUES ".implode(",",$insertData).";";
$connW->query($sql);
$imgAttrIds=数组(79,80,81);
$imageGalId=82;
$conn=Mage::getSingleton('core/resource')->getConnection('core_read');
$connW=Mage::getSingleton('core/resource')->getConnection('core_write');
如果($image[0]!=''){
$image\u文件=”http://domain.com/product_images“$image[0];
$param=array();
$config=array();
$p=Mage::getModel('catalog/product')->loadByAttribute('sku',$line[0]);
$entity_id=$p->getId();
$insertData=array();
$skusToInsert=数组();
对于($i=0;$i查询($sql);
这很有效。它对我来说很有效。刚刚测试了15000个产品。但是。是的,首先在测试版上使用
干杯-杰里米认为你错了,德维夫斯是对的 您使用的是:
$dp->beginImportSession("default","create",new TestLogger());
这意味着您正在使用“默认值””配置文件
您可以通过以下url配置此配置文件:
如果没有图像处理器,你可以手动下载插件
要安装,您必须将“itemprocessors”文件夹放入
“magmi\plugins\base\itemprocessors”
起初,我遇到了与您相同的问题,这种方式很好。好的。我想我知道我需要什么。我需要将插件列在magmi/conf/plugins.conf中。有人有该文件的示例吗?我的文件是空的,我不确定我是否要运行UI配置页面,并冒着撤消的风险。如果你不想破坏任何东西,cr在UI中创建一个新的magmi配置文件,并在此新配置文件中修改插件。例如,如果此新配置文件称为“测试”,只需执行:$dp->beginImportSession(“测试”,“创建”,new TestLogger());使用它而不是基本默认设置profile@dweeves我有同样的问题,但是没有使用“默认”并且图像处理器已启用且在配置中。没有错误。嗨,欢迎使用SO!-请快速浏览此内容以备将来发布:)这里的链接是怎么回事?只是重定向到laa land?但我确实尝试过按照你的建议进行调整。我可能需要再运行一次,看看是否有我键入的内容或你有什么。