产品列表页面Magento 1.9上的多个可配置样本

时间:2018-02-12 10:29:10

标签: php attributes magento-1.9 configurable-product

我想在产品详情页面上显示多个可配置的样本。为此,我创建了configurable_category.phtml,其中我复制了configurable.phtml文件以显示可配置的样本:

$_product    = $this->getProduct();
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
$_jsonConfig = $this->getJsonConfig();
$_renderers  = $this->getChild('attr_renderers')->getSortedChildren();

....

$_rendered = false;
foreach ($_renderers as $_rendererName):
    $_renderer = $this->getChild('attr_renderers')->getChild($_rendererName);
    if (method_exists($_renderer, 'shouldRender') && $_renderer->shouldRender($_attribute, $_jsonConfig)):
        $_renderer->setProduct($_product);
        $_renderer->setAttributeObj($_attribute);
        echo $_renderer->toHtml();
        $_rendered = true;
        break;
    endif;
endforeach;

....

现在我必须包含以下代码:

<block type="core/text_list" name="product.info.options.configurable.renderers" as="attr_renderers" />

但我不知道在哪里加入它。我已尝试将其放在 catalog_category_default catalog_category_layered 下的 catalog.xml 中,但$_renderers = $this->getChild('attr_renderers');仍然返回false。

任何人都可以帮助我吗?

0 个答案:

没有答案
相关问题