diff --git a/app/code/core/Mage/Catalog/Model/Resource/Category/Collection.php b/app/code/core/Mage/Catalog/Model/Resource/Category/Collection.php index b800f0d61cd..83ff7a38b88 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Category/Collection.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Category/Collection.php @@ -362,6 +362,29 @@ protected function _getCurrentStoreId() return (int)Mage::app()->getStore()->getId(); } + /** + * Add filter by path to collection + * + * @param string $parent + * @return $this + */ + public function addParentPathFilter($parent) + { + $this->addFieldToFilter('path', array('like' => "{$parent}/%")); + return $this; + } + + /** + * Add store filter + * + * @return $this + */ + public function addStoreFilter() + { + $this->setProductStoreId($this->getStoreId()); + return $this; + } + /** * Add active category filter *