VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: tehribo on April 24, 2016, 13:30:57 PM

Title: (SOLVED)Customfields to Category (or browse) page - VirtueMart 3.
Post by: tehribo on April 24, 2016, 13:30:57 PM
Hello,

After 5 years I installed VirtueMart again. Everything is fine but I gone crazy trying to display the "customfields" in my Product list (category view).

I am selling electric motors and each of them have 2 basic parameters - Power and Speed.

I want to have them in a column in the Product lists.

It is a second day I am trying to do it, reading all the previous topics, but the things seems to be changed with VirtueMart 3.

Thank you in advance!

Best regards
Title: Re: Customfields to Category (or browse) page - VirtueMart 3.
Post by: GJC Web Design on April 24, 2016, 13:44:28 PM
hmmm... 

http://forum.virtuemart.net/index.php?topic=79799.0

http://forum.virtuemart.net/index.php?topic=104795.0

standard template or some hacky old VM2 one?

set this in admin? ->  Show product customfields in browse views

looked at the demo?

tried with the std. template?
Title: Re: Customfields to Category (or browse) page - VirtueMart 3.
Post by: Ghost on April 24, 2016, 15:21:55 PM
Add customfields sublayout inside products sublayout http://docs.virtuemart.net/tutorials/templating-layouts/199-sublayouts.html
Title: Re: Customfields to Category (or browse) page - VirtueMart 3.
Post by: tehribo on April 25, 2016, 12:34:18 PM
Quote from: GJC Web Design on April 24, 2016, 13:44:28 PM
hmmm... 

http://forum.virtuemart.net/index.php?topic=79799.0
http://forum.virtuemart.net/index.php?topic=104795.0

standard template or some hacky old VM2 one?

set this in admin? ->  Show product customfields in browse views

looked at the demo?

tried with the std. template?

Thank you for your answer: 

I have not installed any Virtuemart templates. Just downloaded the VM and installed it in my website.

The Joomla template which I am using is the free Joomlart - Purity III

"Show product customfields in browse views" is checked.

@Ghost, I tried also the example mentioned here: http://docs.virtuemart.net/tutorials/templating-layouts/199-sublayouts.html

<?php echo shopFunctionsF::renderVmSubLayout('prices',array('product'=>$this->product,'currency'=>$this->currency)); ?>

Can you please give me the exact syntax of including the customfields, instead of prices?

Thank you in advance!

Title: Re: Customfields to Category (or browse) page - VirtueMart 3.
Post by: Jörgen on April 25, 2016, 12:58:03 PM
There are no more Virtuemart templates. The Joomla template has to include the neccessary overrides for VM3. Try with the Protostar template as a starter.

regards


Jörgen @ Kreativ Fotografi
Title: Re: Customfields to Category (or browse) page - VirtueMart 3.
Post by: Ghost on April 25, 2016, 13:13:14 PM
1. Copy /components/com_virtuemart/sublayouts/products.php to /templates/purity_iii/html/com_virtuemart/sublayouts/products.php.

2. Add this inside the copied file, inside product loop:

echo shopFunctionsF::renderVmSubLayout('customfields',array('product'=>$product,'position'=>'normal'));
Title: Re: Customfields to Category (or browse) page - VirtueMart 3.
Post by: tehribo on April 25, 2016, 14:17:00 PM
Quote from: Ghost on April 25, 2016, 13:13:14 PM
1. Copy /components/com_virtuemart/sublayouts/products.php to /templates/purity_iii/html/com_virtuemart/sublayouts/products.php.

2. Add this inside the copied file, inside product loop:

echo shopFunctionsF::renderVmSubLayout('customfields',array('product'=>$product,'position'=>'normal'));

Hello,

I did it like this:

<?php echo "Customfields".shopFunctionsF::renderVmSubLayout('customfields',array('product'=>$product,'position'=>'normal'));
?>


Unfortunatelly this is the output:

(https://forum.virtuemart.net/index.php?action=dlattach;topic=134006.0;attach=64326;image)

Attached you will find also my products.php file.

Title: Re: Customfields to Category (or browse) page - VirtueMart 3.
Post by: Jörgen on April 25, 2016, 14:23:19 PM
Hello

Replace "Customfields" with the text You prefer.

Jörgen @ Kreativ Fotografi
Title: Re: Customfields to Category (or browse) page - VirtueMart 3.
Post by: tehribo on April 25, 2016, 14:25:58 PM
What do you mean?

The "Customfields" word, which you see on the picture is just echo-ed in the php line (<?php echo "Customfields"...), to show you where I was expecting to see the custom fields?

Thank you again for the patience!

Attached you will find the way I set them up.
Title: Re: Customfields to Category (or browse) page - VirtueMart 3.
Post by: Jörgen on April 25, 2016, 14:29:56 PM
Soory, but this was not so clear, You circled the Customfield and we do not speak russian.
Are Your customfields asigned the position  'normal' ?


Jörgen @ Kreativ Fotografi
Title: Re: Customfields to Category (or browse) page - VirtueMart 3.
Post by: tehribo on April 25, 2016, 14:32:15 PM
Actually I have not assigned them any position?
Maybe this is the problem?

But why I can see them on the Product page?



Edited:

I tried to setup Layout position "normal" , still did not fix it :(
Title: Re: Customfields to Category (or browse) page - VirtueMart 3.
Post by: Ghost on April 25, 2016, 14:38:05 PM
Normal is the default position. If no position is set, normal is used.

Make sure "Show product customfields in browse views" is enabled in VM Configuration -> Shopfront.
Title: Re: Customfields to Category (or browse) page - VirtueMart 3.
Post by: tehribo on April 25, 2016, 14:50:24 PM
This fixed it! I am sure it was checked yesterday!

Maybe in all my attempts I removed the check mark.

THANK YOU VERY MUCH YOU ALL!

After 5 years VM is even better.

Regards from Plovdiv!