2

我创建了一个工作 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 中指示的值)。

更奇怪的是,如果我只是简单地编辑其中一个产品并保存它(不更改任何内容),那么这些属性会神奇地出现在前端!而且我什么都不会改变!只需编辑并保存!

任何想法?我有很多产品......并且逐个编辑/保存对我来说不是一个可行的解决方案......

非常感谢!

4

2 回答 2

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 的导入工具。

如果您考虑付费扩展,这里有一个不错的扩展它是一个围绕 MAGMI 的 ui 包装,它还支持以 magmi 格式导出产品数据,而不仅仅是像普通 magmi 那样导入。它适用于 Google 电子表格而不是 CSV,并根据 magmi 语法将数据直接导出到带有标题的 csv 列中。

于 2014-09-27T12:05:18.027 回答
0

问题是标准的 Magento 导入需要单独行中的多选属性的所有选项。您可以在导出正确设置的产品时看到这一点。

不幸的是,这大大降低了与其他软件的兼容性。

但幸运的是确实有一个插件: http: //www.magentocommerce.com/magento-connect/import-products-categories-multiple-images-and-custom-options.html

希望这可以帮助。祝你好运!

更新:

扩展中有一个小错误,可能仅与多商店站点结合使用。您仍然可以导入 category_ids(自述文件中未提及),但在导入类别名称时会崩溃。该错误似乎在此文件中的函数 _addCategories() 中的某处:

\app\code\community\CapacityWebSolutions\ImportProduct\Model\Convert\Adapter\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 ///////////////////
于 2013-08-30T13:20:38.917 回答