/** * 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; }
/** * 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 reports info table * * @return Mage_Paypal_Model_Resource_Report_Settlement_Row_Collection */ protected function _initSelect() { parent::_initSelect(); $this->getSelect()->join(array('report' => $this->getTable('paypal/settlement_report')), 'report.report_id = main_table.report_id', array('report.account_id', 'report.report_date')); return $this; }
/** * Initialize collection select * * @return Mage_XmlConnect_Model_Resource_Queue_Collection */ protected function _initSelect() { parent::_initSelect(); $this->_joinNames(); return $this; }
/** * init select * * @return Mage_Review_Model_Resource_Review_Product_Collection */ protected function _initSelect() { parent::_initSelect(); $this->getSelect()->join(array('detail' => $this->_reviewDetailTable), 'main_table.review_id = detail.review_id', array('detail_id', 'title', 'detail', 'nickname', 'customer_id')); return $this; }
/** * Init collection select * * * @return Mage_SalesRule_Model_Resource_Rule_Collection */ public function _initSelect() { parent::_initSelect(); $this->getSelect()->joinLeft(array('rule_coupons' => $this->getTable('salesrule/coupon')), 'main_table.rule_id = rule_coupons.rule_id AND rule_coupons.is_primary = 1', array('code')); return $this; }
/** * Instantiate select joined to balance * * @return Enterprise_CustomerBalance_Model_Resource_Balance_History_Collection */ protected function _initSelect() { parent::_initSelect(); $this->getSelect()->joinInner(array('b' => $this->getTable('enterprise_customerbalance/balance')), 'main_table.balance_id = b.balance_id', array('customer_id' => 'b.customer_id', 'website_id' => 'b.website_id', 'base_currency_code' => 'b.base_currency_code')); return $this; }
/** * Init collection select * * @return Mage_Api_Model_Resource_Roles_Collection */ protected function _initSelect() { parent::_initSelect(); $this->getSelect()->where('main_table.role_type = ?', Mage_Api_Model_Acl::ROLE_TYPE_GROUP); return $this; }
/** * Init collection select * * @return Mage_GoogleShopping_Model_Resource_Type_Collection */ protected function _initSelect() { parent::_initSelect(); $this->_joinAttributeSet(); return $this; }
/** * Initialize select object * * @return Mage_Eav_Model_Resource_Form_Fieldset_Collection */ protected function _initSelect() { parent::_initSelect(); $select = $this->getSelect(); $select->join(array('default_label' => $this->getTable('eav/form_fieldset_label')), 'main_table.fieldset_id = default_label.fieldset_id AND default_label.store_id = 0', array()); if ($this->getStoreId() == 0) { $select->columns('label', 'default_label'); } else { $labelExpr = $select->getAdapter()->getIfNullSql('store_label.label', 'default_label.label'); $joinCondition = $this->getConnection()->quoteInto('main_table.fieldset_id = store_label.fieldset_id AND store_label.store_id = ?', (int) $this->getStoreId()); $select->joinLeft(array('store_label' => $this->getTable('eav/form_fieldset_label')), $joinCondition, array('label' => $labelExpr)); } return $this; }
/** * Initialize select object * * @return Mage_CatalogInventory_Model_Resource_Stock_Item_Collection */ protected function _initSelect() { return parent::_initSelect()->getSelect()->join(array('cp_table' => $this->getTable('catalog/product')), 'main_table.product_id = cp_table.entity_id', array('type_id')); }
/** * Init select * * @return Mage_Admin_Model_Resource_Roles_Collection */ protected function _initSelect() { parent::_initSelect(); $this->getSelect()->where("main_table.role_type = ?", 'G'); return $this; }
/** * Init collection select * * @return Mage_Api_Model_Resource_Roles_User_Collection */ protected function _initSelect() { parent::_initSelect(); $this->getSelect()->where("user_id > 0"); return $this; }
/** * Add status column based on dates * * @return Enterprise_CatalogEvent_Model_Resource_Event_Collection */ protected function _initSelect() { parent::_initSelect(); $this->getSelect()->columns(array('status' => $this->_getStatusColumnExpr())); return $this; }
/** * Add selected data * * @return Enterprise_Wishlist_Model_Resource_Item_Report_Collection */ protected function _initSelect() { parent::_initSelect(); $select = $this->getSelect(); $select->reset(Zend_Db_Select::COLUMNS)->columns(array('item_qty' => 'qty', 'added_at', 'description', 'product_id')); $adapter = $this->getSelect()->getAdapter(); $defaultWishlistName = Mage::helper('wishlist')->getDefaultWishlistName(); $this->getSelect()->join(array('wishlist_table' => $this->getTable('wishlist/wishlist')), 'main_table.wishlist_id = wishlist_table.wishlist_id', array('visibility' => 'visibility', 'wishlist_name' => $adapter->getIfNullSql('name', $adapter->quote($defaultWishlistName)))); $this->addFilterToMap('wishlist_name', $adapter->getIfNullSql('name', $adapter->quote($defaultWishlistName)))->addFilterToMap('item_qty', 'main_table.qty')->_addCustomerInfo()->_addProductInfo(); return $this; }
/** * init select * * @return Mage_Storelocator_Model_Resource_Storelocator_Product_Collection */ protected function _initSelect() { parent::_initSelect(); return $this; }