Public Member Functions | |
getFinalPrice ($qty=null, $product) |
Definition at line 34 of file Price.php.
getFinalPrice | ( | $ | qty = null , |
|
$ | product | |||
) |
Retrieve product final price
integer | $qty | |
Mage_Catalog_Model_Product | $product |
links prices are added to base product price only if they can be purchased separately
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 00051 /** 00052 * links prices are added to base product price only if they can be purchased separately 00053 */ 00054 if ($product->getLinksPurchasedSeparately()) { 00055 if ($linksIds = $product->getCustomOption('downloadable_link_ids')) { 00056 $linkPrice = 0; 00057 $links = $product->getTypeInstance(true) 00058 ->getLinks($product); 00059 foreach (explode(',', $linksIds->getValue()) as $linkId) { 00060 if (isset($links[$linkId])) { 00061 $linkPrice += $links[$linkId]->getPrice(); 00062 } 00063 } 00064 $finalPrice += $linkPrice; 00065 } 00066 } 00067 00068 $product->setData('final_price', $finalPrice); 00069 return max(0, $product->getData('final_price')); 00070 }