1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
26:
27:
28: 29: 30: 31: 32: 33:
34: class Mage_Bundle_Block_Catalog_Product_Price extends Mage_Catalog_Block_Product_Price
35: {
36:
37: public function isRatesGraterThenZero()
38: {
39: $_request = Mage::getSingleton('tax/calculation')->getRateRequest(false, false, false);
40: $_request->setProductClassId($this->getProduct()->getTaxClassId());
41: $defaultTax = Mage::getSingleton('tax/calculation')->getRate($_request);
42:
43: $_request = Mage::getSingleton('tax/calculation')->getRateRequest();
44: $_request->setProductClassId($this->getProduct()->getTaxClassId());
45: $currentTax = Mage::getSingleton('tax/calculation')->getRate($_request);
46:
47: return (floatval($defaultTax) > 0 || floatval($currentTax) > 0);
48: }
49:
50: 51: 52: 53: 54: 55:
56: public function displayBothPrices()
57: {
58: $product = $this->getProduct();
59: if ($product->getPriceType() == Mage_Bundle_Model_Product_Price::PRICE_TYPE_DYNAMIC &&
60: $product->getPriceModel()->getIsPricesCalculatedByIndex() !== false) {
61: return false;
62: }
63: return $this->helper('tax')->displayBothPrices();
64: }
65:
66: 67: 68: 69: 70:
71: protected function _toHtml()
72: {
73: $product = $this->getProduct();
74: if ($this->getMAPTemplate() && Mage::helper('catalog')->canApplyMsrp($product)
75: && $product->getPriceType() != Mage_Bundle_Model_Product_Price::PRICE_TYPE_DYNAMIC
76: ) {
77: $hiddenPriceHtml = parent::_toHtml();
78: if (Mage::helper('catalog')->isShowPriceOnGesture($product)) {
79: $this->setWithoutPrice(true);
80: }
81: $realPriceHtml = parent::_toHtml();
82: $this->unsWithoutPrice();
83: $addToCartUrl = $this->getLayout()->getBlock('product.info.bundle')->getAddToCartUrl($product);
84: $product->setAddToCartUrl($addToCartUrl);
85: $html = $this->getLayout()
86: ->createBlock('catalog/product_price')
87: ->setTemplate($this->getMAPTemplate())
88: ->setRealPriceHtml($hiddenPriceHtml)
89: ->setPriceElementIdPrefix('bundle-price-')
90: ->setIdSuffix($this->getIdSuffix())
91: ->setProduct($product)
92: ->toHtml();
93:
94: return $realPriceHtml . $html;
95: }
96:
97: return parent::_toHtml();
98: }
99: }
100: