Skip to content

Commit

Permalink
[bug-OpenMage#884] Add missing methods to category collection class
Browse files Browse the repository at this point in the history
These two methods exist on Mage_Catalog_Model_Resource_Category_Flat_Collection
but not on Mage_Catalog_Model_Resource_Category_Collection so if flat categories
is enabled but they are being temporarily rebuilt and any frontend code relies
on these methods, calls to these methods will generate PHP errors since the
flat collection and eav collection classes expose a different set of methods
on the public API.
  • Loading branch information
colinmollenhour authored and edannenberg committed Aug 24, 2020
1 parent 5807e64 commit ee085b3
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions app/code/core/Mage/Catalog/Model/Resource/Category/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down

0 comments on commit ee085b3

Please sign in to comment.