/** * Perform operations after collection load * * @return ADM_Warehouse_Model_CatalogInventory_Resource_Stock_Collection */ protected function _afterLoad() { if ($this->_previewFlag) { $items = $this->getColumnValues('stock_id'); $connection = $this->getConnection(); if (count($items)) { $select = $connection->select()->from(array('wss' => $this->getTable('adm_warehouse/stock_website')))->where('wss.stock_id IN (?)', $items); if ($result = $connection->fetchPairs($select)) { foreach ($this as $item) { if (!isset($result[$item->getData('stock_id')])) { continue; } if ($result[$item->getData('stock_id')] == 0) { $websites = Mage::app()->getWebsites(false, true); $websiteId = current($websites)->getId(); $websiteCode = key($websites); } else { $websiteId = $result[$item->getData('stock_id')]; $websiteCode = Mage::app()->getWebsite($websiteId)->getCode(); } $item->setData('_first_website_id', $websiteId); $item->setData('website_code', $websiteCode); } } } } return parent::_afterLoad(); }
/** * Unserialize additional_information in each item * * @return Mage_Core_Model_Resource_Db_Collection_Abstract */ protected function _afterLoad() { foreach ($this->_items as $item) { $this->getResource()->unserializeFields($item); } return parent::_afterLoad(); }
/** * Call afterLoad method for each item * * @return Enterprise_ImportExport_Model_Resource_Scheduled_Operation_Collection */ protected function _afterLoad() { foreach ($this->_items as $item) { $item->afterLoad(); } return parent::_afterLoad(); }
protected function _afterLoad() { parent::_afterLoad(); foreach ($this->_items as $item) { /** @var Firegento_FlexCms_Model_Content $item */ $item->afterLoad(); } }
/** * After load processing * * @return Enterprise_GiftRegistry_Model_Resource_Item_Collection */ protected function _afterLoad() { parent::_afterLoad(); // Assign options and products $this->_assignOptions(); $this->_assignProducts(); $this->resetItemsDataChanged(); return $this; }
/** * join content from firegento_flexcms/content 1:1 */ protected function _afterLoad() { parent::_afterLoad(); foreach ($this->_items as $item) { /** @var Firegento_FlexCms_Model_Content_Link $item */ $item->setStoreId($this->_storeId); $item->addData($item->getContentModel()->getData()); } }
/** * Add stores column * * @return Enterprise_Banner_Model_Resource_Banner_Collection */ protected function _afterLoad() { parent::_afterLoad(); if ($this->getFlag('add_stores_column')) { $this->_addStoresVisibility(); } $this->walk('getTypes'); // fetch banner types from comma-separated return $this; }
protected function _afterLoad() { parent::_afterLoad(); // inject campaign if available if ($this->_campaign) { /* @var $recipient Mzax_Emarketing_Model_Recipient */ foreach ($this as $recipient) { $recipient->setCampaign($this->_campaign); } } }
/** * Add website ids to rules data * * @return Mage_Rule_Model_Resource_Rule_Collection_Abstract */ protected function _afterLoad() { parent::_afterLoad(); if ($this->getFlag('add_websites_to_result') && $this->_items) { /** @var Mage_Rule_Model_Abstract $item */ foreach ($this->_items as $item) { $item->afterLoad(); } } return $this; }
protected function _afterLoad() { $localAttributes = array('label', 'position', 'disabled'); foreach ($this->getItems() as $image) { foreach ($localAttributes as $localAttribute) { if (is_null($image[$localAttribute])) { $image[$localAttribute] = $this->_getDefaultValue($localAttribute, $image); } } } return parent::_afterLoad(); }
/** * Unserialize additional_information in each item * * @return Mage_Core_Model_Resource_Db_Collection_Abstract */ protected function _afterLoad() { foreach ($this->_items as $item) { $this->getResource()->unserializeFields($item); } /** @var Mage_Sales_Model_Quote_Payment $item */ foreach ($this->_items as $item) { foreach ($item->getData() as $fieldName => $fieldValue) { $item->setData($fieldName, Mage::getSingleton('Mage_Sales_Model_Payment_Method_Converter')->decode($item, $fieldName)); } } return parent::_afterLoad(); }
/** * Set parent items * * @return Mage_Sales_Model_Resource_Quote_Address_Item_Collection */ protected function _afterLoad() { parent::_afterLoad(); /** * Assign parent items */ foreach ($this as $item) { if ($item->getParentItemId()) { $item->setParentItem($this->getItemById($item->getParentItemId())); } } return $this; }
/** * Perform operations after collection load * * @return Demac_MultiLocationInventory_Model_Resource_Location_Collection * */ protected function _afterLoad() { $items = $this->getColumnValues('id'); $connection = $this->getConnection(); if (count($items)) { $select = $connection->select()->from(array('demac_multilocationinventory_stores' => $this->getTable('demac_multilocationinventory/stores')))->where('demac_multilocationinventory_stores.location_id IN (?)', $items); if ($result = $connection->fetchPairs($select)) { foreach ($this as $item) { $stores = $this->lookupStoreIds($item->getId()); $item->setData('store_id', $stores); } } } return parent::_afterLoad(); }
/** * Redeclare after load method to add website IDs to items * * @return Enterprise_GiftWrapping_Model_Resource_Wrapping_Collection */ protected function _afterLoad() { parent::_afterLoad(); if ($this->getFlag('add_websites_to_result') && $this->_items) { $select = $this->getConnection()->select()->from($this->getTable('enterprise_giftwrapping/website'), array('wrapping_id', 'website_id'))->where('wrapping_id IN (?)', array_keys($this->_items)); $websites = $this->getConnection()->fetchAll($select); foreach ($this->_items as $item) { $websiteIds = array(); foreach ($websites as $website) { if ($item->getId() == $website['wrapping_id']) { $websiteIds[] = $website['website_id']; } } if (count($websiteIds)) { $item->setWebsiteIds($websiteIds); } } } return $this; }
/** * Fill array of options by item and product * * @return Mage_Wishlist_Model_Resource_Item_Option_Collection */ protected function _afterLoad() { parent::_afterLoad(); foreach ($this as $option) { $optionId = $option->getId(); $itemId = $option->getWishlistItemId(); $productId = $option->getProductId(); if (isset($this->_optionsByItem[$itemId])) { $this->_optionsByItem[$itemId][] = $optionId; } else { $this->_optionsByItem[$itemId] = array($optionId); } if (isset($this->_optionsByProduct[$productId])) { $this->_optionsByProduct[$productId][] = $optionId; } else { $this->_optionsByProduct[$productId] = array($optionId); } } return $this; }
protected function _afterLoad() { parent::_afterLoad(); $prevItem = null; foreach ($this->getItems() as $item) { if (null === $prevItem) { $prevItem = $item; } else { $move = $prevItem->getQty() - $item->getQty(); if ($move > 0) { $move = '+' . $move; } $prevItem->setMove($move); $prevItem = $item; } } if ($prevItem) { $prevItem->setMove('-'); } return $this; }
/** * Redeclare after load method for dispatch event * * @return Mage_Sales_Model_Resource_Quote_Address_Collection */ protected function _afterLoad() { parent::_afterLoad(); Mage::dispatchEvent($this->_eventPrefix . '_load_after', array($this->_eventObject => $this)); return $this; }
protected function _afterLoad() { # clear group_by title if ($this->_filterData->getGroupBy()) { $items = array(); foreach ($this->_items as $item) { if (!$item->getParent()) { foreach ($this->_items as $subitem) { if ($item != $subitem && $item->getData('group_by') == $subitem->getData('group_by')) { $subitem->setData('group_by', ''); } } } } } return parent::_afterLoad(); }
/** * Check for assigments after load * * @see Mage_Core_Model_Resource_Db_Collection_Abstract::_afterLoad() */ protected function _afterLoad() { parent::_afterLoad(); if ($this->getFlag('assign_campaigns')) { $this->assignCampaigns(); } if ($this->getFlag('assign_recipients')) { $this->assignCampaigns(); } }
/** * Override _afterLoad() implementation * * @return Enterprise_CatalogEvent_Model_Resource_Event_Collection */ protected function _afterLoad() { $events = parent::_afterLoad(); foreach ($events->_items as $event) { if ($this->_skipClosed && $event->getStatus() == Enterprise_CatalogEvent_Model_Event::STATUS_CLOSED) { $this->removeItemByKey($event->getId()); } } return $this; }
/** * After loading a collection, dispatch the pre-set event * * @return $this */ protected function _afterLoad() { if ($this->getFlag('after_load_event_name')) { Mage::dispatchEvent($this->getFlag('after_load_event_name'), array('collection' => $this, 'wrapper_block' => $this->getFlag('after_load_event_block'))); } return parent::_afterLoad(); }
/** * Implement after load logic for each collection item * * @return Enterprise_CustomerBalance_Model_Resource_Balance_Collection */ protected function _afterLoad() { parent::_afterLoad(); $this->walk('afterLoad'); return $this; }
/** * After load processing * * @return Mage_Sales_Model_Resource_Quote_Item_Collection */ protected function _afterLoad() { parent::_afterLoad(); /** * Assign parent items */ foreach ($this as $item) { if ($item->getParentItemId()) { $item->setParentItem($this->getItemById($item->getParentItemId())); } if ($this->_quote) { $item->setQuote($this->_quote); } } /** * Assign options and products */ $this->_assignOptions(); $this->_assignProducts(); $this->resetItemsDataChanged(); return $this; }
protected function _afterLoad() { parent::_afterLoad(); $this->_updateReminders(); return $this; }
/** * Add product info to collection */ protected function _afterLoad() { parent::_afterLoad(); foreach ($this->_items as $item) { /* @var $item Mage_Model_Wishlist_Item $item*/ $product = $item->getProduct(); $item->setProductName($product->getName()); $item->setProductPrice($product->getPrice()); $item->setProductSku($product->getSku()); } }
/** * After load processing * * @return Mage_Wishlist_Model_Resource_Item_Collection */ protected function _afterLoad() { parent::_afterLoad(); /** * Assign products */ $this->_assignOptions(); $this->_assignProducts(); $this->resetItemsDataChanged(); $this->getPageSize(); return $this; }
/** * Bypass parent _afterLoad() -- parent depends on single product context * * @return $this */ protected function _afterLoad() { Mage_Core_Model_Resource_Db_Collection_Abstract::_afterLoad(); $this->_loadOptionLabels(); return $this; }
/** * After load collection process * * @return Mage_Catalog_Model_Resource_Product_Type_Configurable_Attribute_Collection */ protected function _afterLoad() { parent::_afterLoad(); Varien_Profiler::start('TTT1:' . __METHOD__); $this->_addProductAttributes(); Varien_Profiler::stop('TTT1:' . __METHOD__); Varien_Profiler::start('TTT2:' . __METHOD__); $this->_addAssociatedProductFilters(); Varien_Profiler::stop('TTT2:' . __METHOD__); Varien_Profiler::start('TTT3:' . __METHOD__); $this->_loadLabels(); Varien_Profiler::stop('TTT3:' . __METHOD__); Varien_Profiler::start('TTT4:' . __METHOD__); $this->_loadPrices(); Varien_Profiler::stop('TTT4:' . __METHOD__); return $this; }
/** * After load collection process * * @return Mage_Catalog_Model_Resource_Product_Type_Configurable_Attribute_Collection */ protected function _afterLoad() { parent::_afterLoad(); Magento_Profiler::start('TTT1:' . __METHOD__, array('group' => 'TTT1', 'method' => __METHOD__)); $this->_addProductAttributes(); Magento_Profiler::stop('TTT1:' . __METHOD__); Magento_Profiler::start('TTT2:' . __METHOD__, array('group' => 'TTT2', 'method' => __METHOD__)); $this->_addAssociatedProductFilters(); Magento_Profiler::stop('TTT2:' . __METHOD__); Magento_Profiler::start('TTT3:' . __METHOD__, array('group' => 'TTT3', 'method' => __METHOD__)); $this->_loadLabels(); Magento_Profiler::stop('TTT3:' . __METHOD__); Magento_Profiler::start('TTT4:' . __METHOD__, array('group' => 'TTT4', 'method' => __METHOD__)); $this->_loadPrices(); Magento_Profiler::stop('TTT4:' . __METHOD__); return $this; }