/**
  * Retrieve a collection of products associated with the splash page
  *
  * @return Mage_Catalog_Model_Resource_Eav_Resource_Product_Collection
  */
 public function getProductCollection(Fishpig_AttributeSplash_Model_Page $page)
 {
     $collection = Mage::getResourceModel('catalog/product_collection')->setStoreId($page->getStoreId());
     $alias = $page->getAttributeCode() . '_index';
     $collection->getSelect()->join(array($alias => $this->getTable('catalog/product_index_eav')), "`{$alias}`.`entity_id` = `e`.`entity_id`" . $this->_getReadAdapter()->quoteInto(" AND `{$alias}`.`attribute_id` = ? ", $page->getAttributeId()) . $this->_getReadAdapter()->quoteInto(" AND `{$alias}`.`store_id` = ? ", $page->getStoreId()) . $this->_getReadAdapter()->quoteInto(" AND `{$alias}`.`value` = ?", $page->getOptionId()), '');
     return $collection;
 }
Exemple #2
0
 /**
  * Retrieve a collection of products associated with the splash page
  *
  * @return Mage_Catalog_Model_Resource_Eav_Resource_Product_Collection
  */
 public function getProductCollection(Fishpig_AttributeSplash_Model_Page $page)
 {
     $collection = Mage::getResourceModel('catalog/product_collection')->setStoreId($page->getStoreId())->addAttributeToFilter('status', 1)->addAttributeToFilter('visibility', array('in' => array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)));
     $alias = $page->getAttributeCode() . '_index';
     $collection->getSelect()->join(array($alias => $this->getTable('catalog/product_index_eav')), "`{$alias}`.`entity_id` = `e`.`entity_id`" . $this->_getReadAdapter()->quoteInto(" AND `{$alias}`.`attribute_id` = ? ", $page->getAttributeId()) . $this->_getReadAdapter()->quoteInto(" AND `{$alias}`.`store_id` = ? ", $page->getStoreId()) . $this->_getReadAdapter()->quoteInto(" AND `{$alias}`.`value` = ?", $page->getOptionId()), '');
     if (!Mage::getStoreConfigFlag('cataloginventory/options/show_out_of_stock', $page->getStoreId())) {
         Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($collection);
     }
     return $collection;
 }