Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I forgot which CSV columns are mandatory but I do remember that if some are missing the importer does not tell you that but instead you get the behaviour that you are describing.</p> <p>The simplest way to find out what is mandatory is to:</p> <ol> <li><strong>Fix bugs in Magento ImportExport module</strong></li> <li>Create a new product in admin</li> <li>Check that the new product is visible on front-end</li> <li>Export the new product with Magento ImportExport exporter</li> <li>Delete created product</li> <li>Import the previously exported product csv</li> <li>Clear cache and reindex data</li> <li>Check that product is visible on front-end (it should be)</li> <li>Compare your CSV with the exported one and try to figure out what is missing from it</li> <li>Try to import your CSV with added/fixed columns and add data untill the product is imported so that it is visible on front-end</li> </ol> <p>This requires allot of trial and error...</p> <p>The missing columns in my case had always the same value so if this will be the case with your problem as well you can simply extend CSV importer and hard code those values in there instead of fixing your CSV manually.</p> <p>Since your product gets saved correctly if you open it in admin and save it you can also:</p> <ol> <li>Import a product</li> <li>Export that product</li> <li>Open that product in admin and save it</li> <li>Export newly saved product</li> <li>Compare exported CSV-s where they differ</li> </ol> <p><strong>Fixing Magento ImportExport bugs:</strong></p> <p>First bug is that if you import multiple products the quantity informatino from the first product is used for all the products. To fix this you have to add <code>$row = array();</code> right before <code>$row['product_id'] = $this-&gt;_newSku[$rowData[self::COL_SKU]]['entity_id'];</code> in <code>Mage_ImportExport_Model_Import_Entity_Product::_saveStockItem()</code> function.</p> <p>The second bug causes Magento ImportExport module to return a foreign key constraint error when importing multiple products. Error happens because magento splits products data into multiple segments and if one product is located in two segments importer will delete data that was imported for the product in first segment before importing the second segment thereby causing database corruption (see <a href="http://twistersfury.com/foregin-key-constraint-errors-on-magento-import/#.UZE4BdfKW_Q" rel="nofollow">this link</a> for detailed explanation - this is where I got the solution below).</p> <p>Note that removing foreign key constraint will not fix the problem but will instead make it worse since the database will contain corrupt data.</p> <p>To fix it you have to change the code in <code>Mage_ImportExport_Model_Import_Entity_Abstract::_saveValidatedBunches()</code> function:</p> <p>After <code>if ($startNewBunch || !$source-&gt;valid()) {</code> add</p> <pre><code>if ($startNewBunch &amp;&amp; count($bunchRows) &gt; 1) { $arrKeys = array_keys($bunchRows); $arrNew = array(); while(($tRow = array_pop($bunchRows))) { $tKey = array_pop($arrKeys); $arrNew[$tKey] = $tRow; if ($tRow['sku']) { break; } } $nextRowBackup = array_reverse($arrNew, TRUE) + $nextRowBackup; } </code></pre> <p>Hope this helps.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload