I'm having a strange issue with my
url_key field reverting to
NULL on my
catalog_category_flat_store_1 table following a reindex, but only on categories that I have created since enabling the Flat Category index.
As a result, when I attempt to fetch the category via
url_key as so:
$category = Mage::getModel('catalog/category') ->getCollection() ->addAttributeToFilter('url_key', 'my-url-key') ->getFirstItem(); $category->load($category->getId());
I am unable to do so. If I go back and re-save the category, the url_key is added back to the flat table and I'm able to retrieve the category.
Has anyone else had this problem or am I missing something regarding the way flat tables operate?
What I've Found/Tried
Because the value would initially save and then disappear, I examined the catalog_category_entity files. Here's what I found:
url_keyvalue is saving properly in
- However, neither the
url_pathattributes are saving in
catalog_category_entity_varcharas they were with categories that I created before enabling Flat tables.
- If I manually add the
catalog_category_entity_varchar, values are preserved and copied to
catalog_category_flat_store_1as expected when reindexing.
I have tried disabling the flat tables and while the
url_key value is still not saved to catalog_category_entity_varchar, I am able to category via the url_key using my code above.
FWIW, I'm using Enterprise 1.13.
I used MAGMI to import my products/categories; because CE uses
varchar attributes rather than a separate table as the newer versions of enterprise do, this may be a non-issue. I created a fresh install of Enterprise and added the categories manually. I'm noticing that the
url_path fields are not copied over to the flat tables anyway.