VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product creation => Topic started by: lily64 on November 13, 2014, 20:07:25 PM

Title: Custom Fields visible only to default (logged in) users
Post by: lily64 on November 13, 2014, 20:07:25 PM
Created several custom fields for products. Pricing and cart is available ONLY to logged in users. THat part is working fine. When we add the custom fields to the products, these variants show up to ALL users, including the price variant. It doesn't make sense that custom field doesn't have a way to hide at least the price variant since if we're restricting the pricing to logged in users using "default", which works beautifully, the custom fields that have price variants should also not show pricing variants until logged in. Thanks for any assistance.

Joomla! 2.5.27, VirtueMart 2.6.12.2.
Title: Re: Custom Fields visible only to default (logged in) users
Post by: GJC Web Design on November 15, 2014, 13:38:31 PM
detect if the user is logged in  - in the template

$user =& JFactory::getUser();
$userid = $user->get('id');
if($userid>0) {

//custom fields show here

}
Title: Re: Custom Fields visible only to default (logged in) users
Post by: lily64 on November 19, 2014, 20:53:31 PM
I tried this but not exactly sure which template file to put it in? I tried the default.php file that does nothing. Tried default_customfields.php as well. Can you be more specific?

Thank you for your assistance.

Title: Re: Custom Fields visible only to default (logged in) users
Post by: GJC Web Design on November 19, 2014, 21:57:00 PM
you have to surround the call to the default_customfields.php with that code in your default.php
Title: Re: Custom Fields visible only to default (logged in) users
Post by: lily64 on November 21, 2014, 18:01:00 PM
Thanks. For whatever reason it's not working. But I appreciate your time. Thanks anyway.