_tableAlias . '2Category4Select'; $data['categories'] = $this->{$method}( ['id', 'categoryId'], '`productId` = ' . (int) $this->getPrimaryKey() ); $taxPercent = (float) App_Settings_Obj::get('orderPriceTax'); if ($data['applyTax'] == 'y' && $taxPercent > 0) { $data['tax'] = Zend_Locale_Math::Div( Zend_Locale_Math::Mul($data['price'], $taxPercent, 4), 100, 4); } return $this; } protected function _filterByCategory(Zend_Db_Select $select, $categoryId) { if (!$categoryId) { return $this; } $subSelect = $this->_db->select(); $subSelect->from( $this->_getPair('Product2Category', 'p2c'), [new Zend_Db_Expr('1')] ); $subSelect->where('`p2c`.`productId` = ' . $this->_quoteField('id')); $subSelect->where('`p2c`.`categoryId` IN(?)', $categoryId, Qs_Db::INT_TYPE); $subSelect->limit(1); $select->where('EXISTS(' . $subSelect . ')'); return $this; } protected function _filter(Zend_Db_Select $select) { if (!$this->hasFilter()) { return $this; } if (!empty($this->_filterFields) && array_key_exists('query', $this->_filter)) { $price = str_replace([',', ' '], '', $this->_filter['query']); if (is_numeric($price)) { $this->_filter['query'] .= ' ' . $price; Qs_Db_Filter::where($select, $this->_filterFields, $this->_filter['query'], 'LIKE', 'OR'); } else { Qs_Db_Filter::where($select, $this->_filterFields, $this->_filter['query']); } } $filter = $this->_getCleanedFilter($this->_filter); Qs_Db::filter($select, $filter, $this->_getTableAlias()); return $this; } public function getListSelect() { if (null === $this->_select) { parent::getListSelect(); $this->_where($this->_select); } return $this->_select; } protected function _where(Zend_Db_Select $select) { return $this; } public function getCategories4Select($fullNames = false) { $categoryObj = new App_ECommerce_Product_Category_Admin_Obj(); return $categoryObj->getCategories4Select($fullNames); } protected function _getCategoriesExpr() { $select = $this->_db->select(); $select->from($this->_getPair($this->_tableAlias . '2Category', 'pc'), 'GROUP_CONCAT(`pc`.`categoryId`)') ->where('`pc`.`productId` = `' . $this->_tableAlias . '`.`id`'); return new Zend_Db_Expr('(' . $select . ')'); } }