VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product creation => Topic started by: owegen on August 12, 2014, 22:00:16 PM

Title: how to show the value of a custom field in the product details page? [solved]
Post by: owegen on August 12, 2014, 22:00:16 PM
hello,

how to show the value of a custom field in the product details page?

I guess I have to modify (overide) the file default.php in /components/com_virtuemart/views/productdetails/tmpl

but how? The name of my custom field is prix_de_vente

many thanks for your help!

Raphael

[attachment cleanup by admin]
Title: Re: how to show the value of a custom field in the product details page?
Post by: balai on August 13, 2014, 12:12:39 PM
I don't think that you need anything else.

If you are using the default Virtuemart layouts normally you should get it.
Also try to enter some layout positions (e.g. ontop)
Title: Re: how to show the value of a custom field in the product details page?
Post by: owegen on August 13, 2014, 12:39:46 PM
Quote from: balai on August 13, 2014, 12:12:39 PM
If you are using the default Virtuemart layouts normally you should get it.

How can I know that?  :-\
Title: Re: how to show the value of a custom field in the product details page?
Post by: owegen on August 13, 2014, 12:48:19 PM
hello balai,

I tried to enter a layout position "ontop" but it doesn't seem to run.



[attachment cleanup by admin]
Title: Re: how to show the value of a custom field in the product details page?
Post by: GJC Web Design on August 13, 2014, 13:22:56 PM
I assume you've "attached" this custom field to your product?
Title: Re: how to show the value of a custom field in the product details page?
Post by: owegen on August 13, 2014, 13:36:49 PM
Quote from: GJC Web Design on August 13, 2014, 13:22:56 PM
I assume you've "attached" this custom field to your product?

I am not sure I understand what you mean with "attached".

I created an new custom file.

Raphael
Title: Re: how to show the value of a custom field in the product details page?
Post by: GJC Web Design on August 13, 2014, 17:02:02 PM
and then go to the products and add that custom field... on the (surprisingly named ;)   ) custom field tab
Title: Re: how to show the value of a custom field in the product details page?
Post by: owegen on August 13, 2014, 18:08:55 PM
you mean that?

I already did that before but it doesn't work.



[attachment cleanup by admin]
Title: Re: how to show the value of a custom field in the product details page?
Post by: GJC Web Design on August 13, 2014, 19:08:41 PM
can only be your template then - have you tried with a std Beez etc?
Title: Re: how to show the value of a custom field in the product details page?
Post by: owegen on August 13, 2014, 19:21:48 PM
Quote from: GJC Web Design on August 13, 2014, 19:08:41 PM
can only be your template then - have you tried with a std Beez etc?

I gues that's the problem. And I don't know what I have to change in the php code to show this value.
Title: Re: how to show the value of a custom field in the product details page?
Post by: GJC Web Design on August 13, 2014, 19:42:35 PM
compare the std template to what you have
Title: Re: how to show the value of a custom field in the product details page?
Post by: owegen on August 13, 2014, 20:49:26 PM
Quote from: GJC Web Design on August 13, 2014, 19:42:35 PM
compare the std template to what you have

you mean the beez template ?
Title: Re: how to show the value of a custom field in the product details page?
Post by: GJC Web Design on August 13, 2014, 20:53:56 PM
no - the standard product detail templates that comes with VM
Title: Re: how to show the value of a custom field in the product details page?
Post by: owegen on August 13, 2014, 20:55:23 PM
Quote from: GJC Web Design on August 13, 2014, 20:53:56 PM
no - the standard product detail templates that comes with VM

I was in it. That's my problem. I don't know how to change the code.
Title: Re: how to show the value of a custom field in the product details page?
Post by: owegen on August 13, 2014, 20:56:58 PM
If you want I can give you an access to my website. Maybe you'll find the problem. It's just a test website
Title: Re: how to show the value of a custom field in the product details page?
Post by: GJC Web Design on August 13, 2014, 21:58:25 PM
If you pay my normal rate no prob - email me if you need me..
Title: Re: how to show the value of a custom field in the product details page?
Post by: Milbo on August 16, 2014, 11:55:36 AM
Learn how todo layout overriding http://docs.virtuemart.net/tutorials/templating-layouts/78-introduction-template-system.html

open the default.php, search for


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


Place that somewhere in your layout. Change the word normal to something like "mypos", or what you want. Give your customfield the position mypos and thats it mainly.

Or ask GJC, or ask me, or jenkinhill