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_Tag_Block_Customer_View extends Mage_Catalog_Block_Product_Abstract
00036 {
00037
00038
00039
00040
00041
00042 protected $_collection;
00043
00044
00045
00046
00047
00048
00049 protected $_tagInfo;
00050
00051
00052
00053
00054
00055 protected function _construct()
00056 {
00057 parent::_construct();
00058 $this->setTagId(Mage::registry('tagId'));
00059 }
00060
00061
00062
00063
00064
00065
00066 public function getTagInfo()
00067 {
00068 if (is_null($this->_tagInfo)) {
00069 $this->_tagInfo = Mage::getModel('tag/tag')
00070 ->load($this->getTagId());
00071 }
00072 return $this->_tagInfo;
00073 }
00074
00075
00076
00077
00078
00079
00080 public function getMyProducts()
00081 {
00082 return $this->_getCollection()->getItems();
00083 }
00084
00085
00086
00087
00088
00089
00090 public function getCount()
00091 {
00092 return sizeof($this->getMyProducts());
00093 }
00094
00095
00096
00097
00098
00099
00100
00101 public function getReviewUrl($productId)
00102 {
00103 return Mage::getUrl('review/product/list', array('id' => $productId));
00104 }
00105
00106
00107
00108
00109
00110
00111 protected function _prepareLayout()
00112 {
00113 $toolbar = $this->getLayout()
00114 ->createBlock('page/html_pager', 'customer_tag_list.toolbar')
00115 ->setCollection($this->_getCollection());
00116
00117 $this->setChild('toolbar', $toolbar);
00118 return parent::_prepareLayout();
00119 }
00120
00121
00122
00123
00124
00125
00126 public function getToolbarHtml()
00127 {
00128 return $this->getChildHtml('toolbar');
00129 }
00130
00131
00132
00133
00134
00135
00136 public function getMode()
00137 {
00138 return $this->getChild('toolbar')->getCurrentMode();
00139 }
00140
00141
00142
00143
00144
00145
00146 protected function _getCollection()
00147 {
00148 if (is_null($this->_collection)) {
00149 $this->_collection = Mage::getModel('tag/tag')
00150 ->getEntityCollection()
00151 ->addTagFilter($this->getTagId())
00152 ->addCustomerFilter(Mage::getSingleton('customer/session')->getCustomerId())
00153 ->addStoreFilter(Mage::app()->getStore()->getId())
00154 ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
00155 ->setActiveFilter();
00156
00157 Mage::getSingleton('catalog/product_status')
00158 ->addVisibleFilterToCollection($this->_collection);
00159 Mage::getSingleton('catalog/product_visibility')
00160 ->addVisibleInSiteFilterToCollection($this->_collection);
00161 }
00162 return $this->_collection;
00163 }
00164 }