Author Topic: add a custom fields into a tabs  (Read 1881 times)

far2slow

  • Beginner
  • *
  • Posts: 4
add a custom fields into a tabs
« on: April 11, 2012, 10:42:22 am »
can anyone help me with this, I have spent many hours trying to get this to work before i thought best ask someone for help, i am trying to add a custom fields into a tabs, how do i this the tab code i have looks like

Code: [Select]
<div class="tabs">
<ul style="padding:0px;margin:0px;" id="vmtabs" class="shadetabs">
<li style="padding:0px;margin:0px;background:none;" class="selected"><a href="#" rel="desc"><span><?php echo JText::_('COM_VIRTUEMART_PRODUCT_DESC_TITLE'?></span></a></li>
<?php if ($this->showReview) {?><li style="padding:0px;margin:0px;background:none;"><a href="#" rel="reviews"><span>Product Reviews</span></a></li><?php ?>
<?php if (!empty($this->product->customfieldsRelatedProducts)) { ?><li style="padding:0px;margin:0px;background:none;"><a href="#" rel="related"><span><?php echo JText::_('COM_VIRTUEMART_RELATED_PRODUCTS'); ?></span></a></li><?php ?>
            <?php if (!empty($this->product->customfieldsRelatedCategories)) { ?><li style="padding:0px;margin:0px;background:none;"><a href="#" rel="relcategories"><span><?php echo JText::_('COM_VIRTUEMART_RELATED_CATEGORIES'); ?></span></a></li><?php }?>
            <?php if ((VmConfig::get('showCategory',1)) and ($this->category->haschildren) ) { ?><li style="padding:0px;margin:0px;background:none;"><a href="#" rel="subcategories"><span><?php echo JText::_('COM_VIRTUEMART_SUBCATEGORIES'); ?></span></a></li><?php }?>
           
           
</ul>

<div class="tabcontent-container">

<div id="desc" class="tabcontent">
<p class="vmProductDesc"><?php // Product Description
if (!empty($this->product->product_desc)) { ?>

<div class="product-description">
<?php echo $this->product->product_desc?>
</div>
<?php // Product Description END ?>


I did have some sucsess  but could not check if that custom field had content to display, if not i dont want to display the tab
any help please

far2slow

  • Beginner
  • *
  • Posts: 4
Re: add a custom fields into a tabs
« Reply #1 on: April 11, 2012, 19:41:50 pm »
ok I have  sorted it


Code: [Select]
<?php if (!empty($this->product->customfieldsSorted['Specifications'])) { ?>
            <li style="padding:0px;margin:0px;background:none;" class="selected"><a href="#" rel="Specifications"><span><?php echo JText::_('Specifications'?></span></a></li><?php ?>

then

Code: [Select]
   <div id="Specifications" class="tabcontent">
<p class="vmProductDesc">
            <?php if (!empty($this->product->customfieldsSorted['Specifications'])) { ?>
   <div class="product-fields">
   <?php
   $custom_title 
null ;
   foreach (
$this->product->customfieldsSorted['Specifications'] as $field){
      if (
$field->display) {
         
?>
<div class="product-field product-field-type-<?php echo $field->field_type ?>">
       <span class="product-field-display"><?php echo $field->display ?></span>
          </div>
         <?php
         $custom_title 
$field->custom_title;
      }
   } 
   
?>

   </div>
<?php // Product Custom specifications end ?>
    </p></div>