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_Catalog_Block_Product_List_Related extends Mage_Catalog_Block_Product_Abstract
00036 {
00037 protected $_itemCollection;
00038
00039 protected function _prepareData()
00040 {
00041 $product = Mage::registry('product');
00042
00043
00044 $this->_itemCollection = $product->getRelatedProductCollection()
00045 ->addAttributeToSelect('required_options')
00046 ->addAttributeToSort('position', 'asc')
00047 ->addStoreFilter()
00048 ;
00049 Mage::getResourceSingleton('checkout/cart')->addExcludeProductFilter($this->_itemCollection,
00050 Mage::getSingleton('checkout/session')->getQuoteId()
00051 );
00052 $this->_addProductAttributesAndPrices($this->_itemCollection);
00053
00054
00055 Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($this->_itemCollection);
00056
00057 $this->_itemCollection->load();
00058
00059 foreach ($this->_itemCollection as $product) {
00060 $product->setDoNotUseCategoryId(true);
00061 }
00062
00063 return $this;
00064 }
00065
00066 protected function _beforeToHtml()
00067 {
00068 $this->_prepareData();
00069 return parent::_beforeToHtml();
00070 }
00071
00072 public function getItems()
00073 {
00074 return $this->_itemCollection;
00075 }
00076 }