VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: romello on December 14, 2012, 15:07:16 PM

Title: Virtuemart2 Custom Fields - Layout Options and Positions
Post by: romello on December 14, 2012, 15:07:16 PM

Hello Virtuemart Forum,


I have a small issue with the Virtuemart layout on my Joomla template.

1. The VM standard layout options seems to be ontop, onbot and normal.

2. However, it seems that VM2 renders the layout this way:

A. Custom fields with "Cart Attribute"s are automatically rendered to the right side of the product image...  which seems to be another position.
B. To achieve my workflow...   I need to  place  a couple of custom field that are not "cart variants"  on this: right side of product image position. (whatever it is)

3. Question

A. What is/ where is the position code for the custom fields located the right side of the product image? For example, the position where the "add to cart" button is located? What position is this ?

B. What "position" would I add to the  code below to render a new custom field (non-cart variant)  on the right side of the product image?

- In the code block below... what do I replace "my-position" with to place custom fields on the right side of the vm2 product image?

<?php if (!empty($this->product->customfieldsSorted['my-position'])) {
$this->position='my-position';
echo $this->loadTemplate('customfields');
}
?>


Thanks in advance for any assistance,

Romello

VM 2012f
J2.5
Title: Re: Virtuemart2 Custom Fields - Layout Options and Positions
Post by: bytelord on December 14, 2012, 15:23:56 PM
Hello,

Just create your own position and place the code you post where you desire, use some CSS/HTML to style it.
For example add the position beside-image and change the code

<?php if (!empty($this->product->customfieldsSorted['beside-image'])) {
$this->position='beside-image';
echo $this->loadTemplate('customfields');
}
?>

Regards
Title: Re: Virtuemart2 Custom Fields - Layout Options and Positions
Post by: PRO on December 14, 2012, 23:16:51 PM
cart variants are added to the "add to cart form"

so, there is not a "position", they are automatic

BUT!!!!

You can actually add the code for your position in the default_addtocart.php or default_images.php


<?php foreach ($this->product->customfieldsSorted[$this->position] as $field) {
         if ($field->layout_pos == my-new-position) {
         echo $field->display;
         }
       }
       ?>



Title: Re: Virtuemart2 Custom Fields - Layout Options and Positions
Post by: CenturionSigns on December 20, 2012, 13:24:13 PM
This is exactly what I need to do as well.

Could someone let me know:

1. where to "create a position"
2. what code I should create, and which files to paste it in

Thanks so much! 
Title: Re: Virtuemart2 Custom Fields - Layout Options and Positions
Post by: PRO on December 20, 2012, 13:29:38 PM
http://forum.virtuemart.net/index.php?topic=97419.0