We have a store, Magento 1.6 with circa 4500 products. Half of the products approx are having this issue:
Symptoms...
Admin Product Grid -> sort by SKU causes a fatal error.
Admin Product Grid -> searching for some products by sku yields no result (but they are in the grid and have a numeric sku set)
Frontend -> the products look and work fine, but cannot be found by searching the sku
Edit...
It seems that the products that are not working dont have an entry in: catalog_product_entity_varchar
If I edit a product, change the sku, save, then re-edit and restore the original sku its all back to normal and working again. dont want to do that 2500+ times. Do you think I can programatically rebuild the missing sku entries in catalog_product_entity_varchar ? is there a better route?
Looking in the category_product_flat tables, the sku field for the broken products is set to null. Why would the sku data not carry over from the main catalog_product_entity table?
any help or pointers greatly appreciated, im out of ideas!
Final Edit....
I wrote a simple script that went through each product, looked for a matching sku entry in the _entity_varchar table, and if one did not ecist it inserted a row. Then I ran the indexing process fully and the problem seems to be resolved. Searching for those skus in the frontend and backend is now working as expected, and the flat tables have sku values.
Something went wrong, but hopefully its ok now.