Magento dataflow profile export - duplicate sku´s
-
13-12-2019 - |
Question
after I updated my magento store to the latest version 1.9.2.1 I get into trouble regarding to the export of products with the dafalow profile export.
With every export I got duplicate entries in my csv file and don´t know why. In my product database I have no duplicate entries. If I use the normal export mechanism with "export -> export products" I don´t get duplicate sku entries.
Does someone has the same issue with the dataflow profile?
I just created a new profile with only the sku in it.
<action type="catalog/convert_adapter_product" method="load">
<var name="store"><![CDATA[0]]></var>
<var name="filter/type"><![CDATA[simple]]></var>
</action>
<action type="catalog/convert_parser_product" method="unparse">
<var name="store"><![CDATA[0]]></var>
<var name="url_field"><![CDATA[0]]></var>
</action>
<action type="dataflow/convert_mapper_column" method="map">
<var name="map">
<map name="sku"><![CDATA[sku]]></map>
</var>
<var name="_only_specified">true</var>
</action>
<action type="dataflow/convert_parser_csv" method="unparse">
<var name="delimiter"><![CDATA[,]]></var>
<var name="enclose"><![CDATA["]]></var>
<var name="fieldnames">true</var>
</action>
<action type="dataflow/convert_adapter_io" method="save">
<var name="type">file</var>
<var name="path">var/export</var>
<var name="filename"><![CDATA[test.csv]]></var>
</action>
At the moment I have no idea how to solve this...
Small example with my csv export:
Solution
Fix from above comment worked.
Try this: https://github.com/baconl/Magento-1.9.2.X-duplicate-sku-export-fix Its a temporary fix until the magento core team fixes it, – baconl
OTHER TIPS
The problem comes from a join in the query. I have the same issue, but still didn't resolve it yet. But when I go and export all products I can see that this happens only to products that have many pictures. If we remove this join, the result will be OK or we have to add UNIQUE to the query. You can see on this screenshot what's causing the duplicate rows.
UPDATE If you don't need images on your export, you can go to app/code/core/Mage/Catalog/Convert/Parser/Product.php. You can override this model and comment from line 515 to 534 If you need images, you have to change this function and not execute this block when only some fields are mapped
When you update to Magento 1.9.2.X you will have this problem. If u use the app/code/core/Mage/Catalog/Model/Convert/Parser/Products.php
from a older version of magento it will fix your problem.
You can try using this link, its a temporary fix that uses a older Products.php file:
https://github.com/baconl/Magento-1.9.2.1-duplicate-sku-fix
Keep in mind, this is a temporary fix until the magento core team fixes it in the next version of Magento.