News:

Support the VirtueMart project and become a member

Main Menu

Display multiple custom fields in product page

Started by patben, May 15, 2013, 16:52:54 PM

Previous topic - Next topic

patben

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.

AH

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

Joomla 4.4.5
php 8.1