My magento-product doesn't have any product detail infos (attributes) at my backend. But I see the empty "Product Detail Tab" on detail page. See screenshot.
How can I hide the Tabs in frontend. The Tabs are in my "catalog/product/view/tabs.phtml"
<?php foreach ($this->getTabs() as $_index => $_tab): ?>
<?php
if (($showDescription && $_tab['alias'] == 'description') || $_tab['alias'] != 'description') {
if (($showDetails && $_tab['alias'] == 'additional') || $_tab['alias'] != 'additional') {
if (($showDetailsTab && $_tab['alias'] == 'additional_tab') || $_tab['alias'] != 'additional_tab') {
if ($tmpBlock = $this->getChildHtml($_tab['alias'])) {
$_panes .= '<h2 class="acctab" id="acctab-' . $_tab['alias'] . '">' . $_tab['title'] . '</h2>';
$_panes .= '<div class="panel">' . $tmpBlock . '</div>';
}
}
}
}
?>
…
<div id="product-tabs" class="gen-tabs gen-tabs-style1">
<?php //IMPORTANT: id "product-tabs" is being used in: /catalog/product/view.phtml, /review/helper/summary*_nolinks.phtml ?>
<ul class="tabs clearer">
<?php foreach ($this->getTabs() as $_index => $_tab): ?>
<?php if (($showDescription && $_tab['alias'] == 'description') || $_tab['alias'] != 'description'): ?>
<?php if (($showDetails && $_tab['alias'] == 'additional') || $_tab['alias'] != 'additional'): ?>
<?php if (($showDetailsTab && $_tab['alias'] == 'additional_tab') || $_tab['alias'] != 'additional_tab'): ?>
<?php if ($this->getChildHtml($_tab['alias'])): ?>
<li id="tab-<?php echo $_tab['alias'] ?>"><a href="#"><?php echo $_tab['title'] ?></a></li>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
<?php endforeach; ?>
<?php echo $_extraTabs; //Append extra tabs after regular tabs ?>
</ul>
<div class="tabs-panels"><?php echo $_panes, $_extraPanes; //Append extra panels to regular panels ?></div>
</div>
Best Answer
The code in
tabs.phtml
looks like this:So if a tab content is empty then the tab is not shown.
Either you have a different code, or your tab content is not empty. It may contain something like
<div></div>
or something like that.In this case you can change the
if
statement to remove your tags.Maybe something like this: