Mage_Downloadable_Model_Product_Price Class Reference

Inheritance diagram for Mage_Downloadable_Model_Product_Price:

Mage_Catalog_Model_Product_Type_Price

List of all members.

Public Member Functions

 getFinalPrice ($qty=null, $product)


Detailed Description

Definition at line 34 of file Price.php.


Member Function Documentation

getFinalPrice ( qty = null,
product 
)

Retrieve product final price

Parameters:
integer $qty
Mage_Catalog_Model_Product $product
Returns:
float

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     }


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

Generated on Sat Jul 4 17:24:09 2009 for Magento by  doxygen 1.5.8