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_Catalog_Block_Product_View_Attributes extends Mage_Core_Block_Template
00036 {
00037 protected $_product = null;
00038
00039 function getProduct()
00040 {
00041 if (!$this->_product) {
00042 $this->_product = Mage::registry('product');
00043 }
00044 return $this->_product;
00045 }
00046
00047
00048
00049
00050
00051
00052
00053
00054 public function getAdditionalData(array $excludeAttr = array())
00055 {
00056 $data = array();
00057 $product = $this->getProduct();
00058 $attributes = $product->getAttributes();
00059 foreach ($attributes as $attribute) {
00060
00061 if ($attribute->getIsVisibleOnFront() && !in_array($attribute->getAttributeCode(), $excludeAttr)) {
00062
00063 $value = $attribute->getFrontend()->getValue($product);
00064
00065
00066 if (is_string($value)) {
00067 if (strlen($value) && $product->hasData($attribute->getAttributeCode())) {
00068 if ($attribute->getFrontendInput() == 'price') {
00069 $value = Mage::app()->getStore()->convertPrice($value,true);
00070 } elseif (!$attribute->getIsHtmlAllowedOnFront()) {
00071 $value = $this->htmlEscape($value);
00072 }
00073 $data[$attribute->getAttributeCode()] = array(
00074 'label' => $attribute->getFrontend()->getLabel(),
00075 'value' => $value,
00076 'code' => $attribute->getAttributeCode()
00077 );
00078 }
00079 }
00080 }
00081 }
00082 return $data;
00083 }
00084 }