News:

Looking for documentation? Take a look on our wiki

Main Menu

Custom Fields visible only to default (logged in) users

Started by lily64, November 13, 2014, 20:07:25 PM

Previous topic - Next topic

lily64

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.

GJC Web Design

detect if the user is logged in  - in the template

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

//custom fields show here

}
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

lily64

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.


GJC Web Design

you have to surround the call to the default_customfields.php with that code in your default.php
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

lily64

Thanks. For whatever reason it's not working. But I appreciate your time. Thanks anyway.