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
00035 class Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option extends Mage_Bundle_Block_Catalog_Product_Price
00036 {
00037 public function getProduct()
00038 {
00039 if (!$this->hasData('product')) {
00040 $this->setData('product', Mage::registry('current_product'));
00041 }
00042 return $this->getData('product');
00043 }
00044
00045 public function getSelectionQtyTitlePrice($_selection, $includeContainer = true)
00046 {
00047 $price = $this->getProduct()->getPriceModel()->getSelectionPreFinalPrice($this->getProduct(), $_selection);
00048 return $_selection->getSelectionQty()*1 . ' x ' . $_selection->getName() . ' ' .
00049 ($includeContainer ? '<span class="price-notice">':'') . '+' .
00050 $this->formatPriceString($price, $includeContainer) . ($includeContainer ? '</span>':'');
00051 }
00052
00053 public function getSelectionTitlePrice($_selection, $includeContainer = true)
00054 {
00055 $price = $this->getProduct()->getPriceModel()->getSelectionPreFinalPrice($this->getProduct(), $_selection, 1);
00056 return $_selection->getName() . ' ' . ($includeContainer ? '<span class="price-notice">':'') . '+' .
00057 $this->formatPriceString($price, $includeContainer) . ($includeContainer ? '</span>':'');
00058 }
00059
00060 public function setValidationContainer($elementId, $containerId)
00061 {
00062 return '<script type="text/javascript">
00063 $(\'' . $elementId . '\').advaiceContainer = \'' . $containerId . '\';
00064 $(\'' . $elementId . '\').callbackFunction = \'bundle.validationCallback\';
00065 </script>';
00066 }
00067
00068 public function formatPriceString($price, $includeContainer = true)
00069 {
00070 $priceTax = Mage::helper('tax')->getPrice($this->getProduct(), $price);
00071 $priceIncTax = Mage::helper('tax')->getPrice($this->getProduct(), $price, true);
00072
00073 if (Mage::helper('tax')->displayBothPrices() && $priceTax != $priceIncTax) {
00074 $formated = Mage::helper('core')->currency($priceTax, true, $includeContainer);
00075 $formated .= ' (+'.Mage::helper('core')->currency($priceIncTax, true, $includeContainer).' '.Mage::helper('tax')->__('Incl. Tax').')';
00076 } else {
00077 $formated = $this->helper('core')->currency($priceTax, true, $includeContainer);
00078 }
00079
00080 return $formated;
00081 }
00082 }