我正在使用Column Mapper将源文件中的列映射到相应的系统列。
当源列标题中包含“(”或“)”时出现错误。 该错误发生在magmi UI中。
以下是一个例子:
Mapped columns list: Name,Syle#,Width (inches)
New name for col Name: name
New name for col Style#: sku
New name for col Width (inches): width
保存配置文件后,我收到以下错误:
**Warning:** syntax error, unexpected '(' in ColumnMappingItemProcessor.conf on line 7 in /public_html/magmi/inc/properties.php on line 49
我知道一个简单的解决方案是从源中删除“(”和“)”,但这并不能解决问题。 (我在源代码中有72列,其中许多包含“(”)
答案 0 :(得分:0)
就我个人而言,我发现Magmi并不总能满足我对数据操作的需求。我建议做的是编写一个.php文件,以正确的Magento Ready导入格式创建一个csv文件。我建议这有两个原因:1)数据以Magento方式准备2)如果您需要重新创建导入文件或更改数据,则很容易操作。 (只是不要删除你的解析器或数据文件)
$importFile = fopen('ProductImport.csv', 'w');
$dataSource = fopen('yourDataFile.csv', 'r');
$header = array(); //add the Header data here, export a sample from Magento to get all the correct fields
$write = array();
$write = array_fill(0, 98, ''); //98 = your field total could be +-
fputcsv($importFile, $header);
while(($products = fgetcsv($dataSource, 0, ',')) !== FALSE) {
$write[0] = $prodcuts[0] //map your data like this associating the proper fields
//continue to map all your fields using whatever logic is needed to ensure the values are correct
//Then add each product to the csv file until you finish the loop
fputcsv($importFile, $write);
}
//Finally remember to close all your open files
fclose($importFile);
fclose($dataSource);
哦我也非常支持这种方法,因为如果你需要操作源文件的内容以匹配Magento所需的内容,你可以使用各种PHP函数和&amp ;;逻辑。如果您愿意,可以自定义构建产品URL,将它们动态添加到类别等等。