Mage_Catalog_Block_Product_Compare_List Class Reference

Inheritance diagram for Mage_Catalog_Block_Product_Compare_List:

Mage_Catalog_Block_Product_Abstract Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 getItems ()
 getAttributes ()
 getProductAttributeValue ($product, $attribute)
 getPrintUrl ()

Protected Member Functions

 _prepareLayout ()

Protected Attributes

 $_items
 $_attributes


Detailed Description

Definition at line 35 of file List.php.


Member Function Documentation

_prepareLayout (  )  [protected]

Preparing layout

Returns:
Mage_Catalog_Block_Product_Compare_List

Reimplemented from Mage_Core_Block_Abstract.

Definition at line 56 of file List.php.

00057     {
00058         if ($headBlock = $this->getLayout()->getBlock('head')) {
00059             $headBlock->setTitle(Mage::helper('catalog')->__('Compare Products List') . ' - ' . $headBlock->getDefaultTitle());
00060         }
00061         return parent::_prepareLayout();
00062     }

getAttributes (  ) 

Retrieve Product Compare Attributes

Returns:
array

Definition at line 104 of file List.php.

00105     {
00106         if (is_null($this->_attributes)) {
00107             $this->_attributes = $this->getItems()->getComparableAttributes();
00108         }
00109 
00110         return $this->_attributes;
00111     }

getItems (  ) 

Retrieve Product Compare items collection

Returns:
Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Compare_Item_Collection

Definition at line 69 of file List.php.

00070     {
00071         if (is_null($this->_items)) {
00072             Mage::helper('catalog/product_compare')->setAllowUsedFlat(false);
00073             $this->_items = Mage::getResourceModel('catalog/product_compare_item_collection')
00074                 ->useProductItem(true)
00075                 ->setStoreId(Mage::app()->getStore()->getId());
00076 
00077             if (Mage::getSingleton('customer/session')->isLoggedIn()) {
00078                 $this->_items
00079                     ->setCustomerId(Mage::getSingleton('customer/session')->getCustomerId());
00080             }
00081             else {
00082                 $this->_items
00083                     ->setVisitorId(Mage::getSingleton('log/visitor')->getId());
00084             }
00085 
00086             $this->_items
00087                 ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
00088                 ->loadComparableAttributes()
00089                 ->addMinimalPrice()
00090                 ->addTaxPercents();
00091 
00092             Mage::getSingleton('catalog/product_visibility')
00093                 ->addVisibleInSiteFilterToCollection($this->_items);
00094         }
00095 
00096         return $this->_items;
00097     }

getPrintUrl (  ) 

Retrieve Print URL

Returns:
string

Definition at line 141 of file List.php.

00142     {
00143         return $this->getUrl('*/*/*', array('_current'=>true, 'print'=>1));
00144     }

getProductAttributeValue ( product,
attribute 
)

Retrieve Product Attribute Value

Parameters:
Mage_Catalog_Model_Product $product
Mage_Catalog_Model_Resource_Eav_Attribute $attribute
Returns:
string

Definition at line 120 of file List.php.

00121     {
00122         if (!$product->hasData($attribute->getAttributeCode())) {
00123             return ' ';
00124         }
00125 
00126         if ($attribute->getSourceModel() || in_array($attribute->getFrontendInput(), array('select','boolean','multiselect'))) {
00127             //$value = $attribute->getSource()->getOptionText($product->getData($attribute->getAttributeCode()));
00128             $value = $attribute->getFrontend()->getValue($product);
00129         }
00130         else {
00131             $value = $product->getData($attribute->getAttributeCode());
00132         }
00133         return $value ? $value : ' ';
00134     }


Member Data Documentation

$_attributes [protected]

Definition at line 49 of file List.php.

$_items [protected]

Definition at line 42 of file List.php.


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

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