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_Bundle_Block_Checkout_Cart_Item_Renderer extends Mage_Checkout_Block_Cart_Item_Renderer
00035 {
00036
00037
00038
00039
00040
00041
00042
00043
00044 protected function _getBundleOptions($useCache = true)
00045 {
00046 $options = array();
00047
00048
00049
00050
00051 $typeInstance = $this->getProduct()->getTypeInstance(true);
00052
00053
00054 $optionsQuoteItemOption = $this->getItem()->getOptionByCode('bundle_option_ids');
00055 $bundleOptionsIds = unserialize($optionsQuoteItemOption->getValue());
00056 if ($bundleOptionsIds) {
00057
00058
00059
00060 $optionsCollection = $typeInstance->getOptionsByIds($bundleOptionsIds, $this->getProduct());
00061
00062
00063 $selectionsQuoteItemOption = $this->getItem()->getOptionByCode('bundle_selection_ids');
00064
00065 $selectionsCollection = $typeInstance->getSelectionsByIds(
00066 unserialize($selectionsQuoteItemOption->getValue()),
00067 $this->getProduct()
00068 );
00069
00070 $bundleOptions = $optionsCollection->appendSelections($selectionsCollection, true);
00071 foreach ($bundleOptions as $bundleOption) {
00072 if ($bundleOption->getSelections()) {
00073 $option = array('label' => $bundleOption->getTitle(), "value" => array());
00074 $bundleSelections = $bundleOption->getSelections();
00075
00076 foreach ($bundleSelections as $bundleSelection) {
00077 $option['value'][] = $this->_getSelectionQty($bundleSelection->getSelectionId()).' x '. $this->htmlEscape($bundleSelection->getName()). ' ' .Mage::helper('core')->currency($this->_getSelectionFinalPrice($bundleSelection));
00078 }
00079
00080 $options[] = $option;
00081 }
00082 }
00083 }
00084 return $options;
00085 }
00086
00087
00088
00089
00090
00091
00092
00093 protected function _getSelectionFinalPrice($selectionProduct)
00094 {
00095 $bundleProduct = $this->getProduct();
00096 return $bundleProduct->getPriceModel()->getSelectionFinalPrice(
00097 $bundleProduct, $selectionProduct,
00098 $this->getQty(),
00099 $this->_getSelectionQty($selectionProduct->getSelectionId())
00100 );
00101 }
00102
00103
00104
00105
00106
00107
00108
00109 protected function _getSelectionQty($selectionId)
00110 {
00111 if ($selectionQty = $this->getProduct()->getCustomOption('selection_qty_' . $selectionId)) {
00112 return $selectionQty->getValue();
00113 }
00114 return 0;
00115 }
00116
00117 public function getOptionList()
00118 {
00119 return array_merge($this->_getBundleOptions(), parent::getOptionList());
00120 }
00121 }