duanni5726 2012-08-10 11:20
浏览 15

在Magento Modern主题中添加选项卡“列表”

I am trying to emulate the list view that Magento does by default in the "Additional Information" tab:

Default layout

I have created the \app\code\core\Mage\Catalog\Block\Product\View\Downloads.php file needed to pull the info for the tab:

<?php
 class Mage_Catalog_Block_Product_View_Downloads extends Mage_Core_Block_Template
 {
    protected $_list;

    public function __construct()
    {
        parent::__construct();
        $this->setTemplate('catalog/product/view/downloads.phtml');
    }

    public function getChildHtmlList()
    {
        if (is_null($this->_list)) {
            $this->_list = array();
            foreach ($this->getSortedChildren() as $name) {
                $block = $this->getLayout()->getBlock($name);
                if (!$block) {
                    Mage::exception(Mage::helper('catalog')->__('Invalid block: %s.', $name));
                }
                $this->_list[] = $block->toHtml();
            }
        }
        return $this->_list;
    }
}

I have also created the template file to display the info in \app\design\frontend\default\themename\template\catalog\product\view\downloads.phtml:

<?php foreach ($this->getChildHtmlList() as $_html): ?>
    <?php echo $_html ?>
<?php endforeach; ?>

And added the XML to the catalogue.xml file:

<action method="addTab" translate="title" module="catalog"><alias>downloads</alias><title>Downloads</title><block>catalog/product_view_downloads</block><template>catalog/product/view/downloads.phtml</template></action>

This SHOULD give me a "Downloads" tab with a list view in it the same as the "Additional Information" tab but alas, it doesn't.

How do I tell Magento where to pull the information from - I have set up my attributes in the back end, they are in a group called "Downloads" in the attribute set so it should work.

Thanks, Myles

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 测距传感器数据手册i2c
    • ¥15 RPA正常跑,cmd输入cookies跑不出来
    • ¥15 求帮我调试一下freefem代码
    • ¥15 matlab代码解决,怎么运行
    • ¥15 R语言Rstudio突然无法启动
    • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
    • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
    • ¥15 用windows做服务的同志有吗
    • ¥60 求一个简单的网页(标签-安全|关键词-上传)
    • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法