VM: Additional Field next do Discription and Review

GK User
Fri Jul 01, 2016 4:30 pm
Hey,

Product in VM: ist there any opportunity to add another field next to description and review to include etxra information for e.g. the designer. Please see the image

thanks!
User avatar
Senior Boarder

teitbite
Sun Jul 03, 2016 10:21 am
I’m afraid that modifications such as this require extensive changes to the theme’s code; I do apologize but such large changes are custom work that are beyond the scope of our technical support.
User avatar
Moderator

GK User
Thu Oct 13, 2016 12:00 pm
Hey, thanks for the reply and sorry for the late response. It will also work for me, if the "review" next to the "description" can be renamed into e.g. "details" . If so is there any opportunity how I could include content into this area, similarly as the "description" part ? Thanks for help!
User avatar
Senior Boarder

teitbite
Sat Oct 15, 2016 5:14 pm
Hi

Renaming will not help since You will not be able to replace what's in tab. I've come up with an idea to use virtuemart custom fields. Each new field will create a new tab and anything for this custom field will show as tab content.

Edit file /html/com_virtuemart/productdetails/default.php and replace code for tabs with:

Code: Select all
   <?php
         $tabi = 1;
         $extratabs = array();
         $product = $this->product;
         $position = 'normal';
         $class = 'product-fields';
         
         if (!empty($product->customfieldsSorted[$position])) {
            ?>
               <?php foreach ($product->customfieldsSorted[$position] as $field) {
                  if ( $field->is_hidden ) //OSP http://forum.virtuemart.net/index.php?topic=99320.0
                  continue;

                     $extratabs[] = array(
                        'tabid'      => $tabi,
                        'title'      => $field->custom_title,
                        'display'    => $field->display,
                        'desc'       => vmText::_($field->custom_desc),
                        'field-type' => $field->field_type
                     );
                     $tabi++;
                  /*?><dl class="product-field product-field-type-<?php echo $field->field_type ?>">
                     <?php if ($field->custom_title != $custom_title and $field->show_title) : ?>
                     <dt><?php echo vmText::_ ($field->custom_title) ?></dt>
                     <?php endif; ?>
                     
                     <?php if (!empty($field->display)) : ?>
                     <dd class="product-field-display"><?php echo $field->display ?></dd>
                     <?php endif; ?>
                     
                     <?php if (!empty($field->custom_desc)) : ?>
                     <dd class="product-field-desc"><?php echo vmText::_($field->custom_desc) ?></dd>
                     <?php endif; ?>
                  </dl>
               <?php
                  $custom_title = $field->custom_title; */
               } ?>
         <?php
         }
   ?>

   <?php if(!empty($this->product->product_desc) && ($this->allowRating || $this->allowReview || $this->showRating || $this->showReview)) : ?>
   <ul id="product-tabs">
      <li data-toggle="product-description" class="active"><?php echo vmText::_('COM_VIRTUEMART_PRODUCT_DESC_TITLE') ?></li>
      <!--<li data-toggle="customer-reviews"><?php echo vmText::_ ('COM_VIRTUEMART_REVIEWS') ?></li>-->
      <?php foreach( $extratabs as $extratab ): ?>
         <?php if($extratab['display']||$extratab['desc']&&$extratab['title']): ?>
         <li data-toggle="custom-tab <?php echo $extratab['tabid']; ?>"><?php echo $extratab['title']; ?></li>
         <?php endif; ?>
      <?php endforeach; ?>
   </ul>
   <?php endif; ?>

   <div id="product-tabs-content">
      <div class="product-description gk-product-tab active">
         <?php
         // Product Description
         if (!empty($this->product->product_desc)) :
             ?>
              <div class="product-description">
               <?php if (!empty($this->product->product_s_desc)) : ?>
               <div class="product-short-description">
                   <?php echo nl2br($this->product->product_s_desc); ?>
               </div>
               <?php endif; ?>
               <?php echo $this->product->product_desc; ?>
              </div>
         <?php
          endif; // Product Description END

          // Product Packaging
          $product_packaging = '';
          if ($this->product->product_box) :
         ?>
              <div class="product-box">
                <?php echo vmText::_('COM_VIRTUEMART_PRODUCT_UNITS_IN_BOX') .$this->product->product_box; ?>
              </div>
          <?php endif; // Product Packaging END ?>
      </div>
      
      
      <?php /* if($this->allowRating || $this->allowReview || $this->showRating || $this->showReview) : ?>
      <div class="customer-reviews gk-product-tab">
         <?php echo $this->loadTemplate('reviews'); ?>
      </div>
      <?php endif; */ ?>

      <?php foreach( $extratabs as $extratab ): ?>
         <?php if($extratab['display']||$extratab['desc']): ?>
         <div class="gk-product-tab <?php echo $extratab['tabid']; ?>">
            <div class="product-field product-field-type-<?php echo $field->field_type ?>">
               <?php if($extratab['display']): ?>
               <div class="product-field-display"><?php echo nl2br($extratab['display']); ?></div>
               <?php endif; ?>

               <?php if($extratab['desc']): ?>
               <div class="product-field-desc"><?php echo nl2br($extratab['desc']); ?></div>
               <?php endif; ?>
            </div>
         </div>
         <?php endif; ?>
      <?php endforeach; ?>

   </div>
User avatar
Moderator


cron