예제 #1
0
파일: Node.php 프로젝트: Airmal/Magento-Em
 public function getPath(&$prevNodes = array())
 {
     if ($this->_parent) {
         array_push($prevNodes, $this);
         $this->_parent->getPath($prevNodes);
     }
     return $prevNodes;
 }
 /**
  * Apply event to category
  *
  * @param Varien_Data_Tree_Node|Mage_Catalog_Model_Category $category
  * @param Varien_Data_Collection $eventCollection
  * @return Enterprise_CatalogEvent_Model_Observer
  */
 protected function _applyEventToCategory($category, Varien_Data_Collection $eventCollection)
 {
     foreach (array_reverse($this->_parseCategoryPath($category->getPath())) as $categoryId) {
         // Walk through category path, search event for category
         $event = $eventCollection->getItemByColumnValue('category_id', $categoryId);
         if ($event) {
             $category->setEvent($event);
             return $this;
         }
     }
     return $this;
 }