News:

Looking for documentation? Take a look on our wiki

Main Menu

add a custom fields into a tabs

Started by far2slow, April 11, 2012, 10:42:22 AM

Previous topic - Next topic

far2slow

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

<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

ok I have  sorted it


<?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

   <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>