3

Is the more native way of adding parent filter on a category collection other than a direct where showcased below?

/** @var Mage_Catalog_Model_Resource_Category_Collection $categoryCollection */
$categoryCollection = Mage::getResourceModel('catalog/category_collection');
$categoryCollection->getSelect()->where('e.parent_id = ' . $parentId);
1

Sound too easy, but isn't it same as :)

$categoryCollection = Mage::getResourceModel('catalog/category_collection');
$categoryCollection->addFieldToFilter('parent_id', $parentId);
  • @TimBezhashvyly Yes, of course :) – sv3n Feb 4 '18 at 17:56
  • @TimBezhashvyly I also checked if something changed from 1.9.2.4 to 1.9.3.x ... but no, this should work with 1.9.2 too. – sv3n Feb 5 '18 at 13:44

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.