在静态块中调用 phtml 模板

Call a phtml template in a static block

我想调用选项卡 "SPECIFICATION" 中的 "view.phtml" 模板(位于静态块中),以便我可以显示 table 分组产品。

在块内容的那个选项卡中,我添加了以下命令:

{{block type="catalog/product" template="catalog/product/view.phtml"}}

但是没有任何反应。我知道 view.php 位于 catalog/product 文件夹中。 这个命令有什么问题吗?

仅供参考, "view.phtml"中只有一句:

<?php echo $this->getChildHtml('product_type_data') ?>

下面是我的"grouped.phtml",只不过是一个table:

<?php $this->setPreconfiguredValue(); ?>
<?php $_product = $this->getProduct(); ?>
<?php $_associatedProducts = $this->getAssociatedProducts(); ?>
<?php $_hasAssociatedProducts = count($_associatedProducts) > 0; ?>
<?php echo $this->getChildHtml('product_type_data_extra') ?>
<div class="grouped-items-table-wrapper" style="border:0px;">
    <table class="data-table grouped-items-table" id="super-product-table" style="width:75%;margin-left:10px;">
        <tbody>
        <tr style="background-color:#091f36;color:white;">
                <td class="" colspan="2">
                    <p>
                        XCEL Part <br/>
                           No.
                    </p>
                </td>
                <td class="">
                    <p>
                        Fence <br/> H'
                    </p>
                </td>
                <td class="">
                    <p>
                        Fence <br/> W'
                    </p>
                </td>
                <td class="">
                    <p>
                        Fence<br/> H/mm 
                    </p>
                </td>
                <td class="">
                    <p>
                        Fence <br/>W/mm 
                    </p>
                </td>
                <td class="">
                    <p>
                        Pickets <br/>Qty.
                    </p>
                </td>
                <td class="">
                    <p>
                        Rails<br/> Qty. 
                    </p>
                </td>
                <td class="">
                    <p>
                        Rings<br/> Qty.
                    </p>
                </td>
                <td class="">
                    <p>
                        Panel <br/>LB 
                    </p>
                </td>
                <td class="">
                    <p>
                        Panel <br/>KG
                    </p>
                </td>
        </tr>
        <?php if ($_hasAssociatedProducts): ?>
        <?php foreach ($_associatedProducts as $_item): ?>
            <?php $_finalPriceInclTax = $this->helper('tax')->getPrice($_item, $_item->getFinalPrice(), true) ?>
            <tr>
                <td class="" colspan="2">
                    <p>
                        <?= $_item->getSKU() ?> 
                    </p>
                </td>
                <td class="">
                    <p>
                        <?= $_item->getAttributeText('height') ?> 
                    </p>
                </td>
                <td class="">
                    <p>
                        <?= $_item->getAttributeText('width') ?>
                    </p>
                </td>
                <td class="">
                    <p>
                        <?= $var=ceil(($_item->getAttributeText('height'))/0.0032808) ?> 
                    </p>
                </td>
                <td class="">
                    <p>
                        <?= $var=ceil(($_item->getAttributeText('width'))/0.0032808) ?> 
                    </p>
                </td>
                <td class="">
                    <p>
                        20
                    </p>
                </td>
                <td class="">
                    <p>
                        <?= $_item->getAttributeText('rail') ?> 
                    </p>
                </td>
                <td class="">
                    <p>
                        <?= $_item->getAttributeText('ring') ?> 
                    </p>
                </td>
                <td class="">
                    <p>
                        <?= $var=round($_item->getWeight(), 2) ?> 
                    </p>
                </td>
                <td class="">
                    <p>
                        <?= $var=round((($_item->getWeight())/2.2046),2) ?> 
                    </p>
                </td>

            </tr>
        <?php endforeach; ?>
        <?php else: ?>
           <tr>
               <td colspan="<?php if ($_product->isSaleable()): ?>4<?php else : ?>3<?php endif; ?>"><?php echo $this->__('No options of this product are available.') ?></td>
           </tr>
        <?php endif; ?>
        </tbody>
    </table>
</div>
<script type="text/javascript">decorateTable('super-product-table')</script>
{{block type="catalog/product_view" template="catalog/product/view.phtml"}}

正如你提到的,你已经在里面定义了 catalog->product->view->view.php

在你的块类型中你定义了 "catalog/product_view" 所以你的 view.php 文件应该在 catalog->product->view.php