Magento – Import products with dropdown attributes don’t show in layered navigation

dropdown-attributeimportlayered-navigationmagento-1.8

First, here's my setup:
Magento 1.8.1, store functioning properly. I did import a list of product in CSV format using the Magento import function, the import was successful.

Here's my problem:
One attribute of the products is a dropdown list of numbers but I did not set any validation for it so it could be anything. When the import process is complete, all values are there and displayed properly in the frontend but I did set this attribute to be "Use In Layered Navigation" but nothing appear in the Shopping Options. The only way to make it appear there is to go in every products (on admin side), change manually the value of this attribute, change it back to it's proper value and save.

What I tried so far:
I thought maybe it could be a data format problem, so I change the cell format (I use OpenOffice Calc) to text and import again. Then I put the values back to number (still in the CSV here) and set the input validation (in magento) to integer and to decimal and re-import every time. Nothing worked. I flushed the cache and storage cache at each step.

Since I don't see the point of importing products in bulk if I have to change each of them manually after, there must be something I miss here.

Thanks

Best Answer

Try to reindex all in admin. Do you have these attribute values for imported products in catalog_product_index_eav, which deals with layered navigation ?

Try to reindex these products via a script:

require_once 'app/Mage.php';
Mage::app('admin');
$id = 1; // Test one product
$product = Mage::getModel(catalog/product);
$product->load($id);
// $product->save(); // Isn't really required.
$product->setForceReindexRequired(true);
Mage::getSingleton('index/indexer')->processEntityAction(
    $product,
    Mage_Catalog_Model_Product::ENTITY,
    Mage_Index_Model_Event::TYPE_SAVE
);