Mage_Catalog_Model_Product_Type_Configurable_Price Class Reference

Inheritance diagram for Mage_Catalog_Model_Product_Type_Configurable_Price:

Mage_Catalog_Model_Product_Type_Price

List of all members.

Public Member Functions

 getFinalPrice ($qty=null, $product)

Protected Member Functions

 _calcSelectionPrice ($priceInfo, $productPrice)
 _getValueByIndex ($values, $index)


Detailed Description

Definition at line 34 of file Price.php.


Member Function Documentation

_calcSelectionPrice ( priceInfo,
productPrice 
) [protected]

Calculate configurable product selection price

Parameters:
array $priceInfo
decimal $productPrice
Returns:
decimal

Definition at line 84 of file Price.php.

00085     {
00086         if($priceInfo['is_percent']) {
00087             $ratio = $priceInfo['pricing_value']/100;
00088             $price = $productPrice * $ratio;
00089         } else {
00090             $price = $priceInfo['pricing_value'];
00091         }
00092         return $price;
00093     }

_getValueByIndex ( values,
index 
) [protected]

Definition at line 95 of file Price.php.

00095                                                          {
00096         foreach ($values as $value) {
00097             if($value['value_index'] == $index) {
00098                 return $value;
00099             }
00100         }
00101         return false;
00102     }

getFinalPrice ( qty = null,
product 
)

Get product final price

Parameters:
double $qty
Mage_Catalog_Model_Product $product
Returns:
double

Reimplemented from Mage_Catalog_Model_Product_Type_Price.

Definition at line 43 of file Price.php.

00044     {
00045         if (is_null($qty) && !is_null($product->getCalculatedFinalPrice())) {
00046             return $product->getCalculatedFinalPrice();
00047         }
00048 
00049         $finalPrice = parent::getFinalPrice($qty, $product);
00050         $product->getTypeInstance(true)
00051             ->setStoreFilter($product->getStore(), $product);
00052         $attributes = $product->getTypeInstance(true)
00053             ->getConfigurableAttributes($product);
00054 
00055         $selectedAttributes = array();
00056         if ($product->getCustomOption('attributes')) {
00057             $selectedAttributes = unserialize($product->getCustomOption('attributes')->getValue());
00058         }
00059 
00060         $basePrice = $finalPrice;
00061         foreach ($attributes as $attribute) {
00062             $attributeId = $attribute->getProductAttribute()->getId();
00063             $value = $this->_getValueByIndex(
00064                 $attribute->getPrices() ? $attribute->getPrices() : array(),
00065                 isset($selectedAttributes[$attributeId]) ? $selectedAttributes[$attributeId] : null
00066             );
00067             if($value) {
00068                 if($value['pricing_value'] != 0) {
00069                     $finalPrice += $this->_calcSelectionPrice($value, $basePrice);
00070                 }
00071             }
00072         }
00073         $product->setFinalPrice($finalPrice);
00074         return max(0, $product->getData('final_price'));
00075     }


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

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