
Public Member Functions | |
| getChildProductIds ($store, $parentIds) | |
| getParentProductIds ($store, $childIds) | |
| getFinalPrice ($product, $store, $group) | |
| getMinimalPrice ($products, $store) | |
| getTaxClassId ($productId, $store) | |
| getTierPrices ($products, $store) | |
| getAttributeData ($products, $attributes, $store) | |
| getTypeCode () | |
| areChildrenIndexable ($type) | |
| getTypeInstance () | |
Public Attributes | |
| const | LINK_GET_CHILDREN = 1 |
| const | LINK_GET_PARENTS = 1 |
Protected Member Functions | |
| _construct () | |
| fetchLinkInformation ($store, $settings, $type, $suppliedId) | |
| _getLinkSettings () | |
Protected Attributes | |
| $_typeInstance | |
| $_haveChildren | |
| $_haveParents = true | |
Definition at line 35 of file Abstract.php.
| _construct | ( | ) | [protected] |
Initialize abstract resource model
Reimplemented from Varien_Object.
Reimplemented in Mage_CatalogIndex_Model_Data_Configurable, and Mage_CatalogIndex_Model_Data_Grouped.
Definition at line 69 of file Abstract.php.
00070 { 00071 $this->_init('catalogindex/data_abstract'); 00072 }
| _getLinkSettings | ( | ) | [protected] |
Get child link table and field settings
Reimplemented in Mage_Bundle_Model_CatalogIndex_Data_Bundle, Mage_CatalogIndex_Model_Data_Configurable, and Mage_CatalogIndex_Model_Data_Grouped.
Definition at line 269 of file Abstract.php.
| areChildrenIndexable | ( | $ | type | ) |
Returns if type supports children of the specified type
| int | $type |
Definition at line 280 of file Abstract.php.
00281 { 00282 if (!$this->_haveChildren || !isset($this->_haveChildren[$type]) || !$this->_haveChildren[$type]) { 00283 return false; 00284 } 00285 return true; 00286 }
| fetchLinkInformation | ( | $ | store, | |
| $ | settings, | |||
| $ | type, | |||
| $ | suppliedId | |||
| ) | [protected] |
Returns an array of product children/parents
| Mage_Core_Model_Store | $store | |
| array | $settings | |
| int | $type | |
| int | $suppliedId |
Definition at line 122 of file Abstract.php.
00123 { 00124 switch ($type) { 00125 case self::LINK_GET_CHILDREN: 00126 $whereField = $settings['parent_field']; 00127 $idField = $settings['child_field']; 00128 break; 00129 00130 case self::LINK_GET_PARENTS: 00131 $idField = $settings['parent_field']; 00132 $whereField = $settings['child_field']; 00133 break; 00134 } 00135 00136 $additional = array(); 00137 if (isset($settings['additional']) && is_array($settings['additional'])) { 00138 $additional = $settings['additional']; 00139 } 00140 00141 return $this->getResource()->fetchLinkInformation($store->getId(), $settings['table'], $idField, $whereField, $suppliedId, $additional); 00142 }
| getAttributeData | ( | $ | products, | |
| $ | attributes, | |||
| $ | store | |||
| ) |
Retreive specified attribute data for specified products from specified store
| array | $products | |
| array | $attributes | |
| Mage_Core_Model_Store | $store |
Definition at line 249 of file Abstract.php.
00250 { 00251 return $this->getResource()->getAttributeData($products, $attributes, $store->getId()); 00252 }
| getChildProductIds | ( | $ | store, | |
| $ | parentIds | |||
| ) |
Return all children ids
| Mage_Core_Model_Store | $store | |
| int | $parentId |
Definition at line 81 of file Abstract.php.
00082 { 00083 if (!$this->_haveChildren) { 00084 return false; 00085 } 00086 00087 if (!$this->_getLinkSettings()) { 00088 return false; 00089 } 00090 00091 return $this->fetchLinkInformation($store, $this->_getLinkSettings(), self::LINK_GET_CHILDREN, $parentIds); 00092 }
| getFinalPrice | ( | $ | product, | |
| $ | store, | |||
| $ | group | |||
| ) |
Fetch final price for product
| int | $product | |
| Mage_Core_Model_Store | $store | |
| Mage_Customer_Model_Group | $group |
Reimplemented in Mage_CatalogIndex_Model_Data_Grouped.
Definition at line 152 of file Abstract.php.
00153 { 00154 $basePrice = $specialPrice = $specialPriceFrom = $specialPriceTo = null; 00155 $priceId = Mage::getSingleton('eav/entity_attribute')->getIdByCode('catalog_product', 'price'); 00156 $specialPriceId = Mage::getSingleton('eav/entity_attribute')->getIdByCode('catalog_product', 'special_price'); 00157 $specialPriceFromId = Mage::getSingleton('eav/entity_attribute')->getIdByCode('catalog_product', 'special_from_date'); 00158 $specialPriceToId = Mage::getSingleton('eav/entity_attribute')->getIdByCode('catalog_product', 'special_to_date'); 00159 00160 $attributes = array($priceId, $specialPriceId, $specialPriceFromId, $specialPriceToId); 00161 00162 $productData = $this->getAttributeData($product, $attributes, $store); 00163 foreach ($productData as $row) { 00164 switch ($row['attribute_id']) { 00165 case $priceId: 00166 $basePrice = $row['value']; 00167 break; 00168 case $specialPriceId: 00169 $specialPrice = $row['value']; 00170 break; 00171 case $specialPriceFromId: 00172 $specialPriceFrom = $row['value']; 00173 break; 00174 case $specialPriceToId: 00175 $specialPriceTo = $row['value']; 00176 break; 00177 } 00178 } 00179 00180 $finalPrice = Mage::getSingleton('catalog/product_type') 00181 ->priceFactory($this->getTypeCode()) 00182 ->calculatePrice($basePrice, $specialPrice, $specialPriceFrom, $specialPriceTo, false, $store, $group, $product); 00183 00184 return $finalPrice; 00185 }
| getMinimalPrice | ( | $ | products, | |
| $ | store | |||
| ) |
Return minimal prices for specified products
| array | $products | |
| Mage_Core_Model_Store | $store |
Definition at line 194 of file Abstract.php.
00195 { 00196 $priceAttributes = array( 00197 Mage::getSingleton('eav/entity_attribute')->getIdByCode('catalog_product', 'tier_price'), 00198 Mage::getSingleton('eav/entity_attribute')->getIdByCode('catalog_product', 'price')); 00199 00200 $data = $this->getResource()->getMinimalPrice($products, $priceAttributes, $store->getId()); 00201 00202 $this->setMinimalPriceData($data); 00203 $eventData = array('indexer'=>$this, 'product_ids'=>$products, 'store'=>$store); 00204 Mage::dispatchEvent('catalogindex_get_minimal_price', $eventData); 00205 $data = $this->getMinimalPriceData(); 00206 00207 return $data; 00208 }
| getParentProductIds | ( | $ | store, | |
| $ | childIds | |||
| ) |
Return all parent ids
| Mage_Core_Model_Store | $store | |
| int | $childId |
Definition at line 101 of file Abstract.php.
00102 { 00103 if (!$this->_haveParents) { 00104 return false; 00105 } 00106 00107 if (!$this->_getLinkSettings()) { 00108 return false; 00109 } 00110 00111 return $this->fetchLinkInformation($store, $this->_getLinkSettings(), self::LINK_GET_PARENTS, $childIds); 00112 }
| getTaxClassId | ( | $ | productId, | |
| $ | store | |||
| ) |
Get tax class id for a product
| int | $productId | |
| Mage_Core_Model_Store | $store |
Definition at line 217 of file Abstract.php.
00218 { 00219 $attributeId = Mage::getSingleton('eav/entity_attribute')->getIdByCode('catalog_product', 'tax_class_id'); 00220 $taxClassId = $this->getResource()->getAttributeData(array($productId), array($attributeId), $store->getId()); 00221 if (is_array($taxClassId) && isset($taxClassId[0]['value'])) { 00222 $taxClassId = $taxClassId[0]['value']; 00223 } 00224 else { 00225 $taxClassId = 0; 00226 } 00227 return $taxClassId; 00228 }
| getTierPrices | ( | $ | products, | |
| $ | store | |||
| ) |
Return tier data for specified products in specified store
| array | $products | |
| Mage_Core_Model_Store | $store |
Definition at line 237 of file Abstract.php.
00238 { 00239 return $this->getResource()->getTierPrices($products, $store->getWebsiteId()); 00240 }
| getTypeCode | ( | ) |
Retreive product type code
Reimplemented in Mage_Bundle_Model_CatalogIndex_Data_Bundle, Mage_CatalogIndex_Model_Data_Configurable, Mage_CatalogIndex_Model_Data_Grouped, Mage_CatalogIndex_Model_Data_Simple, Mage_CatalogIndex_Model_Data_Virtual, and Mage_Downloadable_Model_CatalogIndex_Data_Downloadable.
Definition at line 259 of file Abstract.php.
00260 { 00261 Mage::throwException('Define custom data retreiver with getTypeCode function'); 00262 }
| getTypeInstance | ( | ) |
Retrieve Product Type Instance
Definition at line 293 of file Abstract.php.
00294 { 00295 if (is_null($this->_typeInstance)) { 00296 $product = new Varien_Object(); 00297 $product->setTypeId($this->getTypeCode()); 00298 $this->_typeInstance = Mage::getSingleton('catalog/product_type') 00299 ->factory($product, true); 00300 } 00301 return $this->_typeInstance; 00302 }
$_haveChildren [protected] |
Initial value:
array( Mage_CatalogIndex_Model_Retreiver::CHILDREN_FOR_TIERS=>true, Mage_CatalogIndex_Model_Retreiver::CHILDREN_FOR_PRICES=>true, Mage_CatalogIndex_Model_Retreiver::CHILDREN_FOR_ATTRIBUTES=>true, )
Reimplemented in Mage_Bundle_Model_CatalogIndex_Data_Bundle, Mage_CatalogIndex_Model_Data_Configurable, Mage_CatalogIndex_Model_Data_Simple, and Mage_CatalogIndex_Model_Data_Virtual.
Definition at line 49 of file Abstract.php.
$_haveParents = true [protected] |
Reimplemented in Mage_Bundle_Model_CatalogIndex_Data_Bundle, Mage_CatalogIndex_Model_Data_Configurable, and Mage_CatalogIndex_Model_Data_Grouped.
Definition at line 60 of file Abstract.php.
$_typeInstance [protected] |
Definition at line 42 of file Abstract.php.
| const LINK_GET_CHILDREN = 1 |
Definition at line 62 of file Abstract.php.
| const LINK_GET_PARENTS = 1 |
Definition at line 63 of file Abstract.php.
1.5.8