VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: mesquiteman on September 19, 2012, 07:47:22 AM

Title: How do I move a custom filed on product page?
Post by: mesquiteman on September 19, 2012, 07:47:22 AM
Hello folks,

I am working on my first site with VM2 and trying to figure out some things.  I have a very limited knowledge of HTML and coding but do pretty good with just messing around with things.  I have a custom field set up for some child products but don't like where they show up on the page in the "ontop" position.  I have played around with Firebug and can get the field to show up where I want it there but have no idea what file to edit to put the code where I want it.  I know I need to do a template override and have read up on doing that, just don't know the file to edit once I copy it to my override folder.  Can anyone provide some good insight on what I need to do?  Attached is an image of what I am trying to accomplish as I did it in Firebug.  Any help would be greatly appreciated!


[attachment cleanup by admin]
Title: Re: How do I move a custom filed on product page?
Post by: PRO on September 20, 2012, 12:31:52 PM
I do not use child products, but do you have a url to look at?

Title: Re: How do I move a custom filed on product page?
Post by: mesquiteman on September 21, 2012, 01:50:30 AM
Here you go on the link:  http://www.bocknibs.com/index.php/bock-nibs2/bock/5-mm-bock-nibs-2-detail
Title: Re: How do I move a custom filed on product page?
Post by: mesquiteman on September 21, 2012, 02:04:59 AM
BTW, thanks Pro, for any insight you can provide!
Title: Re: How do I move a custom filed on product page?
Post by: PRO on September 21, 2012, 16:27:31 PM
http://forum.virtuemart.net/index.php?topic=90935.0



It appears to be set to the "ontop" position

YOU could

views/productdetails/tmpl/default.php
MOVE this

if (!empty($this->product->customfieldsSorted['ontop'])) {
   $this->position = 'ontop';
   echo $this->loadTemplate('customfields');
    } // Product Custom ontop end

The "add to cart" has its own template

views/productdetails/tmpl/default_addtocart.php
So, you could place that code in the add to cart file.


OR, create your own "position"
http://forum.virtuemart.net/index.php?topic=97419.0


Just copy the code, and rename the position

like

if (!empty($this->product->customfieldsSorted['new-position'])) {
   $this->position = 'new-position';
   echo $this->loadTemplate('customfields');
    } // Product Custom new-position end