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 |
Definition at line 35 of file Abstract.php.
_formatPrice | ( | $ | value, | |
$ | flag = true | |||
) | [protected] |
Return formated price
array | $value |
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 | ( | ) |
getPrice | ( | $ | price, | |
$ | includingTax = null | |||
) |
Get price with including/excluding tax
decimal | $price | |
bool | $includingTax |
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
Definition at line 68 of file Abstract.php.
setOption | ( | Mage_Catalog_Model_Product_Option $ | option | ) |
Set option
Mage_Catalog_Model_Product_Option | $option |
Definition at line 79 of file Abstract.php.
setProduct | ( | Mage_Catalog_Model_Product $ | product = null |
) |
Set Product object
Mage_Catalog_Model_Product | $product |
Definition at line 57 of file Abstract.php.
$_option [protected] |
Definition at line 49 of file Abstract.php.
$_product [protected] |
Definition at line 42 of file Abstract.php.