00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 class Mage_CatalogIndex_Model_Price extends Mage_Core_Model_Abstract
00034 {
00035 protected function _construct()
00036 {
00037 $this->_init('catalogindex/price');
00038 $this->_getResource()->setStoreId(Mage::app()->getStore()->getId());
00039 $this->_getResource()->setRate(Mage::app()->getStore()->getCurrentCurrencyRate());
00040 $this->_getResource()->setCustomerGroupId(Mage::getSingleton('customer/session')->getCustomerGroupId());
00041 }
00042
00043 public function getMaxValue($attribute, $entityIdsFilter)
00044 {
00045 return $this->_getResource()->getMaxValue($attribute, $entityIdsFilter);
00046 }
00047
00048 public function getCount($attribute, $range, $entitySelect)
00049 {
00050 return $this->_getResource()->getCount($range, $attribute, $entitySelect);
00051 }
00052
00053 public function getFilteredEntities($attribute, $range, $index, $entityIdsFilter)
00054 {
00055 return $this->_getResource()->getFilteredEntities($range, $index, $attribute, $entityIdsFilter);
00056 }
00057
00058 public function applyFilterToCollection($collection, $attribute, $range, $index)
00059 {
00060 return $this->_getResource()->applyFilterToCollection($collection, $attribute, $range, $index);
00061 }
00062
00063 public function addMinimalPrices(Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection)
00064 {
00065 $minimalPrices = $this->_getResource()->getMinimalPrices($collection->getLoadedIds());
00066
00067 foreach ($minimalPrices as $row) {
00068 $item = $collection->getItemById($row['entity_id']);
00069 if ($item) {
00070 $item->setData('minimal_price', $row['value']);
00071 $item->setData('minimal_tax_class_id', $row['tax_class_id']);
00072 }
00073 }
00074 }
00075 }