Мне нужна помощь в ознакомлении с помощниками, их методами и атрибутами продукта. В частности: $_helper->productAttribute($product, $attributeHtml, $attributeName)
Вот файлы, которые я использую/просматриваю:
app\code\core\Mage\catalog\helper\output.php
app\design\frontend\[theme name]\template\catalog\product\view\media.phtml
Следующая строка кода генерирует html для изображения продукта.
echo $_helper->productAttribute($_product, $_img, 'image');
Код вспомогательного класса описывает метод в следующих фрагментах кода. Что возвращается, каковы шаги и почему я должен использовать этот метод вместо простого повторения img html, описанного в предыдущей строке файла шаблона?
public function getHandlers($method)
{
$method = strtolower($method);
return isset($this->_handlers[$method]) ? $this->_handlers[$method] : array();
}
public function process($method, $result, $params)
{
foreach ($this->getHandlers($method) as $handler) {
if (method_exists($handler, $method)) {
$result = $handler->$method($this, $result, $params);
}
}
return $result;
}
public function productAttribute($product, $attributeHtml, $attributeName)
{
/* Code that is not relevant to this example */
$attributeHtml = $this->process('productAttribute', $attributeHtml, array(
'product' => $product,
'attribute' => $attributeName
));
return $attributeHtml;
}
Любая помощь приветствуется.