Моя проблема заключается в двух функциях:
<?php
private function getAttributes() {
$attributesInfo = Mage::getResourceModel('eav/entity_attribute_collection')
->setEntityTypeFilter('4')
->addSetInfo()
->getData();
$attr = array();
$currStoreViewId = Mage::app()->getStore()->getId();
foreach($attributesInfo as $attribute):
$attribute = Mage::getModel('eav/entity_attribute')->load($attribute['attribute_id']);
if (!$attribute->getIsVisibleOnFront()) continue;
$labels = $attribute->getStoreLabels();
if (isset($labels[$currStoreViewId])) $label = $labels[$currStoreViewId];
else $label = $attribute->getFrontendLabel();
$attr[ $attribute->getAttributeCode() ] = $label;
endforeach;
return $attr;
}
public function getProductAttributList($_product) {
$pid = $_product->getId();
if (empty($pid)) return false;
$attributes = $this->getAttributes();
if (count($attributes)>0) $html = '<table width="100%" cellpadding="0" cellspacing="0">';
else return false;
foreach($attributes as $attrcode => $attrlabel) {
$value = $_product->{'get'.$attrcode}();
if ($attrcode=='weight') continue;
if (empty($value)) continue;
if (is_numeric($value)) $value = $_product->getAttributeText($attrcode);
$html .= '<tr><td style="width:50%; padding:0 10px 0 0;"><strong>'.$attrlabel.'</strong>
</td><td style="padding:0; width:50%;">'.$value.'</td>';
}
return $html.'</table>';
}
?>
Я все еще получаю ошибку: синтаксическая ошибка, неожиданный T_PRIVATE. Может ли кто-нибудь помочь мне решить эту проблему? У меня такая же проблема с публичной функцией.
Функция не может быть общедоступной/защищенной/частной. Эти модификаторы могут применяться только для методов класса.
private
, но ключевые слова видимости, такие какpublic
,protected
иprivate
, действительны только внутри класса, и я не вижу здесь никакого класса