Public Member Functions | |
getItemCollection () | |
getItems () | |
getRowCount () | |
setColumnCount ($columns) | |
getColumnCount () | |
resetItemsIterator () | |
getIterableItem () | |
setItemLimit ($type, $limit) | |
getItemLimit ($type= '') | |
Protected Member Functions | |
_prepareData () | |
_beforeToHtml () | |
Protected Attributes | |
$_columnCount = 4 | |
$_items | |
$_itemCollection | |
$_itemLimits = array() |
Definition at line 35 of file Upsell.php.
_beforeToHtml | ( | ) | [protected] |
Before rendering html, but after trying to load cache
Reimplemented from Mage_Core_Block_Abstract.
Definition at line 83 of file Upsell.php.
00084 { 00085 $this->_prepareData(); 00086 return parent::_beforeToHtml(); 00087 }
_prepareData | ( | ) | [protected] |
Updating collection with desired items
Definition at line 45 of file Upsell.php.
00046 { 00047 $product = Mage::registry('product'); 00048 /* @var $product Mage_Catalog_Model_Product */ 00049 $this->_itemCollection = $product->getUpSellProductCollection() 00050 ->addAttributeToSort('position', 'asc') 00051 ->addStoreFilter() 00052 ; 00053 Mage::getResourceSingleton('checkout/cart')->addExcludeProductFilter($this->_itemCollection, 00054 Mage::getSingleton('checkout/session')->getQuoteId() 00055 ); 00056 $this->_addProductAttributesAndPrices($this->_itemCollection); 00057 00058 // Mage::getSingleton('catalog/product_status')->addSaleableFilterToCollection($this->_itemCollection); 00059 Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($this->_itemCollection); 00060 00061 if ($this->getItemLimit('upsell') > 0) { 00062 $this->_itemCollection->setPageSize($this->getItemLimit('upsell')); 00063 } 00064 00065 $this->_itemCollection->load(); 00066 00067 /** 00068 * Updating collection with desired items 00069 */ 00070 Mage::dispatchEvent('catalog_product_upsell', array( 00071 'product' => $product, 00072 'collection' => $this->_itemCollection, 00073 'limit' => $this->getItemLimit() 00074 )); 00075 00076 foreach ($this->_itemCollection as $product) { 00077 $product->setDoNotUseCategoryId(true); 00078 } 00079 00080 return $this; 00081 }
getColumnCount | ( | ) |
getItemCollection | ( | ) |
getItemLimit | ( | $ | type = '' |
) |
Definition at line 149 of file Upsell.php.
00150 { 00151 if ($type == '') { 00152 return $this->_itemLimits; 00153 } 00154 if (isset($this->_itemLimits[$type])) { 00155 return $this->_itemLimits[$type]; 00156 } 00157 else { 00158 return 0; 00159 } 00160 }
getItems | ( | ) |
Definition at line 94 of file Upsell.php.
00095 { 00096 if (is_null($this->_items)) { 00097 $this->_items = $this->getItemCollection()->getItems(); 00098 } 00099 return $this->_items; 00100 }
getIterableItem | ( | ) |
Definition at line 126 of file Upsell.php.
00127 { 00128 $item = current($this->_items); 00129 next($this->_items); 00130 return $item; 00131 }
getRowCount | ( | ) |
Definition at line 102 of file Upsell.php.
00103 { 00104 return ceil(count($this->getItemCollection()->getItems())/$this->getColumnCount()); 00105 }
resetItemsIterator | ( | ) |
Definition at line 120 of file Upsell.php.
00121 { 00122 $this->getItems(); 00123 reset($this->_items); 00124 }
setColumnCount | ( | $ | columns | ) |
Definition at line 107 of file Upsell.php.
00108 { 00109 if (intval($columns) > 0) { 00110 $this->_columnCount = intval($columns); 00111 } 00112 return $this; 00113 }
setItemLimit | ( | $ | type, | |
$ | limit | |||
) |
Set how many items we need to show in upsell block Notice: this parametr will be also applied
string | $type | |
int | $limit |
Definition at line 141 of file Upsell.php.
00142 { 00143 if (intval($limit) > 0) { 00144 $this->_itemLimits[$type] = intval($limit); 00145 } 00146 return $this; 00147 }
$_columnCount = 4 [protected] |
Definition at line 37 of file Upsell.php.
$_itemCollection [protected] |
Definition at line 41 of file Upsell.php.
$_itemLimits = array() [protected] |
Definition at line 43 of file Upsell.php.
$_items [protected] |
Definition at line 39 of file Upsell.php.