VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: baroen on June 13, 2014, 15:45:27 PM

Title: per custom field another layout position
Post by: baroen on June 13, 2014, 15:45:27 PM
Is it possible to show custom fields on specific layout positions?
I want to show one custom field directly under the product name, and another custom field just above the add-to-cart button.
Title: Re: per custom field another layout position
Post by: GJC Web Design on June 13, 2014, 17:09:16 PM
I just loop thru and if there is a match display it where I want

e.g.


foreach ($product->customfields as $field) {
if(($field->virtuemart_custom_id == '33')){

echo $field->custom_value;

}
}



or if lots assign them to a var  with a switch statement


foreach ($product->customfields as $field) {

switch ($field->virtuemart_custom_id) {
  case "33":
    $custom1 =  $field->custom_value;
    break;
  case "36":
    $custom2 =  $field->custom_value;
    break;
   
}
}

echo $custom1;

echo $custom2;




code not checked but u get the idea
Title: Re: per custom field another layout position
Post by: balai on June 13, 2014, 23:32:49 PM
i think that by default there are som positions like ontop, onbottom which you can use in the position field of custom field.
You can also add your own in the product details layout