Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用getChildHtml显示产品属性不起作用_Php_Xml_Magento - Fatal编程技术网

Php 使用getChildHtml显示产品属性不起作用

Php 使用getChildHtml显示产品属性不起作用,php,xml,magento,Php,Xml,Magento,我在catalog.xml文件中添加了一个,创建了一个specifications.phtml文件用作模板,并调用echo$this->getChildHtml('specifications');在my view.phtml文件中 然而,它没有显示任何东西。我基本上已经为产品描述镜像了相同类型的东西(这很有效),但我没有任何运气 我试图插入的内容在产品页面下,我认为是一个标记为“规格选项卡”的自定义部分。不确定字段名中的空格是否导致问题或什么 以下是我的view.phtml文件中的内容: &l

我在catalog.xml文件中添加了一个,创建了一个specifications.phtml文件用作模板,并调用echo$this->getChildHtml('specifications');在my view.phtml文件中

然而,它没有显示任何东西。我基本上已经为产品描述镜像了相同类型的东西(这很有效),但我没有任何运气

我试图插入的内容在产品页面下,我认为是一个标记为“规格选项卡”的自定义部分。不确定字段名中的空格是否导致问题或什么

以下是我的view.phtml文件中的内容:

<div id="product-tabs" class="tabs">

    <ul class="tabs-nav">
        <li><a href="#tab-description"><?php echo $this->__('Description'); ?></a></li>

        <?php
        $specificationsTabContent = $_product->getSpecificationsTab(); 
        $videoTabContent = $_product->getVideoTab();
        $faqTabContent = $_product->getFaqTab();
        $howitworksTabContent = $_product->getHowitworksTab();
        $awardsTabContent = $_product->getAwardsTab();

        ?>

        <?php #if ($this->getChildHtml('specifications_tab')): #($this->getChildHtml('product_attributes')): ?>
        <?php if (!empty($specificationsTabContent)) : ?>
        <li><a href="#tab-details"><?php echo $this->__('Specs'); ?></a></li>
        <?php endif; ?>

        <?php if (!empty($videoTabContent)) : ?>
        <li><a href="#tab-video"><?php echo $this->__('Videos14'); ?></a></li>
        <?php endif; ?>

        <?php if (!empty($faqTabContent)) : ?>
        <li><a href="#tab-faq"><?php echo $this->__('FAQs'); ?></a></li>
        <?php endif; ?>

        <?php if (!empty($howitworksTabContent)) : ?>
        <li><a href="#tab-howitworks"><?php echo $this->__('How It Works'); ?></a></li>
        <?php endif; ?>

        <?php if (!empty($awardsTabContent)) : ?>
        <li><a href="#tab-awards"><?php echo $this->__('Awards'); ?></a></li>
        <?php endif; ?>

        <!-- <li><a href="#tab-tags"><?php #echo $this->__('Tags'); ?></a></li> -->

        <?php if ($this->getChildHtml('snippet_product_view_tab_1')): ?>
            <li><a href="#tab-custom-1"><?php echo $this->__('Custom 1'); ?></a></li>
        <?php endif; ?>

        <?php if ($this->getChildHtml('snippet_product_view_tab_2')): ?>
            <li><a href="#tab-custom-2"><?php echo $this->__('Custom 2'); ?></a></li>
        <?php endif; ?>
    </ul>

    <div class="tabs-content">

        <div id="tab-description">
            <?php echo $this->getChildHtml('description'); ?>
        </div>

        <div id="tab-details">
            <?php #echo $this->getChildHtml('specifications'); ?>
            <?php echo $specificationsTabContent; ?>
        </div>

        <div id="tab-faq">
            <?php echo $faqTabContent; ?>
        </div>

        <div id="tab-video">
            <?php echo $videoTabContent; ?>
        </div>

        <div id="tab-howitworks">
            <?php echo $howitworksTabContent; ?>
        </div>

        <div id="tab-awards">
            <?php echo $awardsTabContent; ?>
        </div>

        <!-- <div id="tab-tags">
            <?php echo $this->getChildHtml('product_additional_data') ?>
        </div> -->

        <?php if ( $this->getChildHtml('snippet_product_view_tab_1') ): ?>
        <div id="tab-custom-1">
            <div class="snippet snippet-product-view-tab-1"><?php echo $this->getChildHtml('snippet_product_view_tab_1') ?></div>
        </div>
        <?php endif; ?>

        <?php if ( $this->getChildHtml('snippet_product_view_tab_2') ): ?>
        <div id="tab-custom-2">
            <div class="snippet snippet-product-view-tab-2"><?php echo $this->getChildHtml('snippet_product_view_tab_2') ?></div>
        </div>
        <?php endif; ?>
    </div>

  </div>

这是我添加到我的catalog.XML中的XML:

            <!-- specifications -->
            <block type="catalog/product_view_specifications" name="product.specifications.tab" as="specifications" template="catalog/product/view/specifications.phtml"/>

这是模板文件specifications.phtml:

<?php $_specifications = $this->getProduct()->getSpecificationsTab(); ?>

<?php if ($_specifications): ?>
    <h2><?php echo $this->__('Specifications') ?></h2>

    <div class="long-description std">
        <?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), $_specifications, 'specifications') ?>
    </div>
<?php endif; ?>

任何帮助都将不胜感激!我对Magento或PHP不太熟悉

谢谢,

只要换衣服就行了


感谢您的回复,但这不是原因。我已经注释掉了内容显示未格式化。即使我删除#符号,它也不会显示任何内容。
 <?php echo $this->getChildHtml('specifications'); ?>