Mage_CatalogIndex_Model_Indexer_Minimalprice Class Reference

Inheritance diagram for Mage_CatalogIndex_Model_Indexer_Minimalprice:

Mage_CatalogIndex_Model_Indexer_Abstract Mage_Core_Model_Abstract Mage_CatalogIndex_Model_Indexer_Interface Varien_Object

List of all members.

Public Member Functions

 getTierPriceAttribute ()
 getPriceAttribute ()
 createIndexData (Mage_Catalog_Model_Product $object, Mage_Eav_Model_Entity_Attribute_Abstract $attribute=null)
 isAttributeIdUsed ()

Protected Member Functions

 _construct ()
 _isAttributeIndexable (Mage_Eav_Model_Entity_Attribute_Abstract $attribute)

Protected Attributes

 $_customerGroups = array()
 $_runOnce = true
 $_processChildren = false


Detailed Description

Catalog indexer price processor

Author:
Magento Core Team <core@magentocommerce.com>

Definition at line 33 of file Minimalprice.php.


Member Function Documentation

_construct (  )  [protected]

Enter description here...

Reimplemented from Varien_Object.

Definition at line 39 of file Minimalprice.php.

00040     {
00041         $this->_init('catalogindex/indexer_minimalprice');
00042         $this->_currencyModel = Mage::getModel('directory/currency');
00043         $this->_customerGroups = Mage::getModel('customer/group')->getCollection();
00044 
00045         return parent::_construct();
00046     }

_isAttributeIndexable ( Mage_Eav_Model_Entity_Attribute_Abstract attribute  )  [protected]

Reimplemented from Mage_CatalogIndex_Model_Indexer_Abstract.

Definition at line 115 of file Minimalprice.php.

00116     {
00117         if ($attribute->getAttributeCode() != 'minimal_price')
00118             return false;
00119 
00120         return true;
00121     }

createIndexData ( Mage_Catalog_Model_Product object,
Mage_Eav_Model_Entity_Attribute_Abstract attribute = null 
)

Implements Mage_CatalogIndex_Model_Indexer_Interface.

Definition at line 68 of file Minimalprice.php.

00069     {
00070         $searchEntityId = $object->getId();
00071         $priceAttributeId = $this->getTierPriceAttribute()->getId();
00072         if ($object->isGrouped()) {
00073             $priceAttributeId = $this->getPriceAttribute()->getId();
00074             $associated = $object->getTypeInstance(true)->getAssociatedProducts($object);
00075             $searchEntityId = array();
00076 
00077             foreach ($associated as $product) {
00078                 $searchEntityId[] = $product->getId();
00079             }
00080         }
00081 
00082         if (!count($searchEntityId)) {
00083             return false;
00084         }
00085 
00086         $result = array();
00087         $data = array();
00088 
00089         $data['store_id'] = $object->getStoreId();
00090         $data['entity_id'] = $object->getId();
00091 
00092         $search['store_id'] = $object->getStoreId();
00093         $search['entity_id'] = $searchEntityId;
00094         $search['attribute_id'] = $priceAttributeId;
00095 
00096         foreach ($this->_customerGroups as $group) {
00097             $search['customer_group_id'] = $group->getId();
00098             $data['customer_group_id'] = $group->getId();
00099 
00100             $value = $this->_getResource()->getMinimalValue($search);
00101             if (is_null($value))
00102                 continue;
00103             $data['value'] = $value;
00104             $result[] = $data;
00105         }
00106 
00107         return $result;
00108     }

getPriceAttribute (  ) 

Definition at line 58 of file Minimalprice.php.

00059     {
00060         $data = $this->getData('price_attribute');
00061         if (is_null($data)) {
00062             $data = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product', 'price');
00063             $this->setData('price_attribute', $data);
00064         }
00065         return $data;
00066     }

getTierPriceAttribute (  ) 

Definition at line 48 of file Minimalprice.php.

00049     {
00050         $data = $this->getData('tier_price_attribute');
00051         if (is_null($data)) {
00052             $data = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product', 'tier_price');
00053             $this->setData('tier_price_attribute', $data);
00054         }
00055         return $data;
00056     }

isAttributeIdUsed (  ) 

Reimplemented from Mage_CatalogIndex_Model_Indexer_Abstract.

Definition at line 110 of file Minimalprice.php.

00111     {
00112         return false;
00113     }


Member Data Documentation

$_customerGroups = array() [protected]

Definition at line 35 of file Minimalprice.php.

$_processChildren = false [protected]

Reimplemented from Mage_CatalogIndex_Model_Indexer_Abstract.

Definition at line 37 of file Minimalprice.php.

$_runOnce = true [protected]

Reimplemented from Mage_CatalogIndex_Model_Indexer_Abstract.

Definition at line 36 of file Minimalprice.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:46 2009 for Magento by  doxygen 1.5.8