_select = $this->_getBasicListSelect('*', null, $this->_idPage); $this->_select->where("`{$this->_tableAlias}`.`show` = 'y'"); $this->_select->join( $this->_getPair('Page'), "`Page`.`id` = `{$this->_tableAlias}2Page`.`idPage` AND `Page`.`showSideBlock` = 'y'", ['*', 'id' => $this->_tableAlias . '.id'] ); // переписуємо сортування, якщо часом блоки зловили чужий orderBy з реквеста $this->_select->reset(Zend_Db_Select::ORDER); $this->_select->order("{$this->_tableAlias}2Page.sorter"); return $this->_select; } protected function _prepareList(&$list) { parent::_prepareList($list); if (is_array($list) && !empty($list)) { foreach (array_keys($list) as $k) { if ('page' == $list[$k]['linkType']) { $list[$k]['linkUrl'] = Qs_SiteMap::find(['id' => $list[$k]['linkPageId']], null, null, 'url'); } } } return true; } public function setIdPage($id) { $this->_idPage = $id; return $this; } }