我在使用magmi datapump api导入自定义选项时遇到了一些问题。我可以通过在一个数组中传递数据来轻松地上传产品,如magmi的示例所示。
但是,当我安装自定义选项模块并启用它时,我收到以下错误。
...
$dp->beginImportSession("default","create");
// Here we define a single "simple" item, with name, sku,price,attribute_set,store,description
$item = array(
'name' => 'test a',
'sku' => 'testsku3',
'price' => '110.00',
'attribute_set' => 'Default',
'store' => 'admin',
'description' => 'ingested with Datapump API',
'meta_title' => 'test meta',
'qty' => '1',
'categories' => '2',
'weight' => '1',
'tax_class_id' => '4',
'Please enter your text:field:1:3' => ':fixed:0.5:Ref Text:35'
);
...返回错误:
Notice: Undefined index: xxx:field:1 in /var/www/vhosts/websitename.co.uk/magmi/plugins/extra/itemprocessors/customoptions/pablo_customoptions.php on line 33现在,此错误代码解析为...
...
public function getOptId($field)
{
return $this->_optids[$field];
}
...有没有人知道如何解决这个问题?
谢谢!:)
发布于 2012-09-14 17:24:15
这条线
‘请输入您的文本:字段:1:3’=> ':fixed:0.5:Ref Text:35‘
将创建此错误。
通过编辑php文件来修复它
...
public function getOptId($field)
{
if isset($this->_optids[$field]) return $this->_optids[$field];
return '';
}
...或者更好的“请输入您的文本”,如脚本中所说;)将该行替换为您的自定义属性
'Please enter your text:field:1:3' => ':fixed:0.5:Ref Text:35'
EDIT TO:
'custom_attribute' => 'value',西蒙
发布于 2013-10-11 20:57:35
所以我也有同样的问题,这是一个巨大的头痛。上面的解决方案在某种程度上是有效的,因为创建产品时没有错误,但没有添加自定义选项。
然而,我设法创建了一个解决方案!
我正在尝试使用以下标签向我的产品添加自定义选项:
date_time:field:1:1
这抛出了与您遇到的完全相同的错误。但是,它的格式应该是这样的。
为了解决这个问题,我不得不编辑这个文件:/magmi/plugins/extra/itemprocessors/customoptions/pablo_customoptions.php
我将getOptId()函数(第30行)改为:
public function getOptId($field)
{
if(isset($this->_optids[$field])){
return $this->_optids[$field];
} else {
return false;
}
}并对createOption()函数进行了更改(现在在第74行)。我将if(!isset($optionId))更改为if(!$optionId)
答对了,它现在应该像预期的那样工作了!
https://stackoverflow.com/questions/12045950
复制相似问题