Ejemplo n.º 1
0
 /**
  * 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);
 }
Ejemplo n.º 2
0
 /**
  * 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);
 }