News:

Support the VirtueMart project and become a member

Main Menu

No custum fields displaying

Started by amanda mc donald, April 02, 2012, 21:47:46 PM

Previous topic - Next topic

amanda mc donald

Hi

I'm using Joomla 2.5 and VM 2.0.2

To display custom fields in the Products Details Page I have the following code :

<?php if (!empty($this->product->customfields)) { ?>
         <div class="product-fields">
      <?php
      $custom_title = null ;
      foreach ($this->product->customfields as $field){
         ?><div style="display:inline-block;" class="product-field product-field-type-<?php echo $field->field_type ?>">
         <?php if ($field->custom_title != $custom_title) { ?>
            <span class="product-fields-title" ><b><?php echo JText::_($field->custom_title); ?></b></span>
         <br>
         <span class="product-field-display"><?php echo $field->display ?></span>
         <span class="product-field-desc"><?php echo jText::_($field->custom_field_desc) ?></span>
         </div>
         <?php
         $custom_title = $field->custom_title;
      } ?>
      </div>
      <?php


It is not working - can anybody please tell me what is wrong (it worked perfectly well with Joomla 1.7 and VM 2.0)?

Thank you

amanda mc donald

Problem SOLVED!

For those struggling with the same issue ... this is what I've done.

1.  Created a custom field (or more) in virtuemart back-end, and gave it a Layout Position of on top
2.  Then I added the following code to the php file ... joomla/templates/...your template.../html/com_virtuemart/productdetails/default.php

Quote<div class="productDetails">
      <?php    if (!empty($this->product->customfieldsSorted['ontop'])) {
      $this->position='ontop';
      $custom_title = null ;
      foreach ($this->product->customfieldsSorted['ontop'] as $field){
         ?><div style="display:inline-block;" class="product-field product-field-type-<?php echo $field->field_type ?>">
         <?php if ($field->custom_title != $custom_title) { ?>
            <span class="product-fields-title" ><b><?php echo JText::_($field->custom_title); ?></b></span>
         <!-- <?php echo JHTML::tooltip($field->custom_tip,  JText::_($field->custom_title), 'tooltip.png');
         } ?> -->
         <br>
         <span class="product-field-display"><?php echo $field->display ?></span>
         <span class="product-field-desc"><?php echo jText::_($field->custom_field_desc) ?></span>
         </div>
         <?php
         $custom_title = $field->custom_title;
      } ?>
         </div>

3.  It will give you a layout on the frond end that looks like this:
      Heading:
      Description

4.  If you would like a custom tip to display just remove from the code (line 9 and 10) <!--       -->