_getInCartExpr(); return $columns; } protected function _getInCartExpr() { $select = $this->_db->select(); $select->from($this->_getPair('CartItem'), new Zend_Db_Expr('1')) ->where('`cartId` = ?', $this->_getCart()->getCartId()) ->where('`productCategoryId` = `' . $this->_getTableAlias() . '`.`id`') ->where('`cartItemType` = ?', CartItemObj::ITEM_TYPE) ->limit(1); return new Zend_Db_Expr('(' . $select . ')'); } protected function _filter(Zend_Db_Select $select) { $this->_filterEnabled($select); $this->_filterLimit($select); return parent::_filter($select); } protected function _filterLimit(Zend_Db_Select $select) { $sub = $this->_db->select(); $sub->from($this->_getPair('SponsorshipSubmission', 'ss'), 'COUNT(*)'); $sub->where('`ss`.`categoryId` = ' . $this->_quoteField('id')); $select->where('IFNULL(' . $this->_quoteField('limit') . ', ~0 >> 32) > (' . $sub . ')'); return $this; } public function getList4Select() { $select = $this->_db->select(); $select->from($this->_getPair(), ['id', 'title', 'price']); $select->order('sorter ASC'); $this->_filter($select); $list = []; $categories = $this->_db->fetchAll($select); if (!empty($categories)) { foreach ($categories as $category) { $list[$category['id']] = $category['title'] . ' ($' . number_format($category['price'], 2, '.', ',') . ')'; } } return $list; } }