Public Member Functions | |
getItems () | |
getAttributes () | |
getProductAttributeValue ($product, $attribute) | |
getPrintUrl () | |
Protected Member Functions | |
_prepareLayout () | |
Protected Attributes | |
$_items | |
$_attributes |
Definition at line 35 of file List.php.
_prepareLayout | ( | ) | [protected] |
Preparing layout
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 | ( | ) |
getItems | ( | ) |
Retrieve Product Compare items 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 | ( | ) |
getProductAttributeValue | ( | $ | product, | |
$ | attribute | |||
) |
Retrieve Product Attribute Value
Mage_Catalog_Model_Product | $product | |
Mage_Catalog_Model_Resource_Eav_Attribute | $attribute |
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 }