Hi,
I have a custom field in a tab that I would like to hide when custom field is empty. Any ideas?
My actual code for tabs is:
<div id="tab-block" class="tab-block">
<ul class="nav nav-pills" id="ShopTab">
<?php if (!empty($this->product->product_desc)) {?>
<li class="tab_des active">
<a data-toggle="tab" href="#Shop-description"><?php echo JText::_('Shop_JSHOP_FULL_DESCRIPTION'); ?></a>
</li>
<?php }?>
<li class="tab_des">
<a data-toggle="tab" href="#Shop-ingredients"><?php echo JText::_('INGREDIENTS'); ?></a>
</li>
<li class="tab_des">
<a data-toggle="tab" href="#Shop-allergens"><?php echo JText::_('ALLERGENS'); ?></a>
</li>
<li class="tab_des">
<a data-toggle="tab" href="#Shop-nutrition"><?php echo JText::_('NUTRITIONAL INFORMATION'); ?></a>
</li>
<li class="tab_review last"><a data-toggle="tab" href="#Shop-reviews"><?php echo JText::_('REVIEWS'); ?></a></li>
</ul>
<div id="ShopTabContent" class="tab-content">
<?php // Product Description
if (!empty($this->product->product_desc)) { ?>
<div id="Shop-description" class="tab-pane fade in product-description active">
<?php /** @todo Test if content plugins modify the product description */ ?>
<span class="title"><?php echo vmText::_('') ?></span>
<?php echo $this->product->product_desc; ?>
</div>
<?php } // Product Description END ?>
<div id="Shop-allergens" class="tab-pane">
<?php echo shopFunctionsF::renderVmSubLayout('customfields', array('product'=>$this->product, 'position'=>'tabcustom1'));
?> </div>
<div id="Shop-ingredients" class="tab-pane">
<?php
echo shopFunctionsF::renderVmSubLayout('customfields', array('product'=>$this->product, 'position'=>'tabcustom2'));
?> </div>
<div id="Shop-nutrition" class="tab-pane">
</div>
<div id="Shop-reviews" class="tab-pane fade product-review">
<?php
echo $this->loadTemplate('reviews');
?>
</div>
</div>
</div>
<?php
I'm using Joomla! 3.7.5 Stable, PHP 7.0.18, Virtuemart 3.2.2
Thank you very much!
Try this:
if(!empty($this->product->customfieldsSorted['tabcustom1'])){...
Hi,
I tried, and is completely hiding from everywhere even if the field is not empty :'(
@ghosts code should work
surround each <li> then each div with the appro. if statement
Hi,
Tried again, and is working now 8). Thank you very much Ghost and GJC Web Design. I appreciate your help.
Have a good weekend!