/**
  * 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;
 }
 /**
  * Verify that the passed in track number is in the collections of Magento shipment tracks, otherwise logs warning message.
  * @param  Varien_Data_Collection $tracks
  * @param  OrderEvents\ITrackingNumber $trackingNumber
  * @return self
  */
 protected function _verifyTrack(Varien_Data_Collection $tracks, OrderEvents\ITrackingNumber $trackingNumber)
 {
     $number = $trackingNumber->getTrackingNumber();
     $track = $tracks->getItemByColumnValue('track_number', $number);
     if (is_null($track)) {
         $logMessage = "Magento did not add an expected-to-be-shipped Track number ({$number}) to the shipment.";
         $this->_logger->warning($logMessage, $this->_context->getMetaData(__CLASS__));
     }
     return $this;
 }
 /**
  * Append a new quantity index to the passed in 'qtys' array when a match Magento
  * order item is found in the pass in items collection.
  * @param  OrderEvents\IOrderItem $orderItem
  * @param  Varien_Data_Collection $items
  * @param  array $qtys
  * @return self
  */
 protected function _appendToQtyArray(OrderEvents\IOrderItem $orderItem, Varien_Data_Collection $items, array $qtys)
 {
     $item = $items->getItemByColumnValue('sku', $orderItem->getItemId());
     if ($item) {
         // Magento only support integer quantity
         $qtys[$item->getItemId()] = (int) $orderItem->getQuantity();
     }
     return $qtys;
 }