cancel
Showing results for 
Search instead for 
Did you mean: 

Hide a Custom Tab with no information on Product Page

Hide a Custom Tab with no information on Product Page

I have successfully added a tab to my view.phtml page located at app/design/frontend/enterprise/aps/template/catalog/product.

I tried an if statement to hide it if the Specifications field is empty, i.e. no content. The issue is, it doesn't work. It still shows the tab even if there is no content.

My code is below at the end of post.

2 Questions:

  1. Am I taking the correct approach? Basically, I am making a tab to have an Expert Review tab. I originally was going to use a cms block, but figured purposing the Specifications field was easier, for one, but also I could ignore the tab if no content

  2. Can you please help ? Smiley Happy

Thanks so much and here is my code and I attached a screenshot of the empty tabs.

 

<div class="wa-product-details-tab product-description">
            <div class="wa-product-details-tab-heading product-desc-tab">
                <div rel=".wa-product-tab-details-item-1" class="wa-product-heading-item wa-product-heading-item-1 wa-product-heading-item-active">
                    <span>Description</span>
                </div>
                <div rel=".wa-product-tab-details-item-2" class="wa-product-heading-item wa-product-heading-item-2">
                    <span>Specs</span>
                </div>
                <div rel=".wa-product-tab-details-item-3" id="review-form" class="wa-product-heading-item wa-product-heading-item-3">
                <?php
                    $summaryData = Mage::getModel('review/review_summary')
                                    ->setStoreId(Mage::app()->getStore()->getId())
                                    ->load($_product->getId());
                ?>
                <span >Reviews &nbsp;(<?php echo $summaryData->getReviewsCount();?>)</span>

                </div>
                <div rel=".wa-product-tab-details-item-4" class="wa-product-heading-item wa-product-heading-item-4">
                    <span>APS Advisor Review</span>
                </div>
            </div>

            <div class="wa-product-tab-details product-desc">
                <div style="display: block;" class="wa-product-tab-details-item wa-product-tab-details-item-1">
                    <?php  echo $_product->getDescription();  ?>
                </div>

                <div style="display: none;" class="wa-product-tab-details-item wa-product-tab-details-item-2">

                    <p> <?php echo $this->getChildHtml('additional')?></p>

                </div>
                <div style="display: none;" class="wa-product-tab-details-item wa-product-tab-details-item-3">

                    <p>
                    <?php echo $this->getChildHtml('review_form') ?>
                    <?php echo $this->getChildHtml('product_additional_data_review') ?>

                    </p>

                </div>
                <div style="display: none;" class="wa-product-tab-details-item wa-product-tab-details-item-4">
                    <?php  if ($_product->getSpecifications()); ?>
                </div>
            </div>

Product Page with no tab