1
votes

I have added a to my catalog.xml file, created a specifications.phtml file to be used as the template, and I’m calling echo $this->getChildHtml(’specifications’); in my view.phtml file.

However it’s not displaying anything at all. I’ve basically mirrored everything after the same type of thing for the product description (which works) but I’m not having any luck.

The content that I’m trying to pull in is under the product page and I think a custom section that is labeled “Specifications Tab”. Not sure if the space in the field name is causing issues or what.

Here is what I have in my view.phtml file:

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

This is the XML I added to my catalog.xml:

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

And this is the template file 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; ?>

Any help would be greatly appreciated! I’m not overly familiar with Magento or PHP.

Thanks,

1

1 Answers

0
votes

JUst change
<?php #echo $this->getChildHtml('specifications'); ?>

to

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