我创建了一个工作CSV结构,用于本机Magento导入(系统/导入/导出/导入)。
以下是我的结构示例,其中包含基于第一个产品的简单产品和可配置产品。
"sku","_store","_attribute_set","_product_websites","_type","name","price","special_price","news_from_date","news_to_date","tax_class_id","short_description","description","meta_description","meta_keyword","meta_title","_root_category","_category","has_options","color","talla","coleccion","composition","prestaciones_tecnicas","tejido_tecnico","_links_upsell_sku","image","small_image","thumbnail","status","visibility","weight","qty","is_in_stock","_media_attribute_id","_media_image","_media_lable","_media_position","_media_is_disabled","_super_products_sku","_super_attribute_code","_super_attribute_option"
"1601127-A-NEGRO/ROJO FUEGO-S",,"CustomAttrs","base","simple","CHALECO NAREM - A-NEGRO/ROJO FUEGO - S","81.95","",,,"0","Blabla blabla","Blabla blabla",,,,"Default Category","MUJER/PRENDA/CHALECO","0","A-NEGRO/ROJO FUEGO","S",,,,,,,,,"1","1","0","1","1",,,,,,,,
"1601127-A-NEGRO/ROJO FUEGO-M",,"CustomAttrs","base","simple","CHALECO NAREM - A-NEGRO/ROJO FUEGO - M","81.95","",,,"0","Blabla blabla","Blabla blabla",,,,"Default Category","MUJER/PRENDA/CHALECO","0","A-NEGRO/ROJO FUEGO","M",,,,,,,,,"1","1","0","2","1",,,,,,,,
"1642238-A-NEGRO/ROJO FUEGO-S",,"CustomAttrs","base","simple","CHAQUETA SERKA - A-NEGRO/ROJO FUEGO - S","97.35","",,,"0","Blabla blabla","Blabla blabla",,,,"Default Category","MUJER/PRENDA/CHAQUETA","0","A-NEGRO/ROJO FUEGO","S",,,,,,,,,"1","1","0","2","1",,,,,,,,
"1642238-A-NEGRO/ROJO FUEGO-M",,"CustomAttrs","base","simple","CHAQUETA SERKA - A-NEGRO/ROJO FUEGO - M","97.35","",,,"0","Blabla blabla","Blabla blabla",,,,"Default Category","MUJER/PRENDA/CHAQUETA","0","A-NEGRO/ROJO FUEGO","M",,,,,,,,,"1","1","0","1","1",,,,,,,,
"1601127",,"CustomAttrs","base","configurable","CHALECO NAREM","81.95","","2013-04-29 00:00:00","2013-05-29 00:00:00","0","Blabla blabla","Blabla blabla","Blabla blabla","CHALECO,CORTAVIENTOS,REPELENCIA AL AGUA","CHALECO NAREM","Default Category","MUJER/PRENDA/CHALECO","1",,,"CITY CYCLING","",,,,"","","","1","4",,,,"88","","","1","0",,,
,,,,,,,,,,,,,,,,"Default Category","MUJER",,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,"Default Category","MUJER/PRENDA",,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,"ACTIVE SOFTSHELL",,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,"transpirable",,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,"stretch",,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,"costuras flatlock",,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,"tratamiento anti uv",,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,"Repelente al agua",,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"1601127-A-NEGRO/ROJO FUEGO-S","talla","S"
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"1601127-A-NEGRO/ROJO FUEGO-S","color","A-NEGRO/ROJO FUEGO"
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"1601127-A-NEGRO/ROJO FUEGO-M","talla","M"
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"1601127-A-NEGRO/ROJO FUEGO-M","color","A-NEGRO/ROJO FUEGO"
"1642238",,"CustomAttrs","base","configurable","CHAQUETA SERKA","97.35","","2013-04-29 00:00:00","2013-05-29 00:00:00","0","Blabla blabla","Blabla blabla","Blabla blabla","CHAQUETA,CORTAVIENTOS,REPELENCIA AL AGUA","CHAQUETA SERKA","Default Category","MUJER/PRENDA/CHAQUETA","1",,,"CITY CYCLING","",,,,"","","","1","4",,,,"88","","","1","0",,,
,,,,,,,,,,,,,,,,"Default Category","MUJER",,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,"Default Category","MUJER/PRENDA",,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,"ACTIVE SOFTSHELL",,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,"transpirable",,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,"stretch",,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,"costuras flatlock",,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,"tratamiento anti uv",,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,"Repelente al agua",,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"1642238-A-NEGRO/ROJO FUEGO-S","talla","S"
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"1642238-A-NEGRO/ROJO FUEGO-S","color","A-NEGRO/ROJO FUEGO"
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"1642238-A-NEGRO/ROJO FUEGO-M","talla","M"
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"1642238-A-NEGRO/ROJO FUEGO-M","color","A-NEGRO/ROJO FUEGO"
导入效果很好,没有错误。但是发生了一些奇怪的事情:我创建了一些自定义属性。其中一些是只有一个值可选择的属性,但我有两个具有多选值的属性,这两个是有问题的(prestaciones_tecnicas& tejido_tecnico)。
导入后,我重新索引,清理缓存和所有内容......当我在前端找到产品的详细信息时,我看到除了两个多选属性之外的所有东西都没问题,其信息没有出现。我创建了这些属性的Zend_Debug :: dump(),并且为空。但令人惊讶的是,当我在Magento的管理员处编辑产品时,这些属性正确显示并且选择了相应的值(我在CSV中指示的值)。
更奇怪的是,如果只是我编辑其中一个产品并保存它(不改变任何东西),那么这些属性在前端神奇地显得正常!!! 我不知道改变一切!只需编辑并保存!
有什么想法吗?我有很多产品......逐一编辑/保存对我来说不是一个可行的解决方案...
非常感谢!
答案 0 :(得分:2)
想知道为什么仍然没有人提到MAGMI作为此问题的解决方案,并且是本机magento数据流配置文件的一个很好的替代方案。对于任何类型的magento进口来说,它都是一个非常强大的工具。您可以在wiki.magmi.org
中查看其所有功能可以从一行csv文件中轻松创建可配置产品,这是一个例子:
type configurable_attributes super_attribute_pricing
configurable size,color size::L:12;XL:15,color::red:10;green:15
多选属性可以很好地导入,很多人都会测试。
例如:
sku name description price Size:multiple:1
T-Shirt1 T-Shirt A T-Shirt 5.00 Small|Medium|Large
T-Shirt2 T-Shirt2 Another T-Shirt 6.00 XS|S|M|L|XL
在此示例中,将创建具有自定义选项的2个产品。自定义选项是多选类型的“大小”,需要选择(结尾为“1”)。 每个产品都有它的尺寸,第一个产品为小/中/大,第二个产品为XS / S / M / L / XL。
这只是对2个基本功能的快速提示 - 令人印象深刻,不是吗?
所以我强烈建议将MAGMI视为magento的导入工具。
如果你考虑付费扩展有一个很好的扩展here,它是一个ui环绕MAGMI,也支持以magmi格式导出产品数据,而不仅仅像普通magmi一样导入。它适用于Google电子表格而非CSV,并根据magmi语法将数据导出到带有标题的csv列中。
答案 1 :(得分:0)
问题是标准的Magento导入需要单独行中的多个select属性的所有选项。导出正确设置的产品时可以看到。
不幸的是,这大大降低了与其他软件的兼容性。
但幸运的是确实有一个插件: http://www.magentocommerce.com/magento-connect/import-products-categories-multiple-images-and-custom-options.html
希望这会有所帮助。祝你好运!
<强>更新强>
扩展中存在一个小错误,可能只与多商店网站结合使用。 您仍然可以导入category_ids(自述文件中未提及),但在导入类别名称时会崩溃。 该错误似乎在此文件的函数_addCategories()中的某处:
\应用\代码\社区\ CapacityWebSolutions \ ImportProduct \模型\转换\适配器\ Product.php 商店ID可能有问题。这就是为什么它可能只发生在多商店网站。
不幸的是我无法直接设置此功能,所以我不得不做一个解决方法。
它不会再创建类别,而是可靠地导入已设置的类别。 我替换了上面提到的文件的95-105行:
if (isset($importData['category_ids'])) {
$product->setCategoryIds($importData['category_ids']);
}
/* if category name is in csv file */
if (isset($importData['categories'])) {
$categoryIds = $this->_addCategories($importData['categories'], $store);
if ($categoryIds) {
$product->setCategoryIds($categoryIds);
}
}
有了这个(替换过滤器当然是国家特定的,也许mysql查询中的attribute_id应该是动态的......):
// NM5 translate category names in category IDs ///////////////////
if (isset($importData['categories'])) {
$nm5_cat_names = preg_split('/,/',$importData['categories']);
$nm5_read = Mage::getSingleton('core/resource')->getConnection('core_read');
$nm5_cat_table = Mage::getConfig()->getTablePrefix().'catalog_category_entity_varchar';
$originals = array('\'', '"', '\\', ';', '<', '>', '(', ')', '[', ']', '{', '}', '|', '$', '=', '%', 'Ä', 'Ö', 'Ü', 'ä', 'ö', 'ü', 'ß', ' - ', ' ', ' ', '_', '.', '?', '!', '³', ',', '„', '“', '+', '-–-', '–-' );
$replacements = array('', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'Ae', 'Oe', 'Ue', 'ae', 'oe', 'ue', 'ss', '-', '-', '-', '-', '', '', '', '3', '-', '', '', '-plus', '-', '-' );
$nm5_i = 0;
while($nm5_cat_names[$nm5_i] != '' ){
$filtered_text = strtolower(str_replace($originals, $replacements, $nm5_cat_names[$nm5_i]));
$nm5_results = $nm5_read->fetchAll("SELECT entity_id FROM $nm5_cat_table WHERE value LIKE '$filtered_text' and attribute_id = 51 group by entity_id");
if($nm5_i > 0){ $categoryIds .= ','; }
$categoryIds .= $nm5_results[0]['entity_id'];
$nm5_i++;
}
// $categoryIds = $this->_addCategories($importData['categories'], $store);
if ($categoryIds) {
$categoryIds;
$product->setCategoryIds($categoryIds);
}
}elseif(isset($importData['category_ids'])){
$product->setCategoryIds($importData['category_ids']);
}
// NM5 translate category names in category IDs ///////////////////