Public Member Functions | |
getFinalPrice ($qty=null, $product) | |
Protected Member Functions | |
_calcSelectionPrice ($priceInfo, $productPrice) | |
_getValueByIndex ($values, $index) |
Definition at line 34 of file Price.php.
_calcSelectionPrice | ( | $ | priceInfo, | |
$ | productPrice | |||
) | [protected] |
Calculate configurable product selection price
array | $priceInfo | |
decimal | $productPrice |
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] |
getFinalPrice | ( | $ | qty = null , |
|
$ | product | |||
) |
Get product final price
double | $qty | |
Mage_Catalog_Model_Product | $product |
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 }