2

I'm Importing products from another shop system to a new magento installation (1.9.0.1). Therefore I have created a CSV which gets imported via a import profile. The import process shows no errors but after the import the products don't show up in Catalog -> Manage Products. But they do show up in Catalog -> Manage Categories and they can also be edited/accessed via the url /catalog_product/edit/id/{manually enter new ID here}.

In the edit form and when exporting the products again and comparing them to correct products (which do show up and which I created regularly) I noticed, that the status attribute is missing. When I set it from "-- Please Select --" in the edit mask to "Enabled" or "Disabled" and save, the product shows up and seems to work properly.

However I have found no way, to get the import profile to import the status in the first place. I have a "status" field in my CSV and I have tried 1, "1", 2, "2", Enabled, "Enabled", Disabled and "Disabled". I have also tried to change the position of my status field but absolutely no luck. Everything else (including media links) gets imported correctly.

What am I missing or what can I do? I also wouldn't mind to bulk fix the products after the import as it is a one time import but as I cannot see them in the catalog list, I am not sure if there is a good way to do so. Or where would be the place to hook into the import process and fix this problem quick and dirty with some php lines that would just enforces that a status is set on every product import (I'm new to magento, so I'm not really sure where I should start looking).

Thanks for any tips!

2

Meanwhile I have digged some further and it looks like more people have similar problems. Unfortunately there is nowhere a real clue why this kind of problems occur on some imports in the first place.

But there are workarounds. For the sake of completeness here two similar cases with similar workaround suggestions: Magento products not showing up after import https://stackoverflow.com/questions/12953584/product-is-not-displaying-in-listing-in-magento-after-import

Based on these threads and some other suggestions I found I now built a little PHP CLI script for my specific case which only adds the status and only when its missing:

require_once $pathToYourMagentoDirectory.'/app/Mage.php';
Mage::app();

$allProducts = Mage::getModel('catalog/product')->getCollection();
$count = 0;
foreach($allProducts as $product) {
    $currentStatus = Mage::getResourceModel('catalog/product')->getAttributeRawValue($product->getEntityId(), 'status');
    if ($currentStatus != 1 && $currentStatus != 2) {
        $product->setData('status', 1)->getResource()->saveAttribute($product, 'status');
        $count++;
    }
}
echo ('Fixed '.$count.' products by adding a valid status.');
echo ("\n");

In my case a SQL based fix like suggested in the comments above wouldn't have worked as catalog_product_entity_id simply had no entries for the newly imported products and the status attribute which could have been updated.

Still an odd problem and maybe there would be a better way to approach this - i. e. getting the initial import to work properly...

  • This worked for me too. I can now just import it, and then run the script using php fixstatus.php from the commandline. Great find. – Marten Sytema Mar 25 '15 at 19:23
2

I've struggled with the same problem for a while now and I think I've found the problem (at least for me..).

Though I used the script-solution for a while aswell I had the Magento interface in my own language (Dutch) and it seems this is what was causing the text based status (Enabled) not being recognized. When I switched to the en_US interface the import worked fine!

I have absolutely no clue why the interface language was a problem but I hope this helps for you or someone else aswell.

1

After your import did you try the built in Magento export? That may give you some direction as to what fields are missing. 1 is the correct value for enabled products.

http://www.magentocommerce.com/knowledge-base/entry/working-with-product-csv-files

  • yes I directly exported and as stated above the status value is simply missing compared to working products (everything else is in place) so I'm already very sure the status is the problem. And unfortunately your link was my working basis and I really tried everything with the status field in the CSV and am kind of clueless right now :( So I'm really also open to unconventional workarounds... – Jey DWork Aug 2 '14 at 21:04
  • Back up your database first: SELECT * FROM `eav_attribute` WHERE `attribute_code` LIKE 'status' in my install it was 89. Use that id in a update catalog_product_entity_id set value = 1 where attribute_id = 89 – Jason Aug 3 '14 at 2:34
  • Thanks for your effort. Unfortunately I had to find out that the entries for status in the catalog_product_entity_id table for the "broken" products don't exist at all so an SQL update on them is not possible... But I have found another workaround for my case and posted it as answer. – Jey DWork Aug 3 '14 at 3:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.