/** * Join store relation table data if store filter is used * * @return Scandi_MenuManager_Model_Resource_Menu_Collection */ protected function _renderFiltersBefore() { if ($this->getFilter('store_id')) { $this->getSelect()->join(array('store_table' => $this->getTable('scandi_menumanager/menu_store')), 'main_table.menu_id = store_table.menu_id', array())->group('main_table.menu_id'); } return parent::_renderFiltersBefore(); }
/** * Join store relation table if there is store filter */ protected function _renderFiltersBefore() { if ($this->getFilter('store')) { $this->getSelect()->join(array('store_table' => $this->getTable('mgs_storelocator/storelocator_store')), 'main_table.storelocator_id = store_table.storelocator_id', array()); } return parent::_renderFiltersBefore(); }
/** * Don't add item to the collection if only fixed are allowed and its carrier is not fixed * * @param Mage_Sales_Model_Quote_Address_Rate $rate * @return Mage_Sales_Model_Resource_Quote_Address_Rate_Collection */ public function addItem(Varien_Object $rate) { if ($this->_allowFixedOnly && (!$rate->getCarrierInstance() || !$rate->getCarrierInstance()->isFixed())) { return $this; } return parent::addItem($rate); }
/** * 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(); }
/** * 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(); }
/** * Collection constructor * * @param Mage_Core_Model_Resource_Db_Abstract $resource * @param array $data * @throws InvalidArgumentException */ public function __construct($resource = null, $data = array()) { $this->_app = isset($data['app']) ? $data['app'] : Mage::app(); if (!$this->_app instanceof Mage_Core_Model_App) { throw new InvalidArgumentException('Required app object is invalid'); } parent::__construct($resource); }
/** * Initialize select object * * @return Mage_Directory_Model_Resource_Region_Collection */ protected function _initSelect() { parent::_initSelect(); $locale = Mage::app()->getLocale()->getLocaleCode(); $this->addBindParam(':region_locale', $locale); $this->getSelect()->joinLeft(array('rname' => $this->_regionNameTable), 'main_table.region_id = rname.region_id AND rname.locale = :region_locale', array('name')); return $this; }
/** * Redefine default filters * * @param string $field * @param mixed $condition * @return Varien_Data_Collection_Db */ public function addFieldToFilter($field, $condition = null) { if ($field == 'stores') { return $this->addStoreFilter($condition); } else { return parent::addFieldToFilter($field, $condition); } }
/** * Loads collection * * @param bool $printQuery * @param bool $logQuery * @return Mage_Tag_Model_Resource_Popular_Collection */ public function load($printQuery = false, $logQuery = false) { if ($this->isLoaded()) { return $this; } parent::load($printQuery, $logQuery); return $this; }
protected function _afterLoad() { parent::_afterLoad(); foreach ($this->_items as $item) { /** @var Firegento_FlexCms_Model_Content $item */ $item->afterLoad(); } }
/** * Initialize select, add country iso3 code and region name * * @return void */ public function _initSelect() { parent::_initSelect(); $this->_select->joinLeft(array('country_table' => $this->_countryTable), 'country_table.country_id = main_table.dest_country_id', array('dest_country' => 'iso3_code'))->joinLeft(array('region_table' => $this->_regionTable), 'region_table.region_id = main_table.dest_region_id', array('dest_region' => 'code')); $this->addOrder('dest_country', self::SORT_ORDER_ASC); $this->addOrder('dest_region', self::SORT_ORDER_ASC); $this->addOrder('dest_zip', self::SORT_ORDER_ASC); $this->addOrder('condition_value', self::SORT_ORDER_ASC); }
/** * 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()); } }
/** * @return $this */ protected function _afterLoadData() { foreach ($this->_data as $data) { if (isset($data['additional']) && strlen($data['additional'])) { $data['additional'] = Mage::helper('core')->jsonDecode($data['additional']); } } parent::_afterLoadData(); }
protected function _renderFilters() { if ($this->_isFiltersRendered) { return $this; } parent::_renderFilters(); $this->_select->where('is_removed = 0'); return $this; }
/** * 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; }
/** * Add field filter to collection * * @see self::_getConditionSql for $condition * @param string $field * @param null|string|array $condition * @return Mage_Eav_Model_Entity_Collection_Abstract */ public function addFieldToFilter($field, $condition = null) { if ($field == 'name') { $conditionSql = $this->_getConditionSql($this->getConnection()->getIfNullSql('p.value', 'p_d.value'), $condition); $this->getSelect()->where($conditionSql, null, Varien_Db_Select::TYPE_CONDITION); return $this; } else { return parent::addFieldToFilter($field, $condition); } }
/** * 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 _construct() { parent::_construct(); /** * Tell Magento the Model and Resource Model to use for this * Collection. Since both aliases are the same we can ommit * the second paramater if we wished. */ $this->_init('abhishek_mymodule/staff', 'abhishek_mymodule/staff'); }
protected function _construct() { parent::_construct(); /** * Tell Magento the Model and Resource Model to use for this * Collection. Since both aliases are the same we can ommit * the second paramater if we wished. */ $this->_init('smashingmagazine_branddirectory/brand', 'smashingmagazine_branddirectory/brand'); }
protected function _construct() { parent::_construct(); /** * Tell Magento the Model and Resource Model to use for this * Collection. Since both aliases are the same we can ommit * the second paramater if we wished. */ $this->_init('infobitsolutions_managevendor/mapping', 'infobitsolutions_managevendor/mapping'); }
protected function _construct() { parent::_construct(); /** * Tell Magento the Model and Resource Model to use for this * Collection. Since both aliases are the same we can ommit * the second paramater if we wished. */ $this->_init('bhargav_accordion/accordion', 'bhargav_accordion/accordion'); }
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); } } }
/** * Load collection data * * @param bool $printQuery * @param bool $logQuery * @return Weboffice_GoogleShoppingApi_Model_Mysql4_Attribute_Collection */ public function load($printQuery = false, $logQuery = false) { if ($this->isLoaded()) { return $this; } if ($this->getJoinAttributeSetFlag()) { $this->_joinAttributeSet(); } parent::load($printQuery, $logQuery); return $this; }
/** * Join store relation table if there is store filter */ protected function _renderFiltersBefore() { if ($this->getFilter('store')) { $this->getSelect()->join(array('store_table' => $this->getTable('antoinek_slider/slider_store')), 'main_table.slider_id = store_table.slider_id', array())->group('main_table.slider_id'); /* * Allow analytic functions usage because of one field grouping */ $this->_useAnalyticFunction = true; } return parent::_renderFiltersBefore(); }
/** * Join store relation table if there is store filter * * @return NULL */ protected function _renderFiltersBefore() { if ($this->getFilter('store_id')) { $this->getSelect()->join(array('demac_multilocationinventory_stores' => $this->getTable('demac_multilocationinventory/stores')), 'main_table.id = demac_multilocationinventory_stores.location_id', array())->group('main_table.id'); /* * Allow analytic functions usage because of one field grouping */ $this->_useAnalyticFunction = true; } return parent::_renderFiltersBefore(); }
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(); }
/** * Account for group and having clauses, if any * * @return array */ public function getAllIds() { if (!$this->_interferWithCountSql) { return parent::getAllIds(); } $idsSelect = clone $this->getSelect(); $idsSelect->reset(Zend_Db_Select::ORDER); $idsSelect->reset(Zend_Db_Select::LIMIT_COUNT); $idsSelect->reset(Zend_Db_Select::LIMIT_OFFSET); //$idsSelect->reset(Zend_Db_Select::COLUMNS); $idsSelect->columns($this->getResource()->getIdFieldName(), 'main_table'); return $this->getConnection()->fetchCol($idsSelect); }
/** * 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; }
public function addFieldToFilter($field, $condition = null) { if ($field == 'receipient') { $correspondents = Mage::getModel('alekseon_mailTransport/sentEmail_correspondent')->getCollection()->addFieldToFilter('type', Alekseon_MailTransport_Model_SentEmail_Correspondent::TYPE_RECEIPIENT)->addFieldToFilter(array('name', 'email'), array($condition, $condition)); $sentEmailsIds = array(); foreach ($correspondents as $correspondent) { $sentEmailsIds[] = $correspondent->getSentemailId(); } $field = $this->getResource()->getIdFieldName(); $condition = array('in' => $sentEmailsIds); } return parent::addFieldToFilter($field, $condition); }
/** * 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(); }