-
- Sintax

-
Total Posts: 58
Joined: 2008-02-18
Hungary
|
Hi,
What is the recommended way of adding a new function to app/code/core/Mage/Catalog/Block/Product/View.php?
I want to add the following function:
public function getAdditionalDataEx() { $data = array(); $product = $this->getProduct(); //print_r($product->getData()); //die; $attributes = $product->getAttributes(); foreach ($attributes as $attribute) { if ($product->getSuperAttributesIds() && (in_array($attribute->getAttributeId(), $product->getSuperAttributesIds()) || !$attribute->getUseInSuperProduct())) { continue; } if ($attribute->getIsUserDefined()) {
$value = $attribute->getFrontend()->getValue($product); if (strlen($value)) { $data[$attribute->getAttributeCode()] = array( 'key' => $attribute->getAttributeCode(), 'attr_id' => $attribute->getId(), 'label' => $this->__($attribute->getFrontend()->getLabel()), 'value' => $attribute->getFrontend()->getValue($product)//$product->getData($attribute->getAttributeCode()) ); } } } return $data; }
I need the attribute ‘key’ since in the phtml I create a custom layout placing specific attributes if they exist to specific locations.
::Sintax
|