00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 class Mage_Catalog_Block_Product_Price extends Mage_Core_Block_Template
00035 {
00036 protected $_priceDisplayType = null;
00037 protected $_idSuffix = '';
00038
00039 public function getProduct()
00040 {
00041 $product = $this->_getData('product');
00042 if (!$product) {
00043 $product = Mage::registry('product');
00044 }
00045 return $product;
00046 }
00047
00048 public function getDisplayMinimalPrice()
00049 {
00050 return $this->_getData('display_minimal_price');
00051 }
00052
00053 public function setIdSuffix($idSuffix)
00054 {
00055 $this->_idSuffix = $idSuffix;
00056 return $this;
00057 }
00058
00059 public function getIdSuffix()
00060 {
00061 return $this->_idSuffix;
00062 }
00063
00064
00065
00066
00067
00068
00069
00070 public function getTierPrices($product = null)
00071 {
00072 if (is_null($product)) {
00073 $product = $this->getProduct();
00074 }
00075 $prices = $product->getFormatedTierPrice();
00076
00077 $res = array();
00078 if (is_array($prices)) {
00079 foreach ($prices as $price) {
00080 $price['price_qty'] = $price['price_qty']*1;
00081
00082 if ($product->getPrice() != $product->getFinalPrice()) {
00083 $productPrice = $product->getFinalPrice();
00084 } else {
00085 $productPrice = $product->getPrice();
00086 }
00087
00088 if ($price['price']<$productPrice) {
00089 $price['savePercent'] = ceil(100 - (( 100/$productPrice ) * $price['price'] ));
00090 $price['formated_price'] = Mage::app()->getStore()->formatPrice(Mage::app()->getStore()->convertPrice(Mage::helper('tax')->getPrice($product, $price['website_price'])));
00091 $price['formated_price_incl_tax'] = Mage::app()->getStore()->formatPrice(Mage::app()->getStore()->convertPrice(Mage::helper('tax')->getPrice($product, $price['website_price'], true)));
00092
00093 $res[] = $price;
00094 }
00095 }
00096 }
00097
00098 return $res;
00099 }
00100 }