Mage_Bundle_Block_Catalog_Product_List_Partof Class Reference

Inheritance diagram for Mage_Bundle_Block_Catalog_Product_List_Partof:

Mage_Catalog_Block_Product_Abstract Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 getItemCollection ()
 getItems ()
 getRowCount ()
 setColumnCount ($columns)
 getColumnCount ()
 resetItemsIterator ()
 getIterableItem ()
 getProduct ()

Protected Member Functions

 _prepareData ()
 _beforeToHtml ()

Protected Attributes

 $_columnCount = 4
 $_items
 $_itemCollection
 $_product = null


Detailed Description

Definition at line 35 of file Partof.php.


Member Function Documentation

_beforeToHtml (  )  [protected]

Before rendering html, but after trying to load cache

Returns:
Mage_Core_Block_Abstract

Reimplemented from Mage_Core_Block_Abstract.

Definition at line 69 of file Partof.php.

00070     {
00071         $this->_prepareData();
00072         return parent::_beforeToHtml();
00073     }

_prepareData (  )  [protected]

Definition at line 42 of file Partof.php.

00043     {
00044         $collection = Mage::getModel('catalog/product')->getResourceCollection()
00045             ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
00046             ->addAttributeToSort('position', 'asc')
00047             ->addStoreFilter()
00048             ->addMinimalPrice()
00049 
00050             ->joinTable('bundle/option', 'parent_id=entity_id', array('option_id' => 'option_id'))
00051             ->joinTable('bundle/selection', 'option_id=option_id', array('product_id' => 'product_id'), '{{table}}.product_id='.$this->getProduct()->getId());
00052 
00053             $ids = Mage::getSingleton('checkout/cart')->getProductIds();
00054 
00055             if (count($ids)) {
00056                 $collection->addIdFilter(Mage::getSingleton('checkout/cart')->getProductIds(), true);
00057             }
00058 
00059         Mage::getSingleton('catalog/product_status')->addSaleableFilterToCollection($collection);
00060         Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
00061         $collection->getSelect()->group('entity_id');
00062 
00063         $collection->load();
00064         $this->_itemCollection = $collection;
00065 
00066         return $this;
00067     }

getColumnCount (  ) 

Definition at line 100 of file Partof.php.

00101     {
00102         return $this->_columnCount;
00103     }

getItemCollection (  ) 

Definition at line 75 of file Partof.php.

00076     {
00077         return $this->_itemCollection;
00078     }

getItems (  ) 

Definition at line 80 of file Partof.php.

00080                                {
00081         if (is_null($this->_items)) {
00082             $this->_items = $this->getItemCollection()->getItems();
00083         }
00084         return $this->_items;
00085     }

getIterableItem (  ) 

Definition at line 111 of file Partof.php.

00112     {
00113         $item = current($this->_items);
00114         next($this->_items);
00115         return $item;
00116     }

getProduct (  ) 

Get current product from registry

Returns:
Mage_Catalog_Model_Product

Reimplemented from Mage_Catalog_Block_Product_Abstract.

Definition at line 123 of file Partof.php.

00124     {
00125         if (!$this->_product) {
00126             $this->_product = Mage::registry('product');
00127         }
00128         return $this->_product;
00129     }

getRowCount (  ) 

Definition at line 87 of file Partof.php.

00088     {
00089         return ceil($this->getItemCollection()->getSize()/$this->getColumnCount());
00090     }

resetItemsIterator (  ) 

Definition at line 105 of file Partof.php.

00106     {
00107         $this->getItems();
00108         reset($this->_items);
00109     }

setColumnCount ( columns  ) 

Definition at line 92 of file Partof.php.

00093     {
00094         if (intval($columns) > 0) {
00095             $this->_columnCount = intval($columns);
00096         }
00097         return $this;
00098     }


Member Data Documentation

$_columnCount = 4 [protected]

Definition at line 37 of file Partof.php.

$_itemCollection [protected]

Definition at line 39 of file Partof.php.

$_items [protected]

Definition at line 38 of file Partof.php.

$_product = null [protected]

Definition at line 40 of file Partof.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:34 2009 for Magento by  doxygen 1.5.8