/** * Retrieve Tagged Products * * @param Mage_Tag_Model_Tag_Relation $model * @return array */ public function getProductIds($model) { $select = $this->_getReadAdapter()->select()->from($this->getMainTable(), 'product_id')->where("tag_id=?", $model->getTagId())->where('customer_id=?', $model->getCustomerId())->where('active=1'); if ($model->hasStoreId()) { $select->where('store_id = ?', $model->getStoreId()); } return $this->_getReadAdapter()->fetchCol($select); }
/** * Retrieve Tagged Products * * @param Mage_Tag_Model_Tag_Relation $model * @return array */ public function getProductIds($model) { $select = $this->_getReadAdapter()->select()->from($this->getMainTable(), 'product_id')->where("{$this->getMainTable()}.tag_id=?", $model->getTagId()); if (!is_null($model->getCustomerId())) { $select->where("{$this->getMainTable()}.customer_id=?", $model->getCustomerId()); } if ($model->hasStoreId()) { $select->where("{$this->getMainTable()}.store_id = ?", $model->getStoreId()); } if (!is_null($model->getStatusFilter())) { $select->join($this->getTable('tag/tag'), "{$this->getTable('tag/tag')}.tag_id = {$this->getMainTable()}.tag_id")->where("{$this->getTable('tag/tag')}.status = ?", $model->getStatusFilter()); } return $this->_getReadAdapter()->fetchCol($select); }
/** * Retrieve Tagged Products * * @param Mage_Tag_Model_Tag_Relation $model * @return array */ public function getProductIds($model) { $bind = array('tag_id' => $model->getTagId()); $select = $this->_getReadAdapter()->select()->from($this->getMainTable(), 'product_id')->where($this->getMainTable() . '.tag_id=:tag_id'); if (!is_null($model->getCustomerId())) { $select->where($this->getMainTable() . '.customer_id= :customer_id'); $bind['customer_id'] = $model->getCustomerId(); } if ($model->hasStoreId()) { $select->where($this->getMainTable() . '.store_id = :store_id'); $bind['store_id'] = $model->getStoreId(); } if (!is_null($model->getStatusFilter())) { $select->join($this->getTable('tag/tag'), $this->getTable('tag/tag') . '.tag_id = ' . $this->getMainTable() . '.tag_id')->where($this->getTable('tag/tag') . '.status = :t_status'); $bind['t_status'] = $model->getStatusFilter(); } return $this->_getReadAdapter()->fetchCol($select, $bind); }