When you call Mage::getModel('catalog/category') or Mage::getModel('catalog/product'), does that load from the flat data or the _entity table?
There is an option in the admin that let you "use flat" data, and I'm wondering if this is related to the ::getModel() call.
The catalog/category model is an EAV model. In a default Magento configuration, its data is stored in
catalog_category_entity
catalog_category_entity_datetime
catalog_category_entity_decimal
catalog_category_entity_int
catalog_category_entity_text
catalog_category_entity_varchar
The catalog/category model also has a "flat catalog" feature in System -> Configuration -> Catalog -> Use Flat Catalog Category. With this enabled the catalog/category model will pull data from one of the flat categories
catalog_category_flat_store_*
Either way, you can use the catalog/category collection object to query this data any way you see fit, including the addAttributeToFilter method.
$collection = Mage::getModel('catalog/category')
->getCollection()
->addAttributeToSelect('*');
$collection->addAttributeToFilter(
'url_path', array('like' => 'apparel%')
);
foreach($collection as $item)
{
var_dump($item->getData());
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With