在静态块中调用phtml模板


Call a phtml template in a static block

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

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

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

但什么也没发生。我知道目录/产品文件夹中的view.php这个命令有什么问题吗

FYI,在"view.phtml"中,只有一个集合:

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

下面是我的"grouped.phtml",它只是一个表:

<?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