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_Checkout_Block_Cart_Item_Renderer_Grouped extends Mage_Checkout_Block_Cart_Item_Renderer
00035 {
00036 const GROUPED_PRODUCT_IMAGE = 'checkout/cart/grouped_product_image';
00037 const USE_PARENT_IMAGE = 'parent';
00038
00039
00040
00041
00042
00043
00044 public function getGroupedProduct()
00045 {
00046 if ($option = $this->getItem()->getOptionByCode('product_type')) {
00047 return $option->getProduct();
00048 }
00049 return $this->getProduct();
00050 }
00051
00052
00053
00054
00055
00056
00057 public function getProductThumbnail()
00058 {
00059 $product = $this->getProduct();
00060 if (!$product->getData('thumbnail')
00061 ||($product->getData('thumbnail') == 'no_selection')
00062 || (Mage::getStoreConfig(self::GROUPED_PRODUCT_IMAGE) == self::USE_PARENT_IMAGE)) {
00063 $product = $this->getGroupedProduct();
00064 }
00065 return $this->helper('catalog/image')->init($product, 'thumbnail');
00066 }
00067
00068
00069
00070
00071
00072
00073 public function getProductUrl()
00074 {
00075 return $this->getGroupedProduct()->getProductUrl();
00076 }
00077
00078
00079
00080
00081
00082
00083
00084
00085 protected function _toHtml()
00086 {
00087 $renderer = $this->getRenderedBlock()->getItemRenderer($this->getItem()->getRealProductType());
00088 $renderer->setItem($this->getItem());
00089 $renderer->overrideProductUrl($this->getProductUrl());
00090 $renderer->overrideProductThumbnail($this->getProductThumbnail());
00091 $rendererHtml = $renderer->toHtml();
00092 $renderer->overrideProductUrl(null);
00093 $renderer->overrideProductThumbnail(null);
00094 return $rendererHtml;
00095 }
00096
00097 }