VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product creation => Topic started by: patben on May 15, 2013, 16:52:54 PM

Title: Display multiple custom fields in product page
Post by: patben on May 15, 2013, 16:52:54 PM
Hi

I want to display multiple custom fields in one place on product page, I have custom fields for books,  like pages, ISBN, publisher, etc and i want to display them together  like specification.
Title: Re: Display multiple custom fields in product page
Post by: AH on June 09, 2013, 19:53:02 PM
Give your custom fields a distinct "Layout position " make them all the same if required

Then create a product page override view to include the new "Layout position" for the custom field display.

e.g.

<div class="new_customfields">
       <?php 
       if (!empty($this->product->customfieldsSorted['new_custom_field_position'])) {
         $this->position = 'new_custom_field_position';
         echo $this->loadTemplate('customfields');
        } // Product Custom product_spec end
       ?>

</div>   


If you want to change the layout for the custom fields then create an override to the default_customfields.php

e.g. "default_new_display_of_customfields"

and reference this in teh loadTemplate (see below)

<div class="new_customfields">
       <?php 
       if (!empty($this->product->customfieldsSorted['new_custom_field_position'])) {
         $this->position = 'new_custom_field_position';
         echo $this->loadTemplate('new_display_of_customfields');
        } // Product Custom product_spec end
       ?>

</div>   
Title: Re: Display multiple custom fields in product page
Post by: patben on June 10, 2013, 18:24:48 PM
thank you