Yes it is possible, you just need to make some changes in "catalog/view/theme/default/template/product/product.tpl" assuming you are using the default template or "catalog/view/theme/default/'template name'/product/product.tpl" if using a different templatefrosty1_4me wrote:Is it possible to hide that tab if there has been no description input?
Thanks very much.
You need to test if $description is empty so you need to wrap
Code: Select all
<a href="#tab-description"><?php echo $tab_description; ?></a>
Code: Select all
<div id="tab-description" class="tab-content"><?php echo $description; ?></div>
Code: Select all
<?php if (!(ctype_space($description) || $description == '')) { ?>
<a href="#tab-description"><?php echo $tab_description; ?></a>
<?php } ?>
Code: Select all
<?php if (!(ctype_space($description) || $description == '')) { ?>
<div id="tab-description" class="tab-content"><?php echo $description; ?></div>
<?php } ?>
Cheers
Attachments
Do not display "Description Tab" if content is empty
Rebdog
Extra Product Tabs
Hi ,
I m using oc version 2.0.1.1 on Journal 2.9.4 . so this is same code i ve to paste in product.tpl
I m using oc version 2.0.1.1 on Journal 2.9.4 . so this is same code i ve to paste in product.tpl
rebdog wrote: ↑Sat Dec 01, 2012 2:31 pmYes it is possible, you just need to make some changes in "catalog/view/theme/default/template/product/product.tpl" assuming you are using the default template or "catalog/view/theme/default/'template name'/product/product.tpl" if using a different templatefrosty1_4me wrote:Is it possible to hide that tab if there has been no description input?
Thanks very much.
You need to test if $description is empty so you need to wrap
andCode: Select all
<a href="#tab-description"><?php echo $tab_description; ?></a>
in a check to see if $description is empty, as belowCode: Select all
<div id="tab-description" class="tab-content"><?php echo $description; ?></div>
andCode: Select all
<?php if (!(ctype_space($description) || $description == '')) { ?> <a href="#tab-description"><?php echo $tab_description; ?></a> <?php } ?>
There is a vqmod attached that might help, if you are using the default templateCode: Select all
<?php if (!(ctype_space($description) || $description == '')) { ?> <div id="tab-description" class="tab-content"><?php echo $description; ?></div> <?php } ?>
Cheers
Hi ,
I m using oc version 2.0.1.1 on Journal 2.9.4 . so this is same code i ve to paste in product.tpl
I m using oc version 2.0.1.1 on Journal 2.9.4 . so this is same code i ve to paste in product.tpl
rebdog wrote: ↑Sat Dec 01, 2012 2:31 pmYes it is possible, you just need to make some changes in "catalog/view/theme/default/template/product/product.tpl" assuming you are using the default template or "catalog/view/theme/default/'template name'/product/product.tpl" if using a different templatefrosty1_4me wrote:Is it possible to hide that tab if there has been no description input?
Thanks very much.
You need to test if $description is empty so you need to wrap
andCode: Select all
<a href="#tab-description"><?php echo $tab_description; ?></a>
in a check to see if $description is empty, as belowCode: Select all
<div id="tab-description" class="tab-content"><?php echo $description; ?></div>
andCode: Select all
<?php if (!(ctype_space($description) || $description == '')) { ?> <a href="#tab-description"><?php echo $tab_description; ?></a> <?php } ?>
There is a vqmod attached that might help, if you are using the default templateCode: Select all
<?php if (!(ctype_space($description) || $description == '')) { ?> <div id="tab-description" class="tab-content"><?php echo $description; ?></div> <?php } ?>
Cheers
In file /catalog/view/theme/journal2/template/product/product.tpl
change the lines
Code: Select all
<?php if (!$this->journal2->settings->get('hide_product_description')) { ?>
<li <?php if ($is_active) { echo 'class="active"'; $is_active = false; } ;?>><a href="#tab-description" data-toggle="tab"><?php echo $tab_description; ?></a></li>
<?php } ?>
Chris, Opencart Developers and Programmers,
Opencart Developers Opencart Programmers
https://www.chrisranjana.com
In my theme's product.tpl file, through trial & error I found that commenting out the following block of lines removes the description tab for every product:
So shouldn't it work if I place the recommended IF statement line: before this block and at the end of this block? Because doing this doesn't seem to do anything - the description tab still appears for products with no description. It suggests to me that the IF statement is not working properly. Is there an alternate way to write up that IF statement?
Code: Select all
<ul class="nav nav-tabs" role="tablist">
<?php $i = 0; foreach($tabs as $tab) { $i++;
$id = 'tab_'.$i;
if($tab['content'] == 'description') { $id = 'tab-description'; }
if($tab['content'] == 'attribute') { $id = 'tab-attribute'; }
if($tab['content'] == 'review') { $id = 'tab-review'; }
$class = false;
if($i == 1) { $class = 'class="active"'; $new_active = $id; }
echo '<li role="presentation" ' . $class . '><a href="#'.$id.'" aria-controls="'.$id.'" role="tab" data-toggle="tab">'.$tab['heading'].'</a></li>';
} ?>
</ul>
<div class="tab-content">
<?php $i = 0; foreach($tabs as $tab) { $i++;
$id = 'tab_'.$i;
if($tab['content'] != 'description' && $tab['content'] != 'attribute' && $tab['content'] != 'review') {
echo '<div id="'.$id.'" class="tab-pane';
if($new_active == $id) { echo ' active'; }
echo '" role="tabpanel">'.$tab['content'].'</div>';
}
} ?>
Code: Select all
<?php if (!(ctype_space($description) || $description == '')) { ?>
Code: Select all
<?php } ?>
Who is online
Users browsing this forum: No registered users and 7 guests