Mage_Catalog_Block_Product_View_Options_Abstract Class Reference

Inheritance diagram for Mage_Catalog_Block_Product_View_Options_Abstract:

Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object Mage_Catalog_Block_Product_View_Options_Type_Date Mage_Catalog_Block_Product_View_Options_Type_Default Mage_Catalog_Block_Product_View_Options_Type_File Mage_Catalog_Block_Product_View_Options_Type_Select Mage_Catalog_Block_Product_View_Options_Type_Text

List of all members.

Public Member Functions

 setProduct (Mage_Catalog_Model_Product $product=null)
 getProduct ()
 setOption (Mage_Catalog_Model_Product_Option $option)
 getOption ()
 getFormatedPrice ()
 getPrice ($price, $includingTax=null)

Protected Member Functions

 _formatPrice ($value, $flag=true)

Protected Attributes

 $_product
 $_option


Detailed Description

Definition at line 35 of file Abstract.php.


Member Function Documentation

_formatPrice ( value,
flag = true 
) [protected]

Return formated price

Parameters:
array $value
Returns:
string

Definition at line 112 of file Abstract.php.

00113     {
00114         if ($value['pricing_value'] == 0) {
00115             return '';
00116         }
00117         $sign = '+';
00118         if ($value['pricing_value'] < 0) {
00119             $sign = '-';
00120             $value['pricing_value'] = 0 - $value['pricing_value'];
00121         }
00122         $priceStr = $sign;
00123         $_priceInclTax = $this->getPrice($value['pricing_value'], true);
00124         $_priceExclTax = $this->getPrice($value['pricing_value']);
00125         if (Mage::helper('tax')->displayPriceIncludingTax()) {
00126             $priceStr .= $this->helper('core')->currency($_priceInclTax, true, $flag);
00127         } elseif (Mage::helper('tax')->displayPriceExcludingTax()) {
00128             $priceStr .= $this->helper('core')->currency($_priceExclTax, true, $flag);
00129         } elseif (Mage::helper('tax')->displayBothPrices()) {
00130             $priceStr .= $this->helper('core')->currency($_priceExclTax, true, $flag);
00131             if ($_priceInclTax != $_priceExclTax) {
00132                 $priceStr .= ' ('.$sign.$this->helper('core')
00133                     ->currency($_priceInclTax, true, $flag).' '.$this->__('Incl. Tax').')';
00134             }
00135         }
00136 
00137         if ($flag) {
00138             $priceStr = '<span class="price-notice">'.$priceStr.'</span>';
00139         }
00140 
00141         return $priceStr;
00142     }

getFormatedPrice (  ) 

Definition at line 95 of file Abstract.php.

00096     {
00097         if ($option = $this->getOption()) {
00098             return $this->_formatPrice(array(
00099                 'is_percent' => ($option->getPriceType() == 'percent') ? true : false,
00100                 'pricing_value' => $option->getPrice(true)
00101             ));
00102         }
00103         return '';
00104     }

getOption (  ) 

Get option

Returns:
Mage_Catalog_Model_Product_Option

Definition at line 90 of file Abstract.php.

00091     {
00092         return $this->_option;
00093     }

getPrice ( price,
includingTax = null 
)

Get price with including/excluding tax

Parameters:
decimal $price
bool $includingTax
Returns:
decimal

Definition at line 151 of file Abstract.php.

00152     {
00153         if (!is_null($includingTax)) {
00154             $price = Mage::helper('tax')->getPrice($this->getProduct(), $price, true);
00155         } else {
00156             $price = Mage::helper('tax')->getPrice($this->getProduct(), $price);
00157         }
00158         return $price;
00159     }

getProduct (  ) 

Retrieve Product object

Returns:
Mage_Catalog_Model_Product

Definition at line 68 of file Abstract.php.

00069     {
00070         return $this->_product;
00071     }

setOption ( Mage_Catalog_Model_Product_Option option  ) 

Set option

Parameters:
Mage_Catalog_Model_Product_Option $option
Returns:
Mage_Catalog_Block_Product_View_Options_Abstract

Definition at line 79 of file Abstract.php.

00080     {
00081         $this->_option = $option;
00082         return $this;
00083     }

setProduct ( Mage_Catalog_Model_Product product = null  ) 

Set Product object

Parameters:
Mage_Catalog_Model_Product $product
Returns:
Mage_Catalog_Block_Product_View_Options_Abstract

Definition at line 57 of file Abstract.php.

00058     {
00059         $this->_product = $product;
00060         return $this;
00061     }


Member Data Documentation

$_option [protected]

Definition at line 49 of file Abstract.php.

$_product [protected]

Definition at line 42 of file Abstract.php.


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

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